Commit 7ca69e09 by christosts Committed by tonihei

Enable immediate codec start after flush

We verified there is a race condition in the
AsynchronousMediaCodecAdapter when flushing the adapter
multiple times. The race condition results in calling MediaCodec.start()
and MediaCodec.flush() in parallel and that makes the MediaCodec
raise an exception.

This changes the default behavior to call MediaCodec.start() on the
same thread after MediaCodec.flush() to avoid the race condition.

#minor-release

PiperOrigin-RevId: 410509388
parent d78d3492
......@@ -51,6 +51,7 @@ public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter.
public DefaultMediaCodecAdapterFactory() {
asynchronousMode = MODE_DEFAULT;
enableImmediateCodecStartAfterFlush = true;
}
/**
......@@ -92,7 +93,7 @@ public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter.
* playback thread, when operating the codec in asynchronous mode. If disabled, {@link
* MediaCodec#start} will be called by the callback thread after pending callbacks are handled.
*
* <p>By default, this feature is disabled.
* <p>By default, this feature is enabled.
*
* <p>This method is experimental, and will be renamed or removed in a future release.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment