diff options
author | Jan Alexander Steffens (heftig) <jsteffens@make.tv> | 2019-03-07 14:13:14 +0100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2019-03-12 01:40:59 +0000 |
commit | dc0e95acabce149b315b94001ef8e7a0860ef8b4 (patch) | |
tree | 93ac17bd652223bb1d0fe886d1a9b233861636eb /ext | |
parent | 926ff109b9e6ceb00806cdcc6ed3086c703f3e06 (diff) | |
download | gstreamer-plugins-bad-dc0e95acabce149b315b94001ef8e7a0860ef8b4.tar.gz |
webrtcbin: Filter transport stream stats by ssrc
Since the addition of BUNDLE support, the pads and the transceivers
share a single transport stream. When getting stats from the stream,
filter by the ssrc of the current pad to avoid merging the stats for
different pads.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/889
Diffstat (limited to 'ext')
-rw-r--r-- | ext/webrtc/gstwebrtcstats.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/ext/webrtc/gstwebrtcstats.c b/ext/webrtc/gstwebrtcstats.c index 4799e7eca..bf3830413 100644 --- a/ext/webrtc/gstwebrtcstats.c +++ b/ext/webrtc/gstwebrtcstats.c @@ -402,7 +402,8 @@ _get_stats_from_dtls_transport (GstWebRTCBin * webrtc, static void _get_stats_from_transport_channel (GstWebRTCBin * webrtc, - TransportStream * stream, const gchar * codec_id, GstStructure * s) + TransportStream * stream, const gchar * codec_id, guint ssrc, + GstStructure * s) { GstWebRTCDTLSTransport *transport; GObject *rtp_session; @@ -439,12 +440,15 @@ _get_stats_from_transport_channel (GstWebRTCBin * webrtc, const GstStructure *stats; const GValue *val = g_value_array_get_nth (source_stats, i); gboolean internal; + guint stats_ssrc = 0; stats = gst_value_get_structure (val); - /* skip internal sources */ - gst_structure_get (stats, "internal", G_TYPE_BOOLEAN, &internal, NULL); - if (internal) + /* skip internal or foreign sources */ + gst_structure_get (stats, + "internal", G_TYPE_BOOLEAN, &internal, + "ssrc", G_TYPE_UINT, &stats_ssrc, NULL); + if (internal || (ssrc && stats_ssrc && ssrc != stats_ssrc)) continue; _get_stats_from_rtp_source_stats (webrtc, stats, codec_id, transport_id, s); @@ -459,12 +463,13 @@ _get_stats_from_transport_channel (GstWebRTCBin * webrtc, /* https://www.w3.org/TR/webrtc-stats/#codec-dict* */ static void _get_codec_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, - GstStructure * s, gchar ** out_id) + GstStructure * s, gchar ** out_id, guint * out_ssrc) { GstStructure *stats; GstCaps *caps; gchar *id; double ts; + guint ssrc = 0; gst_structure_get_double (s, "timestamp", &ts); @@ -483,6 +488,9 @@ _get_codec_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, if (gst_structure_get_int (caps_s, "clock-rate", &clock_rate)) gst_structure_set (stats, "clock-rate", G_TYPE_UINT, clock_rate, NULL); + if (gst_structure_get_uint (caps_s, "ssrc", &ssrc)) + gst_structure_set (stats, "ssrc", G_TYPE_UINT, ssrc, NULL); + /* FIXME: codecType, mimeType, channels, sdpFmtpLine, implementation, transportId */ } @@ -496,6 +504,9 @@ _get_codec_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, *out_id = id; else g_free (id); + + if (out_ssrc) + *out_ssrc = ssrc; } static gboolean @@ -504,8 +515,9 @@ _get_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, GstStructure * s) GstWebRTCBinPad *wpad = GST_WEBRTC_BIN_PAD (pad); TransportStream *stream; gchar *codec_id; + guint ssrc; - _get_codec_stats_from_pad (webrtc, pad, s, &codec_id); + _get_codec_stats_from_pad (webrtc, pad, s, &codec_id, &ssrc); if (!wpad->trans) goto out; @@ -514,7 +526,7 @@ _get_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, GstStructure * s) if (!stream) goto out; - _get_stats_from_transport_channel (webrtc, stream, codec_id, s); + _get_stats_from_transport_channel (webrtc, stream, codec_id, ssrc, s); out: g_free (codec_id); |