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;
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);
/* 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);
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 */
}
*out_id = id;
else
g_free (id);
+
+ if (out_ssrc)
+ *out_ssrc = ssrc;
}
static gboolean
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;
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);