diff --git a/RELEASENOTES.md b/RELEASENOTES.md index aef2c6fd92..2dc28a2bb0 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -69,6 +69,10 @@ for audio passthrough when the format audio channel count is unset, which occurs with HLS chunkless preparation ([10204](https://github.com/google/ExoPlayer/issues/10204)). +* DRM + * Ensure the DRM session is always correctly updated when seeking + immediately after a format change + ([10274](https://github.com/google/ExoPlayer/issues/10274)). * Ad playback / IMA: * Decrease ad polling rate from every 100ms to every 200ms, to line up with Media Rating Council (MRC) recommendations. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java index de0568de56..aac827d3a0 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java @@ -856,6 +856,19 @@ protected boolean flushOrReleaseCodec() { releaseCodec(); return true; } + if (codecDrainAction == DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION) { + checkState(Util.SDK_INT >= 23); // Implied by DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION + // Needed to keep lint happy (it doesn't understand the checkState call alone) + if (Util.SDK_INT >= 23) { + try { + updateDrmSessionV23(); + } catch (ExoPlaybackException e) { + Log.w(TAG, "Failed to update the DRM session, releasing the codec instead.", e); + releaseCodec(); + return true; + } + } + } flushCodec(); return false; }