mirror of
https://github.com/androidx/media.git
synced 2025-05-10 09:12:16 +08:00
Workaround flushing issues on S-3 JB MR2.
Targeting to all API level 19 devices using the OMX.SEC.avc.dec decoder is probably the right thing to do. It shouldn't have negative implications if we apply the workaround on devices that don't really need it, except to slow down seeking slightly due to decoder re-allocation. Given we're talking about JB, I think the priority should be to "make sure it works". Issue: #951 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=111514406
This commit is contained in:
parent
9e3e61901e
commit
27e11f1f1a
@ -208,6 +208,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
|
|||||||
private DrmInitData drmInitData;
|
private DrmInitData drmInitData;
|
||||||
private MediaCodec codec;
|
private MediaCodec codec;
|
||||||
private boolean codecIsAdaptive;
|
private boolean codecIsAdaptive;
|
||||||
|
private boolean codecNeedsFlushWorkaround;
|
||||||
private boolean codecNeedsEosPropagationWorkaround;
|
private boolean codecNeedsEosPropagationWorkaround;
|
||||||
private boolean codecNeedsEosFlushWorkaround;
|
private boolean codecNeedsEosFlushWorkaround;
|
||||||
private boolean codecReceivedEos;
|
private boolean codecReceivedEos;
|
||||||
@ -358,6 +359,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
|
|||||||
|
|
||||||
String codecName = decoderInfo.name;
|
String codecName = decoderInfo.name;
|
||||||
codecIsAdaptive = decoderInfo.adaptive;
|
codecIsAdaptive = decoderInfo.adaptive;
|
||||||
|
codecNeedsFlushWorkaround = codecNeedsFlushWorkaround(codecName);
|
||||||
codecNeedsEosPropagationWorkaround = codecNeedsEosPropagationWorkaround(codecName);
|
codecNeedsEosPropagationWorkaround = codecNeedsEosPropagationWorkaround(codecName);
|
||||||
codecNeedsEosFlushWorkaround = codecNeedsEosFlushWorkaround(codecName);
|
codecNeedsEosFlushWorkaround = codecNeedsEosFlushWorkaround(codecName);
|
||||||
try {
|
try {
|
||||||
@ -436,6 +438,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
|
|||||||
codecReconfigured = false;
|
codecReconfigured = false;
|
||||||
codecHasQueuedBuffers = false;
|
codecHasQueuedBuffers = false;
|
||||||
codecIsAdaptive = false;
|
codecIsAdaptive = false;
|
||||||
|
codecNeedsFlushWorkaround = false;
|
||||||
codecNeedsEosPropagationWorkaround = false;
|
codecNeedsEosPropagationWorkaround = false;
|
||||||
codecNeedsEosFlushWorkaround = false;
|
codecNeedsEosFlushWorkaround = false;
|
||||||
codecReceivedEos = false;
|
codecReceivedEos = false;
|
||||||
@ -521,7 +524,7 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
|
|||||||
waitingForFirstSyncFrame = true;
|
waitingForFirstSyncFrame = true;
|
||||||
waitingForKeys = false;
|
waitingForKeys = false;
|
||||||
decodeOnlyPresentationTimestamps.clear();
|
decodeOnlyPresentationTimestamps.clear();
|
||||||
if (Util.SDK_INT < 18 || (codecNeedsEosFlushWorkaround && codecReceivedEos)) {
|
if (codecNeedsFlushWorkaround || (codecNeedsEosFlushWorkaround && codecReceivedEos)) {
|
||||||
// Workaround framework bugs. See [Internal: b/8347958, b/8578467, b/8543366, b/23361053].
|
// Workaround framework bugs. See [Internal: b/8347958, b/8578467, b/8543366, b/23361053].
|
||||||
releaseCodec();
|
releaseCodec();
|
||||||
maybeInitCodec();
|
maybeInitCodec();
|
||||||
@ -944,6 +947,20 @@ public abstract class MediaCodecTrackRenderer extends SampleSourceTrackRenderer
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the decoder is known to fail when flushed.
|
||||||
|
* <p>
|
||||||
|
* If true is returned, the renderer will work around the issue by releasing the decoder and
|
||||||
|
* instantiating a new one rather than flushing the current instance.
|
||||||
|
*
|
||||||
|
* @param name The name of the decoder.
|
||||||
|
* @return True if the decoder is known to fail when flushed.
|
||||||
|
*/
|
||||||
|
private static boolean codecNeedsFlushWorkaround(String name) {
|
||||||
|
return Util.SDK_INT < 18
|
||||||
|
|| (Util.SDK_INT == 18 && "OMX.SEC.avc.dec".equals(name));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the decoder is known to handle the propagation of the
|
* Returns whether the decoder is known to handle the propagation of the
|
||||||
* {@link MediaCodec#BUFFER_FLAG_END_OF_STREAM} flag incorrectly on the host device.
|
* {@link MediaCodec#BUFFER_FLAG_END_OF_STREAM} flag incorrectly on the host device.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user