Commit graph

60 commits

Author SHA1 Message Date
Wim Taymans
f864131227 jitterbuffer: operate on DTS
Make the jitterbuffer schedule the timeouts based on the DTS instead
of the PTS. This makes it all smoother with reordered frames and gives
the decoder time to reorder the frames in time.
2013-08-01 11:36:56 +02:00
Wim Taymans
ea931d4f57 rtpjitterbuffer: use NULL to ignore percent
If we pass NULL to pop and push we ignore the percent result.
2013-07-30 23:24:23 +02:00
Markovtsev Vadim
7cebe2fc41 rtpjitterbuffer: improve debug output
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=688935
2013-02-07 14:32:26 +01:00
Wim Taymans
c3077012c0 jitterbuffer: do skew estimation only for new timestamps
Only run the skew estimation code when we have a new RTP timestamp. If we have
the same RTP timestamp, we simply use the previous estimation. This works
because the new observation with the same RTP timestamp has to have a bigger
receiver time and is thus not going to influence the estimation except for
causing more jitter.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=640023
2013-02-06 17:15:11 +01:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Wim Taymans
f4eef3f48d rtpbin: set PTS and DTS in jitterbufffer 2012-10-17 12:46:32 +02:00
Edward Hervey
86a57e3546 rtpmanager: Initialize GstRTPBuffer before usage 2011-12-05 18:40:12 +01:00
Wim Taymans
87fbd1e784 Merge branch 'master' into 0.11
Conflicts:
	common
	ext/pulse/pulsesink.c
	ext/soup/gstsouphttpclientsink.c
	gst/audioparsers/gstaacparse.c
	gst/audioparsers/gstac3parse.c
	gst/rtp/gstrtph264depay.c
	gst/rtpmanager/gstrtpjitterbuffer.c
	gst/rtpmanager/rtpjitterbuffer.c
	gst/rtsp/gstrtspsrc.c
	sys/ximage/gstximagesrc.c
2011-09-28 12:44:59 +02:00
Mark Nauwelaerts
915db26029 rtpjitterbuffer: only reset skew on gap if input ts available 2011-09-19 11:56:44 +02:00
Mark Nauwelaerts
1e17e10f75 rtpjitterbuffer: check some more for possible rtp timestamp discontinuity
... when operating in non slave mode, and reset if detected.
This should avoid some (large) bogus outgoing timestamp due to jumps
in rtp time, as result of PAUSE/PLAY or seek or ...
2011-09-19 11:56:40 +02:00
Mark Nauwelaerts
ef02634dc6 rtpmanager: port to 0.11
* use G_DEFINE_TYPE
* adjust to new GstBuffer and corresponding rtp and rtcp buffer interfaces
* misc caps and segment handling changes

