diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-05-10 11:23:02 +0300 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-05-10 08:44:09 +0000 |
commit | d6f6c51f3c3e7ca7667f128b2cabe207775e38f7 (patch) | |
tree | cb2a0a783e6a556a3da2efb627b226f8a3455ad3 /ext | |
parent | 2a2e48fd9e16942107ffe95e6316ff79271070b2 (diff) | |
download | gstreamer-plugins-bad-d6f6c51f3c3e7ca7667f128b2cabe207775e38f7.tar.gz |
spanplc: Don't segfault when retrieving the stats property without a spanplc context
For example when trying to get the property value in NULL state.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1258>
Diffstat (limited to 'ext')
-rw-r--r-- | ext/spandsp/gstspanplc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/spandsp/gstspanplc.c b/ext/spandsp/gstspanplc.c index 94bfde6c9..602c6f07c 100644 --- a/ext/spandsp/gstspanplc.c +++ b/ext/spandsp/gstspanplc.c @@ -75,16 +75,18 @@ static gboolean gst_span_plc_event_sink (GstPad * pad, GstObject * parent, static GstStructure * gst_span_plc_create_stats (GstSpanPlc * self) { - GstStructure *s; + GstStructure *s = NULL; GST_OBJECT_LOCK (self); - s = gst_structure_new ("application/x-spanplc-stats", - "num-pushed", G_TYPE_UINT64, self->num_pushed, - "num-gap", G_TYPE_UINT64, self->num_gap, - "plc-num-samples", G_TYPE_UINT64, self->plc_num_samples, - "plc-duration", G_TYPE_UINT64, self->plc_duration, - "pitch", G_TYPE_INT, self->plc_state->pitch, - "pitch-offset", G_TYPE_INT, self->plc_state->pitch_offset, NULL); + if (self->plc_state) { + s = gst_structure_new ("application/x-spanplc-stats", + "num-pushed", G_TYPE_UINT64, self->num_pushed, + "num-gap", G_TYPE_UINT64, self->num_gap, + "plc-num-samples", G_TYPE_UINT64, self->plc_num_samples, + "plc-duration", G_TYPE_UINT64, self->plc_duration, + "pitch", G_TYPE_INT, self->plc_state->pitch, + "pitch-offset", G_TYPE_INT, self->plc_state->pitch_offset, NULL); + } GST_OBJECT_UNLOCK (self); return s; |