diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 8699d4be69..0ee60e5cba 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -77,6 +77,9 @@ * Cronet extension: * RTMP extension: * HLS extension: + * Fix issue where chunk duration wasn't set in `CmcdData` for HLS media, + causing an assertion failure when processing encrypted media segments + ([#2312](https://github.com/androidx/media/issues/2312)). * DASH extension: * Smooth Streaming extension: * RTSP extension: diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java index 8ba3827899..2fc2df2480 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsChunkSource.java @@ -517,7 +517,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; .setPlaybackRate(loadingInfo.playbackSpeed) .setIsLive(!playlist.hasEndTag) .setDidRebuffer(loadingInfo.rebufferedSince(lastChunkRequestRealtimeMs)) - .setIsBufferEmpty(queue.isEmpty()); + .setIsBufferEmpty(queue.isEmpty()) + .setChunkDurationUs(segmentBaseHolder.segmentBase.durationUs); long nextMediaSequence = segmentBaseHolder.partIndex == C.INDEX_UNSET ? segmentBaseHolder.mediaSequence + 1 diff --git a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaChunk.java b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaChunk.java index 49b71b4ee9..0c730e5e6b 100644 --- a/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaChunk.java +++ b/libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsMediaChunk.java @@ -112,8 +112,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; .setFlags(segmentBaseHolder.isPreload ? FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED : 0) .build(); if (cmcdDataFactory != null) { - CmcdData cmcdData = - cmcdDataFactory.setChunkDurationUs(mediaSegment.durationUs).createCmcdData(); + CmcdData cmcdData = cmcdDataFactory.createCmcdData(); dataSpec = cmcdData.addToDataSpec(dataSpec); }