Commit graph

20 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Wim Taymans
387f41e157 gst/rtpmanager/gstrtpjitterbuffer.c: Only peek at the tail element instead of popping it off, which allows us to grea...
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_chain), (gst_rtp_jitter_buffer_loop):
Only peek at the tail element instead of popping it off, which allows
us to greatly simplify things when the tail element changes.
* gst/rtpmanager/gstrtpsession.c:
(gst_rtp_session_event_recv_rtp_sink):
* gst/rtpmanager/gstrtpssrcdemux.c:
(gst_rtp_ssrc_demux_sink_event):
Forward FLUSH events instead of leaking them.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew),
(calculate_skew), (rtp_jitter_buffer_insert):
* gst/rtpmanager/rtpjitterbuffer.h:
Remove the tail-changed callback in favour of a simple boolean when we
insert a buffer in the queue.
Add method to peek the tail of the buffer.
2009-08-11 02:30:31 +01:00
Wim Taymans
b09507ab0c gst/rtpmanager/gstrtpjitterbuffer.c: Remove some old unused variables.
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_flush_start),
(gst_rtp_jitter_buffer_flush_stop),
(gst_rtp_jitter_buffer_change_state), (apply_offset),
(gst_rtp_jitter_buffer_loop):
Remove some old unused variables.
Don't add the latency to the skew corrected timestamp, latency is only
used to sync against the clock.
Improve debugging.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_init),
(rtp_jitter_buffer_reset_skew), (calculate_skew):
* gst/rtpmanager/rtpjitterbuffer.h:
Handle case where server timestamp goes backwards or wildly jumps by
temporarily pausing the skew correction.
Improve debugging.
2009-08-11 02:30:30 +01:00
Wim Taymans
2b1f49a26e gst/rtpmanager/gstrtpjitterbuffer.c: Remove jitter correction code, it's now in the lower level object.
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c: (apply_latency),
(gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_query):
Remove jitter correction code, it's now in the lower level object.
Use new -core method for doing a peer query.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_init),
(calculate_skew), (rtp_jitter_buffer_insert):
* gst/rtpmanager/rtpjitterbuffer.h:
Move jitter correction to the lowlevel jitterbuffer.
Increase the max window size.
When filling the window, already start estimating the skew using a
parabolic weighting factor so that we have a much better startup
behaviour that gets more accurate with the more samples we have.
Increase the default weighting factor for the steady state to get
smoother timestamps.
2009-08-11 02:30:30 +01:00
Wim Taymans
fa00695a39 gst/rtpmanager/gstrtpbin.c: Fix cleanup crasher.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_dispose),
(gst_rtp_bin_finalize):
Fix cleanup crasher.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_init),
(calculate_skew):
* gst/rtpmanager/rtpjitterbuffer.h:
Dynamically adjust the skew calculation window so that we calculate it
over a period of around 2 seconds.
2009-08-11 02:30:30 +01:00
Wim Taymans
b2aa36cb0d gst/rtpmanager/gstrtpbin.c: Use lock to protect variable.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_set_property),
(gst_rtp_bin_get_property):
Use lock to protect variable.
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_class_init),
(gst_jitter_buffer_sink_parse_caps), (gst_rtp_jitter_buffer_chain),
(convert_rtptime_to_gsttime), (gst_rtp_jitter_buffer_loop):
Reconstruct GST timestamp from RTP timestamps based on measured clock
skew and sync offset.
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_init),
(rtp_jitter_buffer_set_tail_changed),
(rtp_jitter_buffer_set_clock_rate),
(rtp_jitter_buffer_get_clock_rate), (calculate_skew),
(rtp_jitter_buffer_insert), (rtp_jitter_buffer_peek):
* gst/rtpmanager/rtpjitterbuffer.h:
Measure clock skew.
Add callback to be notfied when a new packet was inserted at the tail.
* gst/rtpmanager/rtpsource.c: (rtp_source_init),
(calculate_jitter), (rtp_source_send_rtp):
* gst/rtpmanager/rtpsource.h:
Remove clock skew detection, it's move to the jitterbuffer now.
2009-08-11 02:30:30 +01:00
Wim Taymans
ce70e0f43e gst/rtpmanager/rtpjitterbuffer.*: Fix undefined overflow prone ts_diff handling.
Original commit message from CVS:
* gst/rtpmanager/rtpjitterbuffer.c:
(rtp_jitter_buffer_get_ts_diff):
* gst/rtpmanager/rtpjitterbuffer.h:
Fix undefined overflow prone ts_diff handling.
2009-08-11 02:30:28 +01:00
Wim Taymans
cdd82f2a95 gst/rtpmanager/: Remove complicated async queue and replace with more simple jitterbuffer code while also fixing some...
Original commit message from CVS:
* gst/rtpmanager/Makefile.am:
* gst/rtpmanager/async_jitter_queue.c:
* gst/rtpmanager/async_jitter_queue.h:
* gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_class_init),
(rtp_jitter_buffer_init), (rtp_jitter_buffer_finalize),
(rtp_jitter_buffer_new), (compare_seqnum),
(rtp_jitter_buffer_insert), (rtp_jitter_buffer_pop),
(rtp_jitter_buffer_flush), (rtp_jitter_buffer_num_packets),
(rtp_jitter_buffer_get_ts_diff):
* gst/rtpmanager/rtpjitterbuffer.h:
Remove complicated async queue and replace with more simple jitterbuffer
code while also fixing some bugs.
* gst/rtpmanager/gstrtpbin-marshal.list:
* gst/rtpmanager/gstrtpbin.c: (on_new_ssrc), (on_ssrc_collision),
(on_ssrc_validated), (on_bye_ssrc), (on_bye_timeout), (on_timeout),
(create_session), (gst_rtp_bin_class_init), (create_recv_rtp),
(create_send_rtp):
* gst/rtpmanager/gstrtpbin.h:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_init), (gst_rtp_jitter_buffer_dispose),
(gst_jitter_buffer_sink_parse_caps),
(gst_rtp_jitter_buffer_flush_start),
(gst_rtp_jitter_buffer_flush_stop),
(gst_rtp_jitter_buffer_change_state),
(gst_rtp_jitter_buffer_sink_event), (gst_rtp_jitter_buffer_chain),
(gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_set_property):
* gst/rtpmanager/gstrtpsession.c: (on_new_ssrc),
(on_ssrc_collision), (on_ssrc_validated), (on_bye_ssrc),
(on_bye_timeout), (on_timeout), (gst_rtp_session_class_init),
(gst_rtp_session_init):
* gst/rtpmanager/gstrtpsession.h:
* gst/rtpmanager/rtpsession.c: (on_bye_ssrc), (session_cleanup):
Use new jitterbuffer code.
Expose some new signals in preparation for handling EOS.
2009-08-11 02:30:28 +01:00