diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-08-13 14:31:02 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-08-13 14:31:02 +0000 |
commit | 85b99b9077b0c3f57cd6dac0c00123ac9d487791 (patch) | |
tree | fbb28773e7477e79b959b0a2c3eb3a405a6374d4 /gst/rtpmanager/gstrtpbin.c | |
parent | 601b0f1d9687981567d3a1b1fc7ac8a853573704 (diff) | |
download | gst-plugins-bad-85b99b9077b0c3f57cd6dac0c00123ac9d487791.tar.gz gst-plugins-bad-85b99b9077b0c3f57cd6dac0c00123ac9d487791.tar.bz2 gst-plugins-bad-85b99b9077b0c3f57cd6dac0c00123ac9d487791.zip |
gst/rtpmanager/gstrtpbin.c: Reset rtp timestamp interpollation when we detect a gap when the clock_base changed.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_associate),
(gst_rtp_bin_sync_chain), (new_ssrc_pad_found):
Reset rtp timestamp interpollation when we detect a gap when the
clock_base changed.
Don't try to adjust the ts-offset when it's too big (> 3seconds)
* gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_set_ssrc):
* gst/rtpmanager/gstrtpsession.h:
Add method to set session SSRC.
* gst/rtpmanager/rtpsession.c: (check_collision),
(rtp_session_set_internal_ssrc), (rtp_session_get_internal_ssrc),
(rtp_session_on_timeout):
* gst/rtpmanager/rtpsession.h:
Added debugging for the collision checks.
Add method to change the internal SSRC of the session.
* gst/rtpmanager/rtpsource.c: (rtp_source_process_rtp):
Reset the clock base when we detect large jumps in the seqnums.
Diffstat (limited to 'gst/rtpmanager/gstrtpbin.c')
-rw-r--r-- | gst/rtpmanager/gstrtpbin.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index de1f549d..46ef4bb9 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -119,6 +119,7 @@ #include "gstrtpbin-marshal.h" #include "gstrtpbin.h" +#include "gstrtpsession.h" GST_DEBUG_CATEGORY_STATIC (gst_rtp_bin_debug); #define GST_CAT_DEFAULT gst_rtp_bin_debug @@ -317,6 +318,7 @@ struct _GstRtpBinStream gint64 unix_delta; /* for lip-sync */ + guint64 last_clock_base; guint64 clock_base; guint64 clock_base_time; gint clock_rate; @@ -876,13 +878,18 @@ gst_rtp_bin_associate (GstRtpBin * bin, GstRtpBinStream * stream, guint8 len, else diff = ostream->ts_offset - ostream->prev_ts_offset; + GST_DEBUG_OBJECT (bin, + "ts-offset %" G_GUINT64_FORMAT ", prev %" G_GUINT64_FORMAT + ", diff: %" G_GINT64_FORMAT, ostream->ts_offset, + ostream->prev_ts_offset, diff); + /* only change diff when it changed more than 1 millisecond. This * compensates for rounding errors in NTP to RTP timestamp * conversions */ - if (diff > GST_MSECOND) + if (diff > GST_MSECOND && diff < (3 * GST_SECOND)) { g_object_set (ostream->buffer, "ts-offset", ostream->ts_offset, NULL); - - ostream->prev_ts_offset = ostream->ts_offset; + ostream->prev_ts_offset = ostream->ts_offset; + } } GST_DEBUG_OBJECT (bin, "stream SSRC %08x, delta %" G_GINT64_FORMAT, ostream->ssrc, ostream->ts_offset); @@ -929,6 +936,9 @@ gst_rtp_bin_sync_chain (GstPad * pad, GstBuffer * buffer) guint32 rtptime; gboolean have_sr, have_sdes; gboolean more; + guint64 clock_base; + + clock_base = GST_BUFFER_OFFSET (buffer); stream = gst_pad_get_element_private (pad); bin = stream->bin; @@ -938,6 +948,14 @@ gst_rtp_bin_sync_chain (GstPad * pad, GstBuffer * buffer) if (!gst_rtcp_buffer_validate (buffer)) goto invalid_rtcp; + /* clock base changes when there is a huge gap in the timestamps or seqnum. + * When this happens we don't want to calculate the extended timestamp based + * on the previous one but reset the calculation. */ + if (stream->last_clock_base != clock_base) { + stream->last_extrtptime = -1; + stream->last_clock_base = clock_base; + } + have_sr = FALSE; have_sdes = FALSE; GST_RTCP_BUFFER_FOR_PACKETS (more, buffer, &packet) { @@ -989,7 +1007,7 @@ gst_rtp_bin_sync_chain (GstPad * pad, GstBuffer * buffer) gst_rtcp_packet_sdes_get_entry (&packet, &type, &len, &data); if (type == GST_RTCP_SDES_CNAME) { - stream->clock_base = GST_BUFFER_OFFSET (buffer); + stream->clock_base = clock_base; stream->clock_base_time = GST_BUFFER_OFFSET_END (buffer); /* associate the stream to CNAME */ gst_rtp_bin_associate (bin, stream, len, data); @@ -1876,6 +1894,7 @@ new_ssrc_pad_found (GstElement * element, guint ssrc, GstPad * pad, gst_caps_to_string (caps), GST_DEBUG_PAD_NAME (pad)); } + stream->last_clock_base = -1; if (gst_structure_get_uint (s, "clock-base", &val)) stream->clock_base = val; else |