After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746035 - rtpjitterbuffer: Does not handle bursts properly
rtpjitterbuffer: Does not handle bursts properly
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-11 14:17 UTC by Nirbheek Chauhan
Modified: 2018-11-03 14:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample rtsp audio stream which yields duplicate timestamps with rtpjitterbuffer (1.28 MB, application/octet-stream)
2015-03-11 14:17 UTC, Nirbheek Chauhan
Details
Sample rtsp audio stream which yields duplicate timestamps with rtpjitterbuffer (89.46 KB, application/octet-stream)
2015-03-12 13:14 UTC, Nirbheek Chauhan
Details

Description Nirbheek Chauhan 2015-03-11 14:17:29 UTC
Created attachment 299099 [details]
Sample rtsp audio stream which yields duplicate timestamps with rtpjitterbuffer

When the attached gdp-payloaded file is run through rtpjitterbuffer, with mode=slave (the default), the output audio has buffers with duplicate pts, but not with mode=buffer/synced/none. Those buffers all seem to contain silence (see bug 746032).

Bad:
gst-launch-1.0 filesrc location=output-gdp-audio.bin ! gdpdepay ! rtpjitterbuffer ! rtpmp4adepay ! decodebin ! ...

Good:
gst-launch-1.0 filesrc location=output-gdp-audio.bin ! gdpdepay ! rtpjitterbuffer mode=buffer ! rtpmp4adepay ! decodebin ! ...

gst-launch-1.0 filesrc location=output-gdp-audio.bin ! gdpdepay ! rtpjitterbuffer mode=synced ! rtpmp4adepay ! decodebin ! ...

gst-launch-1.0 filesrc location=output-gdp-audio.bin ! gdpdepay ! rtpjitterbuffer mode=none ! rtpmp4adepay ! decodebin ! ...

All the incoming packets are sequential and evenly-spaced (captured from gst-rtsp-server over a link-local network), so in theory there shouldn't be a "discontinuity" like that.
Comment 1 Nirbheek Chauhan 2015-03-12 13:14:13 UTC
Created attachment 299200 [details]
Sample rtsp audio stream which yields duplicate timestamps with rtpjitterbuffer

I attached the wrong file, sorry. :)
Comment 2 Sebastian Dröge (slomo) 2015-03-12 18:06:47 UTC
The problem here is:
0:00:00.073105731 19667      0x1721450 DEBUG        rtpjitterbuffer rtpjitterbuffer.c:601:calculate_skew: backwards timestamps, using previous time

but I fail to understand the calculations that lead to this currently. All timestamps I see are monotonically increasing :)
Comment 3 Sebastian Dröge (slomo) 2015-03-14 12:33:33 UTC
The bug here is that we have two jitterbuffers, the second one becoming completely confused because of the first.

rtspsrc ! gdppay ! filesink (one jitterbuffer in rtspsrc)
filesrc ! gdpdepay ! rtpjitterbuffer ! ... (second jitterbuffer).
Comment 4 Nirbheek Chauhan 2015-03-14 16:58:36 UTC
As discussed on IRC, the bug does happen even without gdp(de)pay. I'm attaching a full pcap capture (RTP, TCP, RTSP/SDP) as requested by Sebastian.
Comment 5 Nirbheek Chauhan 2015-03-14 17:01:17 UTC
The file is too big for bugzilla even with `xz`, so I've put it on my server:

http://nirbheek.in/files/rtpjitterbuffer-bug.pcap
Comment 6 Sebastian Dröge (slomo) 2015-03-14 17:19:55 UTC
The problem here is that we get a burst of data in the beginning.
The way to handle this is a bit complicated :)

- The jitterbuffer has to check when it first filled up to $latency amount of RTP timestamps
- If the slope is >> 1.0 then (i.e. we received all these buffers much faster than real time), the real latency of the jitterbuffer is the time it took to fill up the buffer and this should be used in the replies to the LATENCY query
- Once the slope goes back to normal, i.e. close to 1.0, we skew once
- Whenever the slope is much bigger than 1.0 (also later), we won't skew until the slope goes back to normal. Skewing would just completely break everything :)


As an end result, we would start playback faster (i.e. GStreamer latency is small) but the sender-to-receiver latency would have the latency value configured on the jitterbuffer.
Comment 7 Sebastian Dröge (slomo) 2015-03-14 17:40:50 UTC
> gst-launch-1.0 filesrc location=rtpjitterbuffer-bug.pcap ! pcapparse src-port=46028 dst-port=44382 caps="application/x-rtp,media=audio,clock-rate=44100,encoding-name=MP4A-LATM,clock-base=703710269,seqnum-base=12883" ! rtpjitterbuffer ! fakesink silent=false sync=true
Comment 8 GStreamer system administrator 2018-11-03 14:58:35 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/167.