FIXME: also relies on being able to pass caps along with a buffer,
which has no evident equivalent yet, so that either needs one,
or still needs quite some code path modification to drag along caps.
2011-07-06 10:16:12 +02:00
Miguel Angel Cabrera Moya
977a5eee7a rtpjitterbuffer: return correct type when assertion fails 2011-06-24 11:59:01 +02:00
Stefan Kost
9f34b89245 rtpjitterbuffer: don't divide by 0 2011-01-25 21:57:57 +02:00
Wim Taymans
eb6d552353 jitterbuffer: get better buffering level
When the jitterbuffer contains -1 timestamps, make sure we still calculate the
buffer fill level by skipping the -1 buffers.
Try to be more resilient to weird input timestamps.
2010-12-20 15:56:50 +01:00
Vladimir Eremeev
8bf7381385 rtpjitterbuffer: improve article reference in comment block
https://bugzilla.gnome.org/show_bug.cgi?id=631082
2010-10-01 18:07:03 +01:00
Thijs Vermeir
2c2c90a723 rtpjitterbuffer: update link to documentation 2010-09-30 12:08:49 +02:00
Wim Taymans
0f59664c6a rtpjitterbuffer: move comment where it belongs 2010-09-06 11:01:57 +02:00
Sebastian Dröge
0a12e69024 rtpjitterbuffer: Return 100 if high-level is 0 instead of dividing by zero 2010-02-23 17:20:02 +01:00
Wim Taymans
7f08081016 jitterbuffer: don't resync to invalid timestamps
If we detect backward timestamps on the server, don't try to resync when we
don't have an input timestamp (such as when using RTSP over TCP) instead, do
nothing but assume the timestamp was ok, it will correct itself when time goes
forwards.
2010-02-12 19:32:27 +01:00
Wim Taymans
8bbfd94c25 rtpbin: more buffering work
When deactivating jitterbuffers when the buffering starts, keep the current
percent of the jitterbuffer and also set the jitterbuffer in the buffering state
so that we know when it's filled again.
Add property to get the buffering percentage of the jitterbuffer.
2010-02-12 17:22:56 +01:00
Wim Taymans
74a3be350d rtpbin: do more accurate buffer offsets
Return the next timestamp in the jitterbuffer.
Use the min-timestamp of the jitterbuffers to calculate an offset so that the
next timestamp is pushed with a timestamp equal to running_time.
Start producing timestamps from 0 in the buffering case too.
2010-02-12 17:22:55 +01:00
Wim Taymans
048e5b6fbe jitterbuffer: report level using high watermark 2010-02-12 17:22:54 +01:00
Wim Taymans
8d814f3782 rtpbin: pass running_time to jitterbuffer pause
Pass the current running time to the jitterbuffer when pausing or resuming so
that it calculate the right offsets.
Small cleanups and comments.
Set the default rtspsrc latency to 2 seconds.
2010-02-12 17:22:54 +01:00
Wim Taymans
bf697b12e3 rtpbin: add some comments 2010-02-12 17:22:53 +01:00
Wim Taymans
20a27a545a rtpbin: more buffering updates
Add signal to pause the jitterbuffer. This will be emitted from gstrtpbin when
one of the jitterbuffers is buffering.
Make rtpbin collect the buffering messages and post a new buffering message with
the min value.
Remove the stats callback from jitterbuffer but pass a percent integer to
functions that affect the buffering state of the jitterbuffer. This allows us
then to post buffering messages from outside of the jitterbuffer lock.
2010-02-12 17:22:53 +01:00
Wim Taymans
a5b9d3f917 rtpbin: propagate buffer-mode property
Propagate buffer-mode property to the jitterbuffers.
Intercept BUFFERING messages in rtpbin
2010-02-12 17:22:53 +01:00
Wim Taymans
d3db9574a9 jitterbuffer: do more buffering implementation
Add callback for buffering stats.
Configure the latency in the jitterbuffer instead of passing it with _insert.
Calculate buffering levels when pushing and popping
Post buffering messages.
2010-02-12 17:22:52 +01:00
Wim Taymans
aeacbfed3e jitterbuffer: flesh out buffering mode some more
Add a buffering state to the jitterbuffer and wait until buffering ends before
pushing out packets.
2010-02-12 17:22:52 +01:00
Wim Taymans
56b29c9a6b jitterbuffer: hook up the mode property
Expose a mode property on the jitterbuffer.
Fix the case where timestamps are -1 in the check for outgoing timestamps.
2010-02-12 17:22:52 +01:00
Wim Taymans
be4517a6b8 jitterbuffer: add buffering mode options
Add getters and setters for different buffering modes that the jitterbuffer will
support. Default to the current slave mode.
2010-02-12 17:22:52 +01:00
Wim Taymans
c262735164 jitterbuffer: handle -1 input timestamps
Don't try to check a -1 timestamp against the max delay.
2009-10-01 12:12:09 +02:00
Havard Graff
a52309eff7 jitterbuffer: change severity of clock-rate change debug
Make log GST_DEBUG under normal circumstances, GST_WARNING otherwise.

Fixes #594253
2009-09-08 13:44:49 +02:00
Wim Taymans
8d924611e7 jitterbuffer: make sure time does not go backwards
When we construct a timestamp that would result in a timestamp that is earlier
than when the packet was received, reset the skew calculation as this is
probably a sign that the sender restarted or paused.

Fixes #593354
2009-09-01 12:48:28 +02:00
Wim Taymans
a26a2a9ff5 jitterbuffer: add slope estimation code and debug
Add some code to measure the sender speed vs the receiver speed. This can be
used to detect bursts.
2009-08-31 13:02:16 +02:00
Wim Taymans
4814d899c2 jitterbuffer: reset skew when timestamps change
Refactor the jitterbuffer resync code.
Reset the skew correction when we detect a big timestamp discont.

