libs: decoder: h264/h265: decode codec data only if opened
authorHyunjun Ko <zzoon@igalia.com>
Mon, 18 Sep 2017 05:29:55 +0000 (14:29 +0900)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 19 Sep 2017 17:20:42 +0000 (19:20 +0200)
Fixes regression introduced by commit 2eb2b26a.

There is a use case when the decoder set the src caps and immediatly
tries to process the media codec_data, this happens before decoder is
even opened, thus priv->parser is not instantiated yet.

https://bugzilla.gnome.org/show_bug.cgi?id=787818

gst-libs/gst/vaapi/gstvaapidecoder_h264.c
gst-libs/gst/vaapi/gstvaapidecoder_h265.c

index ac45427..a069865 100644 (file)
@@ -4381,6 +4381,9 @@ gst_vaapi_decoder_h264_decode_codec_data (GstVaapiDecoder * base_decoder,
   GstH264ParserResult result;
   guint i, ofs, num_sps, num_pps;
 
+  if (!priv->is_opened)
+    return GST_VAAPI_DECODER_STATUS_SUCCESS;
+
   unit.parsed_info = NULL;
 
   if (buf_size < 7)
index 9d2fa6e..e9353cf 100644 (file)
@@ -2653,6 +2653,9 @@ gst_vaapi_decoder_h265_decode_codec_data (GstVaapiDecoder *
   guint num_nal_arrays, num_nals;
   guint i, j, ofs;
 
+  if (!priv->is_opened)
+    return GST_VAAPI_DECODER_STATUS_SUCCESS;
+
   unit.parsed_info = NULL;
   if (buf_size < 23)
     return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;