I'm using the Android NDK MediaCodec API to decode an MP4 stream of varying resolutions.
I am using the built-in functionality to render to a surface, calling AMediaCodec_releaseOutputBuffer
with the render
flag set to true.
I have found that every time the resolution changes, several frames of the old resolution are output on a surface the size of the new resolution. It might look something like this for a step up in resolution:
+------------------+-------------+
| frame of old res | |
| displayed too | |
| small | |
+------------------+ |
| |
| size of new resolution |
+--------------------------------+
After a few frames, the video looks normal again. I suspect it's something to do with the surface changing in size when an input buffer is queued with a new resolution, rather than when the first output buffer of that resolution is dequeued.
Has anyone encountered this issue before?