Enable setOutputSurfaceWorkaround for dangal

Issue: #5169
PiperOrigin-RevId: 225025357
This commit is contained in:
olly 2018-12-11 18:19:07 +00:00 committed by Oliver Woodman
parent be2942cee3
commit db5083d18a

View File

@ -1297,12 +1297,19 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
* incorrectly. * incorrectly.
*/ */
protected boolean codecNeedsSetOutputSurfaceWorkaround(String name) { protected boolean codecNeedsSetOutputSurfaceWorkaround(String name) {
if (Util.SDK_INT >= 27 || name.startsWith("OMX.google")) { if (name.startsWith("OMX.google")) {
// Devices running API level 27 or later should also be unaffected. Google OMX decoders are // Google OMX decoders are not known to have this issue on any API level.
// not known to have this issue on any API level.
return false; return false;
} }
// Work around: synchronized (MediaCodecVideoRenderer.class) {
if (!evaluatedDeviceNeedsSetOutputSurfaceWorkaround) {
if (Util.SDK_INT <= 27 && "dangal".equals(Util.DEVICE)) {
// Dangal is affected on API level 27: https://github.com/google/ExoPlayer/issues/5169.
deviceNeedsSetOutputSurfaceWorkaround = true;
} else if (Util.SDK_INT >= 27) {
// In general, devices running API level 27 or later should be unaffected. Do nothing.
} else {
// Enable the workaround on a per-device basis. Works around:
// https://github.com/google/ExoPlayer/issues/3236, // https://github.com/google/ExoPlayer/issues/3236,
// https://github.com/google/ExoPlayer/issues/3355, // https://github.com/google/ExoPlayer/issues/3355,
// https://github.com/google/ExoPlayer/issues/3439, // https://github.com/google/ExoPlayer/issues/3439,
@ -1316,8 +1323,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
// https://github.com/google/ExoPlayer/issues/4419, // https://github.com/google/ExoPlayer/issues/4419,
// https://github.com/google/ExoPlayer/issues/4460, // https://github.com/google/ExoPlayer/issues/4460,
// https://github.com/google/ExoPlayer/issues/4468. // https://github.com/google/ExoPlayer/issues/4468.
synchronized (MediaCodecVideoRenderer.class) {
if (!evaluatedDeviceNeedsSetOutputSurfaceWorkaround) {
switch (Util.DEVICE) { switch (Util.DEVICE) {
case "1601": case "1601":
case "1713": case "1713":
@ -1455,6 +1460,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
// Do nothing. // Do nothing.
break; break;
} }
}
evaluatedDeviceNeedsSetOutputSurfaceWorkaround = true; evaluatedDeviceNeedsSetOutputSurfaceWorkaround = true;
} }
} }