From 6b94f22bd682532dcad1056a7042a68d7847178c Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Thu, 29 Aug 2024 20:50:59 +1000 Subject: [PATCH] webrtcbin: Retrieve RR stats from internal sources Check and generate remote reception statistics from the info stored on internal sources, as they are stored there when running against newer rtpbin since MR !7424 This fixes cases where statistics are incomplete when peers send RR reports from a single remote ssrc, which GStreamer does when bundling is enabled and other RTP stacks may too. Part-of: --- .../gst-plugins-bad/ext/webrtc/gstwebrtcstats.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c index 82fcefb248..d859005f28 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcstats.c @@ -111,7 +111,7 @@ _get_stats_from_remote_rtp_source_stats (TransportStream * stream, const gchar * codec_id, const gchar * kind, const gchar * transport_id, GstStructure * s) { - gboolean have_rb = FALSE, internal = FALSE; + gboolean have_rb = FALSE; int lost; GstStructure *r_in; gchar *r_in_id, *out_id; @@ -120,11 +120,10 @@ _get_stats_from_remote_rtp_source_stats (TransportStream * stream, double ts; gst_structure_get_double (s, "timestamp", &ts); - gst_structure_get (source_stats, "internal", G_TYPE_BOOLEAN, &internal, - "have-rb", G_TYPE_BOOLEAN, &have_rb, NULL); + gst_structure_get (source_stats, "have-rb", G_TYPE_BOOLEAN, &have_rb, NULL); /* This isn't what we're looking for */ - if (internal == TRUE || have_rb == FALSE) + if (have_rb == FALSE) return FALSE; r_in_id = g_strdup_printf ("rtp-remote-inbound-stream-stats_%u", ssrc); @@ -920,7 +919,6 @@ webrtc_stats_get_from_transport_for_one_ssrc (SsrcMapItem * entry, guint stats_ssrc = 0; - /* skip foreign sources */ if (gst_structure_get_uint (stats, "ssrc", &stats_ssrc) && entry->ssrc == stats_ssrc) { GST_TRACE ("Found source stats for ssrc %u: %" GST_PTR_FORMAT, stats_ssrc, @@ -928,7 +926,9 @@ webrtc_stats_get_from_transport_for_one_ssrc (SsrcMapItem * entry, _get_stats_from_rtp_source_stats (ts_stats->stream, stats, ts_stats->codec_id, ts_stats->kind, ts_stats->transport_id, ts_stats->s); - } else if (gst_structure_get_uint (stats, "rb-ssrc", &stats_ssrc) + } + + if (gst_structure_get_uint (stats, "rb-ssrc", &stats_ssrc) && entry->ssrc == stats_ssrc) { GST_TRACE ("Found remote source stats for ssrc %u: %" GST_PTR_FORMAT, stats_ssrc, stats);