gstrtpbuffer.c: gst_rtp_buffer_ext_timestamp handle "cannot unwrap" case

The previous implementation of gst_rtp_buffer_ext_timestamp had an error
case when it can't calculate an extended timestamp. It happened if a
delta between previous and the current timestamps larger than G_MAXINT32
and wrapping have not yet taken place.

There are some problems with not handling such a big jump:

- gst_rtp_buffer_ext_timestamp logs a warning & returns 0, which
indicates an error. Every code using gst_rtp_buffer_ext_timestamp (in
gst-plugins-good and base) does not do anything about this error case
assuming that gst_rtp_buffer_ext_timestamp just always works.

- 2nd problem which is a consequence of the 1st. An RTP stream with
following timestamps:
0, 0xffffff00, 0xffffff01, 0xffffff02, 0xffffff03... would generate a
warning per every RTP packet starting from RTP packet with timestamp #1
and later. Such excessive logging can introduce a significant
performance hit.

- if there was a code using 0 as a value indicating a special "error"
case. RTP streams starting with zero timestamps would be considered
invalid. Zero is not the best way to indicate the error.

How does the patch change the behaviour of gst_rtp_buffer_ext_timestamp:

- In a scenario when RTP timestamp wrapping took place sometime in a
past. In other words when extended timestamp contains wrap counter >1.
A jump from 0 to 0xffffff00 should be considered as a timestamp going
backward, not an error. Thus the returned extended timestamp should have
decremented wrap counter. This scenario has not changed with the patch.
I only state it here as an illustration.

- In a similar scenario but when wrapping never took place. A jump from
0 to 0xffffff00 used to be considered as an error. This is where the
current patch changes behavior. I argue that it is not an error. It is
just a big jump forward.

I illustrated both scenarios in
test_ext_timestamp_no_backward_wraparound test.

The benefits are:
- The code that uses gst_rtp_buffer_ext_timestamp does not require
changing because it never handled the old error return value.
- no log spam
- gst_rtp_buffer_ext_timestamp does not have "error" return codes it
always returns extended timestamp.
26 jobs for rtpbuffer-cannot-unwrap in 105 minutes and 51 seconds (queued for 7 minutes and 58 seconds)
latest
Status Job ID Name Coverage
  Preparation
passed #1067991
gst indent

00:00:28

passed #1067990
manifest

00:00:22

 
  Build
passed #1068001
build cerbero cross-android universal

00:21:02

manual #1068005
gst-ios-13.2 allowed to fail manual
build cerbero cross-ios universal
passed #1068002
build cerbero cross win32

00:08:58

passed #1068003
build cerbero cross win64

00:07:06

passed #1068000
build cerbero fedora x86_64

00:07:25

passed #1068004
gst-macos-10.15
build cerbero macos x86_64

00:07:26

passed #1067996
build clang fedora x86_64

00:08:25

passed #1067992
build fedora x86_64

00:07:28

failed #1067999
docker windows 1607
build msys2

00:15:05

passed #1067993
build nodebug fedora x86_64

00:05:41

passed #1067994
build static fedora x86_64

00:12:16

passed #1067995
build static nodebug fedora x86_64

00:03:18

passed #1067997
docker windows 1607
build vs2017 amd64

00:10:35

passed #1067998
docker windows 1607
build vs2017 x86

00:09:53

 
  Test
passed #1068006
gstreamer
check fedora

00:03:26

passed #1068007
gstreamer
integration testsuites fedora

00:42:03

passed #1068011
gstreamer
valgrind bad

00:07:23

passed #1068008
gstreamer
valgrind base

00:08:50

passed #1068012
gstreamer
valgrind ges

00:09:12

passed #1068009
gstreamer
valgrind good

00:09:35

passed #1068010
gstreamer
valgrind ugly

00:02:09

 
  Integrate
passed #1068013
cross-android universal examples

00:09:22

skipped #1068015
gst-ios-13.2 allowed to fail manual
cross-ios universal examples
passed #1068014
documentation

00:04:21

 
Name Stage Failure
failed
build msys2 Build
[2141/4047] Linking target subprojects/gst-plugins-base/tests/check/orc_audiomixer.exe.
[2142/4047] Linking target subprojects/gst-plugins-base/tests/check/orc_compositor.exe.
[2143/4047] Compiling C object 'subprojects/gst-plugins-base/tests/icles/22acf47@@playback_test3@exe/playback_test3.c.obj'.
[2144/4047] Linking target subprojects/gst-plugins-base/tests/icles/benchmark_video_conversion.exe.
[2145/4047] Linking target subprojects/gst-plugins-base/tests/check/libs_gstlibscpp.exe.
[2146/4047] Linking target subprojects/gst-plugins-base/tests/icles/test_effect_switch.exe.
[2147/4047] Linking target subprojects/gst-plugins-base/tests/check/orc_volume.exe.
[2148/4047] Linking target subprojects/gst-plugins-base/tests/check/orc_videotestsrc.exe.
ERROR: Job failed: execution took longer than 15m0s seconds