libs: decoder: at update_caps() decode codec_data
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 24 Aug 2017 19:51:22 +0000 (21:51 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 14 Sep 2017 14:58:17 +0000 (16:58 +0200)
When updating the caps in decoder, if the caps has codec_data (avC
format), it has to be parsed to update the state of the decoder.

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

gst-libs/gst/vaapi/gstvaapidecoder.c

index ce9c065..9e716db 100644 (file)
@@ -1182,10 +1182,8 @@ gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps)
   if (!decoder_caps)
     return FALSE;
 
-  if (gst_caps_is_always_compatible (caps, decoder_caps)) {
-    set_caps (decoder, caps);
-    return TRUE;
-  }
+  if (gst_caps_is_always_compatible (caps, decoder_caps))
+    return set_caps (decoder, caps);
 
   profile = gst_vaapi_profile_from_caps (caps);
   if (profile == GST_VAAPI_PROFILE_UNKNOWN)
@@ -1194,8 +1192,11 @@ gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps)
   if (codec == 0)
     return FALSE;
   if (codec == decoder->codec) {
-    set_caps (decoder, caps);
-    return TRUE;
+    if (set_caps (decoder, caps)) {
+      return
+          gst_vaapi_decoder_decode_codec_data (decoder) ==
+          GST_VAAPI_DECODER_STATUS_SUCCESS;
+    }
   }
 
   return FALSE;