Skip to content

Commit

Permalink
Fix incorrect re-use of non-secure DummySurface with secure decoder
Browse files Browse the repository at this point in the history
Issue: #8776
PiperOrigin-RevId: 376186877
  • Loading branch information
ojw28 committed Jun 6, 2021
1 parent 5cec2a7 commit 10e96c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
* Extractors:
* Add support for MPEG-H 3D Audio in MP4 extractors
([#8860](https://github.com/google/ExoPlayer/pull/8860)).
* 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)).
* HLS
* Fix a bug where skipping into spliced-in chunks triggered an assertion
error ([#8937](https://github.com/google/ExoPlayer/issues/8937).
Expand All @@ -21,7 +27,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)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -486,6 +486,7 @@ protected void onDisabled() {
}
}

@TargetApi(17) // Needed for dummySurface usage. dummySurface is always null on API level 16.
@Override
protected void onReset() {
try {
Expand Down Expand Up @@ -596,12 +597,18 @@ protected boolean getCodecNeedsEosPropagation() {
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 =
Expand Down

0 comments on commit 10e96c9

Please sign in to comment.