mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
webrtcstats: Fix null pointer dereference
If there is no jitterbuffer stats we should not attempt to store them in the global stats structure. Also add a g_return_if_fail in _gst_structure_take_structure() about this because it is a programmer error to pass an invalid pointer address there. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1479>
This commit is contained in:
parent
13f0128f7e
commit
43856a0735
1 changed files with 5 additions and 1 deletions
|
@ -89,6 +89,8 @@ _gst_structure_take_structure (GstStructure * s, const char *fieldname,
|
||||||
{
|
{
|
||||||
GValue v = G_VALUE_INIT;
|
GValue v = G_VALUE_INIT;
|
||||||
|
|
||||||
|
g_return_if_fail (GST_IS_STRUCTURE (*value_s));
|
||||||
|
|
||||||
g_value_init (&v, GST_TYPE_STRUCTURE);
|
g_value_init (&v, GST_TYPE_STRUCTURE);
|
||||||
g_value_take_boxed (&v, *value_s);
|
g_value_take_boxed (&v, *value_s);
|
||||||
|
|
||||||
|
@ -543,7 +545,9 @@ _get_stats_from_rtp_source_stats (GstWebRTCBin * webrtc,
|
||||||
/* Store the raw stats from GStreamer into the structure for advanced
|
/* Store the raw stats from GStreamer into the structure for advanced
|
||||||
* information.
|
* information.
|
||||||
*/
|
*/
|
||||||
_gst_structure_take_structure (in, "gst-rtpjitterbuffer-stats", &jb_stats);
|
if (jb_stats)
|
||||||
|
_gst_structure_take_structure (in, "gst-rtpjitterbuffer-stats",
|
||||||
|
&jb_stats);
|
||||||
|
|
||||||
gst_structure_set (in, "gst-rtpsource-stats", GST_TYPE_STRUCTURE,
|
gst_structure_set (in, "gst-rtpsource-stats", GST_TYPE_STRUCTURE,
|
||||||
source_stats, NULL);
|
source_stats, NULL);
|
||||||
|
|
Loading…
Reference in a new issue