From 85b99b9077b0c3f57cd6dac0c00123ac9d487791 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 13 Aug 2008 14:31:02 +0000 Subject: 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. --- gst/rtpmanager/rtpsession.c | 54 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'gst/rtpmanager/rtpsession.c') diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index 19982478..bac851aa 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -916,7 +916,6 @@ check_collision (RTPSession * sess, RTPSource * source, /* This is not our local source, but lets check if two remote * source collide */ - if (rtp) { if (source->have_rtp_from) { if (gst_netaddress_equal (&source->rtp_from, &arrival->address)) @@ -938,8 +937,9 @@ check_collision (RTPSession * sess, RTPSource * source, return FALSE; } } - - /* In this case, we have third-party collision or loop */ + /* We received RTP or RTCP from this source before but the network address + * changed. In this case, we have third-party collision or loop */ + GST_DEBUG ("we have a third-party collision or loop"); /* FIXME: Log 3rd party collision somehow * Maybe should be done in upper layer, only the SDES can tell us @@ -1026,7 +1026,7 @@ obtain_source (RTPSession * sess, guint32 ssrc, gboolean * created, * rtp_session_get_internal_source: * @sess: a #RTPSession * - * Get the internal #RTPSource of @session. + * Get the internal #RTPSource of @sess. * * Returns: The internal #RTPSource. g_object_unref() after usage. */ @@ -1042,6 +1042,48 @@ rtp_session_get_internal_source (RTPSession * sess) return result; } +/** + * rtp_session_set_internal_ssrc: + * @sess: a #RTPSession + * @ssrc: an SSRC + * + * Set the SSRC of @sess to @ssrc. + */ +void +rtp_session_set_internal_ssrc (RTPSession * sess, guint32 ssrc) +{ + RTP_SESSION_LOCK (sess); + g_hash_table_steal (sess->ssrcs[sess->mask_idx], + GINT_TO_POINTER (sess->source->ssrc)); + + sess->source->ssrc = ssrc; + rtp_source_reset (sess->source); + + g_hash_table_insert (sess->ssrcs[sess->mask_idx], + GINT_TO_POINTER (sess->source->ssrc), sess->source); + RTP_SESSION_UNLOCK (sess); +} + +/** + * rtp_session_get_internal_ssrc: + * @sess: a #RTPSession + * + * Get the internal SSRC of @sess. + * + * Returns: The SSRC of the session. + */ +guint32 +rtp_session_get_internal_ssrc (RTPSession * sess) +{ + guint32 ssrc; + + RTP_SESSION_LOCK (sess); + ssrc = sess->source->ssrc; + RTP_SESSION_UNLOCK (sess); + + return ssrc; +} + /** * rtp_session_add_source: * @sess: a #RTPSession @@ -2285,6 +2327,7 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime current_time, } /* check for outdated collisions */ + GST_DEBUG ("checking collision list"); item = g_list_first (sess->conflicting_addresses); while (item) { RTPConflictingAddress *known_conflict = item->data; @@ -2294,12 +2337,14 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime current_time, RTCP_INTERVAL_COLLISION_TIMEOUT)) { sess->conflicting_addresses = g_list_delete_link (sess->conflicting_addresses, item); + GST_DEBUG ("collision %p timed out", known_conflict); g_free (known_conflict); } item = next_item; } if (sess->change_ssrc) { + GST_DEBUG ("need to change our SSRC (%08x)", sess->source->ssrc); g_hash_table_steal (sess->ssrcs[sess->mask_idx], GINT_TO_POINTER (sess->source->ssrc)); @@ -2313,6 +2358,7 @@ rtp_session_on_timeout (RTPSession * sess, GstClockTime current_time, sess->bye_reason = NULL; sess->sent_bye = FALSE; sess->change_ssrc = FALSE; + GST_DEBUG ("changed our SSRC to %08x", sess->source->ssrc); } RTP_SESSION_UNLOCK (sess); -- cgit v1.2.1