[droidmedia] Fix AsyncCodecSource to be asynchronous. JB#57676 #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When MediaCodec starts up, it spits a number of CB_INPUT_AVAILABLE
messages with indexes of available input buffers. The messages are
queued in message channel, so the output buffer will hang in queue
and will not be processed until all input buffers are filled with
data from MediaSource. It may take some time in case of a slow media
source, e.g. camera. This causes the output frame to be delayed by
12-14 frames.
This commit adds a SourceReader that stores available input buffer
indexes on order to unblock message queue and fetches the data from
the MediaSource in a separate thread.