[vlc-commits] mediacodec: handle vc1 delayed opening if there is no extradata

Thomas Guillem git at videolan.org
Thu Apr 23 15:41:09 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 23 15:34:33 2015 +0200| [3bbd8b0cfb63cf294f0b110ae2515fbf9c3292ea] | committer: Thomas Guillem

mediacodec: handle vc1 delayed opening if there is no extradata

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3bbd8b0cfb63cf294f0b110ae2515fbf9c3292ea
---

 modules/codec/omxil/android_mediacodec.c |   35 +++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 6adbd89..5474acf 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -760,6 +760,17 @@ static int OpenDecoder(vlc_object_t *p_this)
     if (!p_dec->p_sys->timestamp_fifo)
         goto error;
 
+    switch (p_dec->fmt_in.i_codec)
+    {
+    case VLC_CODEC_VC1:
+        if (!p_dec->fmt_in.i_extra)
+        {
+            msg_Warn(p_dec, "waiting for extra data for codec %4.4s",
+                     (const char *)&p_dec->fmt_in.i_codec);
+            return VLC_SUCCESS;
+        }
+        break;
+    }
     return OpenMediaCodec(p_dec, env);
 
  error:
@@ -1128,6 +1139,28 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
         goto endclean;
     }
 
+    /* try delayed opening if there is a new extra data */
+    if (!p_sys->codec)
+    {
+        bool b_delayed_open = false;
+
+        switch (p_dec->fmt_in.i_codec)
+        {
+        case VLC_CODEC_VC1:
+            if (p_dec->fmt_in.i_extra)
+                b_delayed_open = true;
+        default:
+            break;
+        }
+        if (b_delayed_open && OpenMediaCodec(p_dec, env) != VLC_SUCCESS)
+        {
+            b_error = true;
+            goto endclean;
+        }
+    }
+    if (!p_sys->codec)
+        goto endclean;
+
     /* Use the aspect ratio provided by the input (ie read from packetizer).
      * Don't check the current value of the aspect ratio in fmt_out, since we
      * want to allow changes in it to propagate. */
@@ -1192,7 +1225,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
     } while (p_block && i_input_ret != 1 && i_output_ret != 1);
 
 endclean:
-    if (p_sys->error_state || b_error)
+    if (p_sys->error_state || b_error || !p_sys->codec)
     {
         if( p_block )
         {



More information about the vlc-commits mailing list