问题
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