summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/rtpsession.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-08-13 14:31:02 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-11 02:30:37 +0100
commit62ecaee7488a18fb71ef012b0161a227576d1e87 (patch)
treebd4e320e6f24e4d3efc5bb9ce30d7de44d6b73f7 /gst/rtpmanager/rtpsession.c
parentcc74738d8331d9cf8ea58754dec3d87f0692e938 (diff)
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/rtpsession.c')
-rw-r--r--gst/rtpmanager/rtpsession.c54
1 files changed, 50 insertions, 4 deletions
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.
*/
@@ -1043,6 +1043,48 @@ rtp_session_get_internal_source (RTPSession * sess)
}
/**
+ * 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
* @src: #RTPSource to add
@@ -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);