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
This commit is contained in:
parent
06755d4247
commit
45a5a7584d
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user