Don't use MediaCodec.setOutputSurface on Nexus 7 with qcom decoder
Issue: #3236 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167581198
This commit is contained in:
parent
a90cef0cb5
commit
0183a83047
@ -78,6 +78,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||
|
||||
private Format[] streamFormats;
|
||||
private CodecMaxValues codecMaxValues;
|
||||
private boolean codecNeedsSetOutputSurfaceWorkaround;
|
||||
|
||||
private Surface surface;
|
||||
private Surface dummySurface;
|
||||
@ -360,7 +361,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||
int state = getState();
|
||||
if (state == STATE_ENABLED || state == STATE_STARTED) {
|
||||
MediaCodec codec = getCodec();
|
||||
if (Util.SDK_INT >= 23 && codec != null && surface != null) {
|
||||
if (Util.SDK_INT >= 23 && codec != null && surface != null
|
||||
&& !codecNeedsSetOutputSurfaceWorkaround) {
|
||||
setOutputSurfaceV23(codec, surface);
|
||||
} else {
|
||||
releaseCodec();
|
||||
@ -431,6 +433,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||
protected void onCodecInitialized(String name, long initializedTimestampMs,
|
||||
long initializationDurationMs) {
|
||||
eventDispatcher.decoderInitialized(name, initializedTimestampMs, initializationDurationMs);
|
||||
codecNeedsSetOutputSurfaceWorkaround = codecNeedsSetOutputSurfaceWorkaround(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -969,6 +972,18 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||
return Util.SDK_INT <= 22 && "foster".equals(Util.DEVICE) && "NVIDIA".equals(Util.MANUFACTURER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the device is known to implement {@link MediaCodec#setOutputSurface(Surface)}
|
||||
* incorrectly.
|
||||
* <p>
|
||||
* If true is returned then we fall back to releasing and re-instantiating the codec instead.
|
||||
*/
|
||||
private static boolean codecNeedsSetOutputSurfaceWorkaround(String name) {
|
||||
// Work around https://github.com/google/ExoPlayer/issues/3236
|
||||
return ("deb".equals(Util.DEVICE) || "flo".equals(Util.DEVICE))
|
||||
&& "OMX.qcom.video.decoder.avc".equals(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a codec with suitable {@link CodecMaxValues} will support adaptation between
|
||||
* two {@link Format}s.
|
||||
|
Loading…
x
Reference in New Issue
Block a user