Use a custom video renderer for MetadataRetrieverImpl.

Currently, MetadataRetrieverImpl uses MediaCodecVideoRenderer to renderering
frames to capture. It suffers from 2 issues:
- MediaCodecVideoRenderer has a lot of logic to time frame release, including
drop frames if late or try to keep up with feeding speed etc... These are not
necessary at all for frame retrieval.
- MediaCodecVideoRenderer always tries to render 1 frame after video surface
update. This may some times lead to the wrong image being rendered for
MetadataRetriever.
This CL replaces this with a custom video renderer, that does not time frame
releases, and only render first frame after position reset / renderer
re-enabling.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207276937
This commit is contained in:
hoangtc 2018-08-03 09:24:34 -07:00 committed by Oliver Woodman
parent b3d52f5d80
commit 0cdeb555d1

View File

@ -684,6 +684,15 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
return false;
}
/**
* Returns the offset that should be subtracted from {@code bufferPresentationTimeUs} in {@link
* #processOutputBuffer(long, long, MediaCodec, ByteBuffer, int, int, long, boolean)} to get the
* playback position with respect to the media.
*/
protected long getOutputStreamOffsetUs() {
return outputStreamOffsetUs;
}
/**
* Called when an output buffer is successfully processed.
*