MediaCodec在实际设备上为getOutputImage返回null-仿真器有效 [英] MediaCodec returns null for getOutputImage on real devices - Emulator works
问题描述
我正在尝试通过 MediaCodec 使用 getOutputImage 方法(框架使用:Exoplayer).我没有使用SurfaceView,其他一切似乎都很好(这是实现).在我的模拟器上,我得到正确的图像.在我所有的真实设备上(带有Android 7.1.1的OnePlus One,带有Android 7.0的Honor 8,带有Android 6.0.1的Samsung Galaxy Tab S)我总是会得到null作为Image.但是会播放视频,因为我可以听到声音.在SurfaceView上显示图像时,我所有的真实设备都可以正常工作.
I'm trying to grab the Image of a Video via the MediaCodec using the getOutputImage method (Framework used: Exoplayer). I'm NOT using a SurfaceView and every thing else seems fine (this is the implementation). On my emulator I get proper Images. On all my real devices (OnePlus One with Android 7.1.1, Honor 8 with Android 7.0, Samsung Galaxy Tab S with Android 6.0.1) I ALWAYS get null as Image. The Video does play however because I can hear the sound. When showing the Image on a SurfaceView, all my real devices also work fine.
我正在慢慢发疯.谁能指出我可能做错了什么方向?还是我可以调试/测试以找出问题所在的任何方向?
I'm slowly going crazy. Can anyone point me into a direction what I might be doing wrong? Or any direction I might debug / test to figure out what's going wrong?
推荐答案
我相信Exoplayer(v.7)将MediaCodec与 MediaCodecVideoRenderer . 换句话说,使用Exoplayer时从MediaCodec中提取图像可能不是一个好主意,因为它实际上永远不起作用... (但奇怪的是,在Android 8上确实如此).
I believe the Exoplayer (v.7) uses the MediaCodec with a DummySurface inside MediaCodecVideoRenderer when configuring the MediaCodec when you don't pass a own Surface to the Exoplayer. In other words, its probably not a good idea to extract the Image from the MediaCodec when using the Exoplayer because it actually should never work... (but strangely does on Android 8).
这篇关于MediaCodec在实际设备上为getOutputImage返回null-仿真器有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!