rtpmanager: skip RTPSources if last_rtime is not set yet

Fixes previous commit (which worked in GStreamer 1.22 but not in
1.24 and newer). Sorry for the noise, should have tested on
master before pusshing it :(

Fixes: #3918
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8455>
This commit is contained in:
Ognyan Tonchev 2025-02-11 10:17:34 +01:00 committed by GStreamer Marge Bot
parent 5fb88176c1
commit 9faf555219
3 changed files with 19 additions and 1 deletions

View File

@ -3855,6 +3855,8 @@ session_start_rtcp (RTPSession * sess, ReportData * data)
if (!rtp_source_get_new_sr (own, data->ntpnstime, data->running_time,
&ntptime, &rtptime, &packet_count, &octet_count)) {
gst_rtcp_buffer_unmap (&data->rtcpbuf);
gst_buffer_unref (data->rtcp);
data->rtcp = NULL;
return FALSE;
}
/* store stats */

View File

@ -301,6 +301,7 @@ rtp_source_reset (RTPSource * src)
g_queue_foreach (src->retained_feedback, (GFunc) gst_buffer_unref, NULL);
g_queue_clear (src->retained_feedback);
src->last_rtptime = -1;
src->last_rtime = -1;
src->stats.cycles = -1;
src->stats.jitter = 0;
@ -1503,7 +1504,7 @@ rtp_source_send_rtp (RTPSource * src, RTPPacketInfo * pinfo)
GST_LOG ("SSRC %08x, RTP %" G_GUINT64_FORMAT ", running_time %"
GST_TIME_FORMAT, src->ssrc, ext_rtptime, GST_TIME_ARGS (running_time));
if (ext_rtptime > src->last_rtptime) {
if (src->last_rtime != -1 && ext_rtptime > src->last_rtptime) {
rtp_diff = ext_rtptime - src->last_rtptime;
rt_diff =
GST_CLOCK_TIME_IS_VALID (running_time) ? running_time -

View File

@ -519,6 +519,9 @@ GST_START_TEST (test_no_rbs_for_internal_senders)
GHashTable *sr_ssrcs;
GHashTable *rb_ssrcs, *tmp_set;
/* push latency or the RTPSource won't be ready to produce RTCP */
gst_harness_push_upstream_event (h->send_rtp_h, gst_event_new_latency (0));
/* Push RTP from our send SSRCs */
for (j = 0; j < 5; j++) { /* packets per ssrc */
for (k = 0; k < 2; k++) { /* number of ssrcs */
@ -655,6 +658,9 @@ GST_START_TEST (test_internal_sources_timeout)
fail_unless_equals_int (GST_FLOW_OK, res);
}
/* push latency or the RTPSource won't be ready to produce RTCP */
gst_harness_push_upstream_event (h->send_rtp_h, gst_event_new_latency (0));
/* verify that rtpsession has sent RR for an internally-created
* RTPSource that is using the internal-ssrc */
session_harness_produce_rtcp (h, 1);
@ -877,6 +883,9 @@ GST_START_TEST (test_dont_lock_on_stats)
g_signal_connect (h->session, "notify::stats",
G_CALLBACK (stats_test_cb), &cb_called);
/* push latency or the RTPSource won't be ready to produce RTCP */
gst_harness_push_upstream_event (h->send_rtp_h, gst_event_new_latency (0));
/* Push RTP buffer to make sure RTCP-thread have started */
fail_unless_equals_int (GST_FLOW_OK,
session_harness_send_rtp (h, generate_test_buffer (0, 0xDEADBEEF)));
@ -959,6 +968,9 @@ GST_START_TEST (test_ignore_suspicious_bye)
g_signal_connect (h->session, "notify::stats",
G_CALLBACK (suspicious_bye_cb), &cb_called);
/* push latency or the RTPSource won't be ready to produce RTCP */
gst_harness_push_upstream_event (h->send_rtp_h, gst_event_new_latency (0));
/* Push RTP buffer making our internal SSRC=0xDEADBEEF */
fail_unless_equals_int (GST_FLOW_OK,
session_harness_send_rtp (h, generate_test_buffer (0, 0xDEADBEEF)));
@ -2358,6 +2370,9 @@ GST_START_TEST (test_disable_sr_timestamp)
g_object_set (h->internal_session, "disable-sr-timestamp", TRUE, NULL);
/* push latency or the RTPSource won't be ready to produce RTCP */
gst_harness_push_upstream_event (h->send_rtp_h, gst_event_new_latency (0));
/* Push RTP buffer to make sure RTCP-thread have started */
fail_unless_equals_int (GST_FLOW_OK,
session_harness_send_rtp (h, generate_test_buffer (0, 0xDEADBEEF)));