[vlc-commits] mediacodec: fix AMediaCodec.configure failed on some devices

Zhao Zhili git at videolan.org
Mon Feb 15 15:06:09 UTC 2021


vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Wed Feb  3 20:53:07 2021 +0800| [1cde6c1cf840f02f2608451e58161a0cdd689f0a] | committer: Alexandre Janniaux

mediacodec: fix AMediaCodec.configure failed on some devices

fmt_out.video.i_width/i_height are used in MediaCodec configure.
They are not set in --no-mediacodec-dr. Some devices require video
size to be non-zero. For example, Huawei P20 failed with the
following log:

I ACodec  : In onAllocateComponent create compenent, codec name: OMX.hisi.video.decoder.avc
E ACodec  : Wrong cropped rect (0, 0, 0, 0) vs. frame (0, 0)
E ACodec  : [OMX.hisi.video.decoder.avc] configureCodec returning error -22

E NdkMediaCodec: configure: err(-22), failed with format: AMessage(what = 'conf', target = 1) = {
E NdkMediaCodec:   int32_t encoder = 0
E NdkMediaCodec:   string mime = "video/avc"
E NdkMediaCodec:   int32_t max-input-size = 0
E NdkMediaCodec:   int32_t width = 0
E NdkMediaCodec:   int32_t height = 0
E NdkMediaCodec:   int32_t rotation-degrees = 0
E NdkMediaCodec: }

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

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

 modules/codec/omxil/mediacodec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 2788b049d0..f8435f342c 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -946,6 +946,11 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
             }
 
         }
+        else
+        {
+            p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
+            p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
+        }
         p_sys->cat = VIDEO_ES;
     }
     else



More information about the vlc-commits mailing list