diff options
author | Jan Alexander Steffens (heftig) <jsteffens@make.tv> | 2019-03-07 14:12:47 +0100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2019-03-12 01:40:59 +0000 |
commit | 926ff109b9e6ceb00806cdcc6ed3086c703f3e06 (patch) | |
tree | d6c4d989a70db873f9c8712784b555b30fe34045 | |
parent | 4430fa0e3ea797cc18a01a311bd1c6ae03ce9ca5 (diff) | |
download | gstreamer-plugins-bad-926ff109b9e6ceb00806cdcc6ed3086c703f3e06.tar.gz |
webrtcbin: Syntax cleanup
-rw-r--r-- | ext/webrtc/gstwebrtcstats.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/ext/webrtc/gstwebrtcstats.c b/ext/webrtc/gstwebrtcstats.c index 6bc792473..4799e7eca 100644 --- a/ext/webrtc/gstwebrtcstats.c +++ b/ext/webrtc/gstwebrtcstats.c @@ -457,9 +457,9 @@ _get_stats_from_transport_channel (GstWebRTCBin * webrtc, } /* https://www.w3.org/TR/webrtc-stats/#codec-dict* */ -static gchar * +static void _get_codec_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, - GstStructure * s) + GstStructure * s, gchar ** out_id) { GstStructure *stats; GstCaps *caps; @@ -492,25 +492,32 @@ _get_codec_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, gst_structure_set (s, id, GST_TYPE_STRUCTURE, stats, NULL); gst_structure_free (stats); - return id; + if (out_id) + *out_id = id; + else + g_free (id); } static gboolean _get_stats_from_pad (GstWebRTCBin * webrtc, GstPad * pad, GstStructure * s) { GstWebRTCBinPad *wpad = GST_WEBRTC_BIN_PAD (pad); + TransportStream *stream; gchar *codec_id; - codec_id = _get_codec_stats_from_pad (webrtc, pad, s); - if (wpad->trans) { - WebRTCTransceiver *trans; - trans = WEBRTC_TRANSCEIVER (wpad->trans); - if (trans->stream) - _get_stats_from_transport_channel (webrtc, trans->stream, codec_id, s); - } + _get_codec_stats_from_pad (webrtc, pad, s, &codec_id); - g_free (codec_id); + if (!wpad->trans) + goto out; + + stream = WEBRTC_TRANSCEIVER (wpad->trans)->stream; + if (!stream) + goto out; + _get_stats_from_transport_channel (webrtc, stream, codec_id, s); + +out: + g_free (codec_id); return TRUE; } |