rtpsession: Call on-new-ssrc earlier

Right now, we may call on-new-ssrc after we have processed the first
RTP packet. This prevents properly configuring the source as some
property like "probation" are copied internally for use as a
decreasing counter. For this specific property, it prevents the
application from disabling probation on auxiliary sparse stream.

Probation is harmful on sparse streams since the probation algorithm
assume frequent and contiguous RTP packets.
This commit is contained in:
Nicolas Dufresne 2019-04-24 13:47:54 -04:00
parent 74e409590a
commit 84c102b6fe
2 changed files with 30 additions and 2 deletions

View file

@ -2240,6 +2240,9 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer,
prevactive = RTP_SOURCE_IS_ACTIVE (source);
oldrate = source->bitrate;
if (created)
on_new_ssrc (sess, source);
/* let source process the packet */
result = rtp_source_process_rtp (source, &pinfo);
@ -2252,8 +2255,6 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer,
if (oldrate != source->bitrate)
sess->recalc_bandwidth = TRUE;
if (created)
on_new_ssrc (sess, source);
if (source->validated) {
gboolean created;

View file

@ -1861,6 +1861,32 @@ GST_START_TEST (test_on_sending_nacks)
GST_END_TEST;
static void
disable_probation_on_new_ssrc (GObject * session, GObject * source)
{
g_object_set (source, "probation", 0, NULL);
}
GST_START_TEST (test_disable_probation)
{
SessionHarness *h = session_harness_new ();
g_object_set (h->internal_session, "internal-ssrc", 0xDEADBEEF, NULL);
g_signal_connect (h->internal_session, "on-new-ssrc",
G_CALLBACK (disable_probation_on_new_ssrc), NULL);
/* Receive a RTP buffer from the wire */
fail_unless_equals_int (GST_FLOW_OK,
session_harness_recv_rtp (h, generate_test_buffer (0, 0x12345678)));
/* When probation is disable, the packet should be produced immediatly */
fail_unless_equals_int (1, gst_harness_buffers_in_queue (h->recv_rtp_h));
session_harness_free (h);
}
GST_END_TEST;
static Suite *
rtpsession_suite (void)
{
@ -1890,6 +1916,7 @@ rtpsession_suite (void)
tcase_add_test (tc_chain, test_change_sent_sdes);
tcase_add_test (tc_chain, test_disable_sr_timestamp);
tcase_add_test (tc_chain, test_on_sending_nacks);
tcase_add_test (tc_chain, test_disable_probation);
return s;
}