diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-10-02 14:03:43 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-10-03 17:23:35 +0300 |
commit | 76b5c1c511837950ced4e14118f16df446661efc (patch) | |
tree | 66e03b6d36527308e8f38cb0b8f5d698941fd9ee /ext/openh264 | |
parent | bc5c6a0fc9ef50a82ab2f41b5331a36619608443 (diff) |
openh264dec: Fix various crashes on ::stop()
Diffstat (limited to 'ext/openh264')
-rw-r--r-- | ext/openh264/gstopenh264dec.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/openh264/gstopenh264dec.cpp b/ext/openh264/gstopenh264dec.cpp index 20c29e4c5..401ac15ec 100644 --- a/ext/openh264/gstopenh264dec.cpp +++ b/ext/openh264/gstopenh264dec.cpp @@ -189,14 +189,18 @@ static gboolean gst_openh264dec_start(GstVideoDecoder *decoder) static gboolean gst_openh264dec_stop(GstVideoDecoder *decoder) { GstOpenh264Dec *openh264dec = GST_OPENH264DEC(decoder); - gint ret; + gint ret = TRUE; - gst_h264_nal_parser_free(openh264dec->priv->nal_parser); - openh264dec->priv->nal_parser = NULL; + if (openh264dec->priv->nal_parser) { + gst_h264_nal_parser_free(openh264dec->priv->nal_parser); + openh264dec->priv->nal_parser = NULL; + } - ret = openh264dec->priv->decoder->Uninitialize(); - WelsDestroyDecoder(openh264dec->priv->decoder); - openh264dec->priv->decoder = NULL; + if (openh264dec->priv->decoder) { + ret = openh264dec->priv->decoder->Uninitialize(); + WelsDestroyDecoder(openh264dec->priv->decoder); + openh264dec->priv->decoder = NULL; + } if (openh264dec->priv->input_state) { gst_video_codec_state_unref (openh264dec->priv->input_state); |