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 defbd04675
commit 05bfeca50b
2 changed files with 161 additions and 153 deletions

View File

@ -23,6 +23,8 @@
(`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`). (`DataSpec.FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN`).
* Disable post processing on Nvidia devices, as it breaks decode-only frame * Disable post processing on Nvidia devices, as it breaks decode-only frame
skippping. skippping.
* Workaround for MiTV (dangal) issue when swapping output surface
([#5169](https://github.com/google/ExoPlayer/issues/5169)).
### 2.9.2 ### ### 2.9.2 ###

View File

@ -1306,12 +1306,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,
@ -1325,8 +1332,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":
@ -1464,6 +1469,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
// Do nothing. // Do nothing.
break; break;
} }
}
evaluatedDeviceNeedsSetOutputSurfaceWorkaround = true; evaluatedDeviceNeedsSetOutputSurfaceWorkaround = true;
} }
} }