See #593354
2009-08-31 12:57:32 +02:00
Wim Taymans
e254936e34 jitterbuffer: make sure time never goes invalid
Since the skew can be negative, we might end up with invalid timestamps. Check
for negative results and clamp to 0.

See #593354
2009-08-31 12:47:15 +02:00
Stefan Kost
7ae3923ac6 docs: various doc fixes
No short-desc as we have them in the element details.
Also keep things (Makefile.am and sections.txt) sorted.
Reword ambigous returns. No text after since please.
2009-08-11 02:30:40 +01:00
Arnout Vandecappelle
2142edd399 gst/rtpmanager/rtpjitterbuffer.*: Keep track of the last outgoing timestamp and of the last sender-side time. Timest...
Original commit message from CVS:
Patch by: Arnout Vandecappelle <arnout at mind dot be>
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew),
(calculate_skew):
* gst/rtpmanager/rtpjitterbuffer.h:
Keep track of the last outgoing timestamp and of the last sender-side
time.  Timestamps can only go forward if they do at the sender
side, can only go back if they do at the sender side, and remain the
same if they remain the same at the sender side. Fixes #565319.
2009-08-11 02:30:40 +01:00
Wim Taymans
592c3f222f gst/rtpmanager/gstrtpbin.c: Remove internal sync pad, use signals instead to get lip-sync notifications.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_associate),
(gst_rtp_bin_handle_sync), (create_stream), (free_stream),
(new_ssrc_pad_found):
Remove internal sync pad, use signals instead to get lip-sync
notifications.
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_base_init),
(gst_rtp_jitter_buffer_class_init),
(gst_rtp_jitter_buffer_internal_links), (create_rtcp_sink),
(remove_rtcp_sink), (gst_rtp_jitter_buffer_request_new_pad),
(gst_rtp_jitter_buffer_release_pad),
(gst_rtp_jitter_buffer_sink_rtcp_event),
(gst_rtp_jitter_buffer_chain_rtcp),
(gst_rtp_jitter_buffer_get_property):
* gst/rtpmanager/gstrtpjitterbuffer.h:
Make it possible to send SR packets to the jitterbuffer.
Check if the SR timestamps are valid by comparing them to the RTP
timestamps.
Signal the SR packet and the timing information to listeners.
* gst/rtpmanager/gstrtpssrcdemux.c: (create_demux_pad_for_ssrc),
(gst_rtp_ssrc_demux_rtcp_chain), (gst_rtp_ssrc_demux_src_query):
Remove some unused code.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew),
(calculate_skew), (rtp_jitter_buffer_get_sync):
* gst/rtpmanager/rtpjitterbuffer.h:
Keep track of the last seen RTP timestamp so that we can filter out
invalid SR packets.
2009-08-11 02:30:38 +01:00
Wim Taymans
5ab3e10594 gst/rtpmanager/gstrtpbin.c: Do not try to keep track of the clock-rate ourselves but simply get the value from the ji...
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_associate),
(gst_rtp_bin_sync_chain), (create_stream), (new_ssrc_pad_found):
Do not try to keep track of the clock-rate ourselves but simply get the
value from the jitterbuffer.
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_jitter_buffer_sink_parse_caps), (gst_rtp_jitter_buffer_chain),
(gst_rtp_jitter_buffer_get_sync):
* gst/rtpmanager/gstrtpjitterbuffer.h:
Add some debug info.
Pass the clock-rate to the jitterbuffer.
Also pass the clock-rate along with the rtp timestamp when getting the
sync parameters.
* gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_chain):
Fix some debug.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew),
(calculate_skew), (rtp_jitter_buffer_get_sync):
* gst/rtpmanager/rtpjitterbuffer.h:
Keep track of clock-rate changes and return the clock-rate together with
the rtp timestamps used for sync.
Don't try to construct timestamps when we have no base_time.
* gst/rtpmanager/rtpsource.c: (get_clock_rate):
Request a new clock-rate when the payload type changes.
Reset the jitter calculation when the clock-rate changes.
2009-08-11 02:30:38 +01:00
Wim Taymans
1656fad93e gst/rtpmanager/: Small cleanups and some more debug info.
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_jitter_buffer_sink_parse_caps),
(gst_rtp_jitter_buffer_flush_stop), (gst_rtp_jitter_buffer_chain):
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew),
(calculate_skew):
Small cleanups and some more debug info.
2009-08-11 02:30:38 +01:00
Wim Taymans
eaa23fd49a gst/rtpmanager/gstrtpjitterbuffer.c: Fix problem with using the output seqnum counter to check for input seqnum disco...
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_jitter_buffer_sink_parse_caps),
(gst_rtp_jitter_buffer_flush_start),
(gst_rtp_jitter_buffer_flush_stop), (gst_rtp_jitter_buffer_chain),
(gst_rtp_jitter_buffer_loop):
Fix problem with using the output seqnum counter to check for input
seqnum discontinuities.
Improve gap detection and recovery, reset and flush the jitterbuffer on
seqnum restart. Fixes #556520.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_insert):
Fix wrong G_LIKELY.
2009-08-11 02:30:38 +01:00
Wim Taymans
c2c69bfb86 gst/rtpmanager/: Fix some docs.
Original commit message from CVS:
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_insert),
(rtp_jitter_buffer_get_sync):
* gst/rtpmanager/rtpsession.c: (on_sender_timeout),
(session_cleanup):
* gst/rtpmanager/rtpsource.c:
Fix some docs.
2009-08-11 02:30:37 +01:00
Jan Schmidt
a2b86bbce5 Fix compiler warnings on OS/X
Original commit message from CVS:
* ext/jack/gstjackaudiosink.c: (jack_process_cb):
* gst/rtpmanager/rtpjitterbuffer.c: (calculate_skew):
Fix compiler warnings on OS/X
2009-08-11 02:30:37 +01:00
Wim Taymans
85e26f6546 gst/rtpmanager/gstrtpbin.*: Add signal to notify listeners when a sender becomes a receiver.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (on_sender_timeout),
(create_session), (gst_rtp_bin_associate),
(gst_rtp_bin_sync_chain), (gst_rtp_bin_class_init),
(gst_rtp_bin_request_new_pad):
* gst/rtpmanager/gstrtpbin.h:
Add signal to notify listeners when a sender becomes a receiver.
Tweak lip-sync code, don't store our own copy of the ts-offset of the
jitterbuffer, don't adjust sync if the change is less than 4msec.
Get the RTP timestamp <-> GStreamer timestamp relation directly from
the jitterbuffer instead of our inaccurate version from the source.
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_chain), (gst_rtp_jitter_buffer_loop),
(gst_rtp_jitter_buffer_get_sync):
* gst/rtpmanager/gstrtpjitterbuffer.h:
Add G_LIKELY macros, use global defines for max packet reorder and
dropouts.
Reset the jitterbuffer clock skew detection when packets seqnums are
changed unexpectedly.
* gst/rtpmanager/gstrtpsession.c: (on_sender_timeout),
(gst_rtp_session_class_init), (gst_rtp_session_init):
* gst/rtpmanager/gstrtpsession.h:
Add sender timeout signal.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew),
(calculate_skew), (rtp_jitter_buffer_insert),
(rtp_jitter_buffer_get_sync):
* gst/rtpmanager/rtpjitterbuffer.h:
Add some G_LIKELY macros.
Keep track of the extended RTP timestamp so that we can report the RTP
timestamp <-> GStreamer timestamp relation for lip-sync.
Remove server timestamp gap detection code, the server can sometimes
make a huge gap in timestamps (talk spurts,...) see #549774.
Detect timetamp weirdness instead by observing the sender/receiver
timestamp relation and resync if it changes more than 1 second.
Add method to report about the current rtp <-> gst timestamp relation
which is needed for lip-sync.
* gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
(on_sender_timeout), (check_collision), (rtp_session_process_sr),
(session_cleanup):
* gst/rtpmanager/rtpsession.h:
Add sender timeout signal.
Remove inaccurate rtp <-> gst timestamp relation code, the
jitterbuffer can now do an accurate reporting about this.
* gst/rtpmanager/rtpsource.c: (rtp_source_init),
(rtp_source_update_caps), (calculate_jitter),
(rtp_source_process_rtp):
* gst/rtpmanager/rtpsource.h:
Remove inaccurate rtp <-> gst timestamp relation code.
* gst/rtpmanager/rtpstats.h:
Define global max-reorder and max-dropout constants for use in various
subsystems.
2009-08-11 02:30:37 +01:00
Olivier Crete
d392defbd3 gst/rtpmanager/gstrtpjitterbuffer.c: Make the buffer metadata writable before inserting it in the jitterbuffer becaus...
Original commit message from CVS:
Based on patch by: Olivier Crete <tester at tester dot ca>
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_chain), (gst_rtp_jitter_buffer_loop):
Make the buffer metadata writable before inserting it in the
jitterbuffer because the jitterbuffer will modify the timestamps.
* gst/rtpmanager/rtpjitterbuffer.c:
Update method comment about requiring writable metadata on buffers.
* gst/rtpmanager/rtpsession.c: (rtp_session_process_sr),
(rtp_session_process_rtcp):
Make the RTCP buffer metadata writable because we want to modify the
metadata.
Fixes #546312.
2009-08-11 02:30:37 +01:00
Wim Taymans
bd1e0ebfc0 gst/rtpmanager/gstrtpjitterbuffer.c: When checking the seqnum, reset the jitterbuffer if the gap is too big, we need ...
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_chain), (gst_rtp_jitter_buffer_loop):
When checking the seqnum, reset the jitterbuffer if the gap is too big,
we need to do this so that we can better handle a restarted source.
Fix some comments.
* gst/rtpmanager/rtpjitterbuffer.c: (calculate_skew),
(rtp_jitter_buffer_insert):
Tweak the skew resync diff.
Use our working seqnum compare function in -base.
Rework the jitterbuffer insert code to make it clearer and more
performant by only retrieving the seqnum of the input buffer once and by
adding some G_LIKELY compiler hints.
Improve debugging for duplicate packets.
* gst/rtpmanager/rtpsource.c: (rtp_source_process_rtp):
Fix a comment, we don't do skew correction here..
2009-08-11 02:30:36 +01:00
Stefan Kost
52cdd3c59a gst/rtpmanager/rtpjitterbuffer.c: Don't try to reset the clock skew when we have no timestamps.
Original commit message from CVS:
Patch by: Stefan Kost <ensonic@users.sf.net>
* gst/rtpmanager/rtpjitterbuffer.c: (calculate_skew):
Don't try to reset the clock skew when we have no timestamps.
Fixes #519005.
2009-08-11 02:30:34 +01:00
Olivier Crete
41ada27f2e gst/rtpmanager/: Remove the fixed clock-rate from the jitterbuffer and extend it so that a clock-rate can be provided...
Original commit message from CVS:
Patch by: Olivier Crete <tester@tester.ca>
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_jitter_buffer_sink_parse_caps), (gst_rtp_jitter_buffer_chain):
* gst/rtpmanager/rtpjitterbuffer.c: (calculate_skew),
(rtp_jitter_buffer_insert):
* gst/rtpmanager/rtpjitterbuffer.h:
Remove the fixed clock-rate from the jitterbuffer and extend it so that
a clock-rate can be provided with each buffer instead. Fixes #511686.
2009-08-11 02:30:33 +01:00
Wim Taymans
49e501a647 gst/rtpmanager/: Add signal to notify of an SDES change.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (on_ssrc_sdes), (create_session),
(gst_rtp_bin_class_init):
* gst/rtpmanager/gstrtpbin.h:
* gst/rtpmanager/gstrtpclient.c:
* gst/rtpmanager/gstrtpclient.h:
* gst/rtpmanager/gstrtpjitterbuffer.h:
* gst/rtpmanager/gstrtpmanager.c:
* gst/rtpmanager/gstrtpptdemux.c:
* gst/rtpmanager/gstrtpptdemux.h:
* gst/rtpmanager/gstrtpsession.c: (on_ssrc_sdes),
(gst_rtp_session_class_init), (gst_rtp_session_init):
* gst/rtpmanager/gstrtpsession.h:
* gst/rtpmanager/gstrtpssrcdemux.c:
* gst/rtpmanager/gstrtpssrcdemux.h:
* gst/rtpmanager/rtpjitterbuffer.c:
* gst/rtpmanager/rtpjitterbuffer.h:
* gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
(on_ssrc_sdes), (rtp_session_process_sdes):
* gst/rtpmanager/rtpsession.h:
* gst/rtpmanager/rtpsource.c:
* gst/rtpmanager/rtpsource.h:
* gst/rtpmanager/rtpstats.c:
* gst/rtpmanager/rtpstats.h:
Add signal to notify of an SDES change.
Fix object type in the signal callbacks.
2009-08-11 02:30:32 +01:00