rtpsession: Override the SSRC from the packets' SSRC if none was given via caps or property

This commit is contained in:
Sebastian Dröge 2015-06-07 10:32:38 +02:00
parent 39c0137ea1
commit b549ebd066
3 changed files with 17 additions and 0 deletions

View file

@ -668,6 +668,7 @@ rtp_session_set_property (GObject * object, guint prop_id,
RTP_SESSION_LOCK (sess);
sess->suggested_ssrc = g_value_get_uint (value);
sess->internal_ssrc_set = TRUE;
sess->internal_ssrc_from_caps_or_property = TRUE;
RTP_SESSION_UNLOCK (sess);
if (sess->callbacks.reconfigure)
sess->callbacks.reconfigure (sess, sess->reconfigure_user_data);
@ -1526,6 +1527,11 @@ add_source (RTPSession * sess, RTPSource * src)
sess->stats.active_sources++;
if (src->internal) {
sess->stats.internal_sources++;
if (!sess->internal_ssrc_from_caps_or_property
&& sess->suggested_ssrc != src->ssrc) {
sess->suggested_ssrc = src->ssrc;
sess->internal_ssrc_set = TRUE;
}
}
/* update point-to-point status */
@ -2745,6 +2751,7 @@ rtp_session_update_send_caps (RTPSession * sess, GstCaps * caps)
source = obtain_internal_source (sess, ssrc, &created, GST_CLOCK_TIME_NONE);
sess->suggested_ssrc = ssrc;
sess->internal_ssrc_set = TRUE;
sess->internal_ssrc_from_caps_or_property = TRUE;
if (source) {
rtp_source_update_caps (source, caps);
g_object_unref (source);
@ -2759,6 +2766,8 @@ rtp_session_update_send_caps (RTPSession * sess, GstCaps * caps)
}
}
RTP_SESSION_UNLOCK (sess);
} else {
sess->internal_ssrc_from_caps_or_property = FALSE;
}
}

View file

@ -231,6 +231,7 @@ struct _RTPSession {
guint32 suggested_ssrc;
gboolean internal_ssrc_set;
gboolean internal_ssrc_from_caps_or_property;
/* for sender/receiver counting */
guint32 key;

View file

@ -446,6 +446,7 @@ GST_START_TEST (test_internal_sources_timeout)
GstRTCPPacket rtcp_packet;
GstFlowReturn res;
gint i, j;
GstCaps *caps;
setup_testharness (&data, TRUE);
g_object_get (data.session, "internal-session", &internal_session, NULL);
@ -477,6 +478,12 @@ GST_START_TEST (test_internal_sources_timeout)
gst_buffer_unref (buf);
/* ok, now let's push some RTP packets */
caps =
gst_caps_new_simple ("application/x-rtp", "ssrc", G_TYPE_UINT, 0x01BADBAD,
NULL);
gst_pad_set_caps (data.src, caps);
gst_caps_unref (caps);
for (i = 1; i < 4; i++) {
gst_test_clock_advance_time (GST_TEST_CLOCK (data.clock),
200 * GST_MSECOND);