Fix incorrect re-use of non-secure DummySurface with secure decoder

Issue: #8776
PiperOrigin-RevId: 376186877
This commit is contained in:
olly 2021-05-27 17:36:20 +01:00 committed by Oliver Woodman
parent 2938d40bf4
commit 513185b72a
2 changed files with 14 additions and 2 deletions

View file

@ -47,6 +47,12 @@
* Remove `CastPlayer` specific playlist manipulation methods. Use
`setMediaItems`, `addMediaItems`, `removeMediaItem` and `moveMediaItem`
instead.
* Video:
* Fix bug that could cause `CodecException: Error 0xffffffff` to be thrown
from `MediaCodec.native_setSurface` in use cases that involve both
swapping the output `Surface` and a mixture of secure and non-secure
content being played
([#8776](https://github.com/google/ExoPlayer/issues/8776)).
* Ad playback:
* Support changing ad break positions in the player logic
([#5067](https://github.com/google/ExoPlayer/issues/5067).
@ -66,7 +72,6 @@
* Keep subtitle language features embedded (e.g. rubies & tate-chu-yoko)
in `Cue.text` even when `SubtitleView#setApplyEmbeddedStyles()` is
false.
* UI
* Fix `NullPointerException` in `StyledPlayerView` that could occur after
calling `StyledPlayerView.setPlayer(null)`
([#8985](https://github.com/google/ExoPlayer/issues/8985)).

View file

@ -124,7 +124,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
private boolean codecHandlesHdr10PlusOutOfBandMetadata;
@Nullable private Surface surface;
@Nullable private Surface dummySurface;
@Nullable private DummySurface dummySurface;
private boolean haveReportedFirstFrameRenderedForCurrentSurface;
@C.VideoScalingMode private int scalingMode;
private boolean renderedFirstFrameAfterReset;
@ -486,6 +486,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
}
}
@TargetApi(17) // Needed for dummySurface usage. dummySurface is always null on API level 16.
@Override
protected void onReset() {
try {
@ -596,12 +597,18 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
return tunneling && Util.SDK_INT < 23;
}
@TargetApi(17) // Needed for dummySurface usage. dummySurface is always null on API level 16.
@Override
protected MediaCodecAdapter.Configuration getMediaCodecConfiguration(
MediaCodecInfo codecInfo,
Format format,
@Nullable MediaCrypto crypto,
float codecOperatingRate) {
if (dummySurface != null && dummySurface.secure != codecInfo.secure) {
// We can't re-use the current DummySurface instance with the new decoder.
dummySurface.release();
dummySurface = null;
}
String codecMimeType = codecInfo.codecMimeType;
codecMaxValues = getCodecMaxValues(codecInfo, format, getStreamFormats());
MediaFormat mediaFormat =