Commit 196f5f79 by olly Committed by Oliver Woodman

Include P8 in setOutputSurfaceWorkaround

Also disable use of dummy surface for devices that require the
workaround. It's only useful in the case that we can use
setOutputSurfaceWorkaround, so if it's disabled the dummy surface
has no purpose (it actually makes things worse by consuming past
the key-frame prior to the current position, which doesn't happen
if you have no surface at all).

Issue: #3724

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182750068
parent b3d1635a
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
* IMA extension: Add support for playing non-Extractor content MediaSources in * IMA extension: Add support for playing non-Extractor content MediaSources in
the IMA demo app ([#3676](https://github.com/google/ExoPlayer/issues/3676)). the IMA demo app ([#3676](https://github.com/google/ExoPlayer/issues/3676)).
* `EventLogger` moved from the demo app into the core library. * `EventLogger` moved from the demo app into the core library.
* Fix ANR issue on Huawei P8 Lite
([#3724](https://github.com/google/ExoPlayer/issues/3724)).
### 2.6.1 ### ### 2.6.1 ###
......
...@@ -352,7 +352,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -352,7 +352,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
surface = dummySurface; surface = dummySurface;
} else { } else {
MediaCodecInfo codecInfo = getCodecInfo(); MediaCodecInfo codecInfo = getCodecInfo();
if (codecInfo != null && shouldUseDummySurface(codecInfo.secure)) { if (codecInfo != null && shouldUseDummySurface(codecInfo)) {
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure); dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
surface = dummySurface; surface = dummySurface;
} }
...@@ -395,7 +395,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -395,7 +395,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
@Override @Override
protected boolean shouldInitCodec(MediaCodecInfo codecInfo) { protected boolean shouldInitCodec(MediaCodecInfo codecInfo) {
return surface != null || shouldUseDummySurface(codecInfo.secure); return surface != null || shouldUseDummySurface(codecInfo);
} }
@Override @Override
...@@ -405,7 +405,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -405,7 +405,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
MediaFormat mediaFormat = getMediaFormat(format, codecMaxValues, deviceNeedsAutoFrcWorkaround, MediaFormat mediaFormat = getMediaFormat(format, codecMaxValues, deviceNeedsAutoFrcWorkaround,
tunnelingAudioSessionId); tunnelingAudioSessionId);
if (surface == null) { if (surface == null) {
Assertions.checkState(shouldUseDummySurface(codecInfo.secure)); Assertions.checkState(shouldUseDummySurface(codecInfo));
if (dummySurface == null) { if (dummySurface == null) {
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure); dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
} }
...@@ -750,9 +750,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -750,9 +750,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
maybeNotifyRenderedFirstFrame(); maybeNotifyRenderedFirstFrame();
} }
private boolean shouldUseDummySurface(boolean codecIsSecure) { private boolean shouldUseDummySurface(MediaCodecInfo codecInfo) {
return Util.SDK_INT >= 23 && !tunneling return Util.SDK_INT >= 23
&& (!codecIsSecure || DummySurface.isSecureSupported(context)); && !tunneling
&& !codecNeedsSetOutputSurfaceWorkaround(codecInfo.name)
&& (!codecInfo.secure || DummySurface.isSecureSupported(context));
} }
private void setJoiningDeadlineMs() { private void setJoiningDeadlineMs() {
...@@ -1068,13 +1070,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1068,13 +1070,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
*/ */
private static boolean codecNeedsSetOutputSurfaceWorkaround(String name) { private static boolean codecNeedsSetOutputSurfaceWorkaround(String name) {
// Work around https://github.com/google/ExoPlayer/issues/3236, // Work around https://github.com/google/ExoPlayer/issues/3236,
// https://github.com/google/ExoPlayer/issues/3355 and // https://github.com/google/ExoPlayer/issues/3355,
// https://github.com/google/ExoPlayer/issues/3439. // https://github.com/google/ExoPlayer/issues/3439 and
// https://github.com/google/ExoPlayer/issues/3724.
return (("deb".equals(Util.DEVICE) || "flo".equals(Util.DEVICE)) return (("deb".equals(Util.DEVICE) || "flo".equals(Util.DEVICE))
&& "OMX.qcom.video.decoder.avc".equals(name)) && "OMX.qcom.video.decoder.avc".equals(name))
|| (("tcl_eu".equals(Util.DEVICE) || "SVP-DTV15".equals(Util.DEVICE) || (("tcl_eu".equals(Util.DEVICE)
|| "BRAVIA_ATV2".equals(Util.DEVICE)) || "SVP-DTV15".equals(Util.DEVICE)
&& "OMX.MTK.VIDEO.DECODER.AVC".equals(name)); || "BRAVIA_ATV2".equals(Util.DEVICE))
&& "OMX.MTK.VIDEO.DECODER.AVC".equals(name))
|| ("OMX.k3.video.decoder.avc".equals(name) && "ALE-L21".equals(Util.MODEL));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment