MediaCodec returns null for getOutputImage on real devices - Emulator works

£可爱£侵袭症+ 提交于 2019-12-11 06:35:20

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/48966395/mediacodec-returns-null-for-getoutputimage-on-real-devices-emulator-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!