Skip to content

Commit f98c2ab

Browse files
tianyificbaker
authored andcommitted
[HLS] Do not try to seek inside buffer when no chunks are in the buffer
When a `HlsSampleStreamWrapper` has no tracks enabled after track selection, it will clear the `mediaChunks` as well as the the sample queue. However, when the tracks of it are newly re-enabled, we should not attempt to seek inside buffer while there is still no chunks at least partially in the buffer. Issue: #2598 PiperOrigin-RevId: 783754042 (cherry picked from commit ded7742)
1 parent 9c1276f commit f98c2ab

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

RELEASENOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ This release includes the following changes since the
2020
* Remove check for available commands when sending custom commands to a
2121
legacy `MediaBrowserServiceCompat`. This is in parity with the behavior
2222
of legacy controllers/browsers when connected to a legacy app.
23+
* HLS extension
24+
* Fix bug where `HlsSampleStreamWrapper` attempts to seek inside buffer
25+
when there are no chunks available in the buffer
26+
[#2598](https://github.com/androidx/media/issues/2598).
2327

2428
### 1.8.0-rc01 (2025-07-16)
2529

libraries/exoplayer_hls/src/main/java/androidx/media3/exoplayer/hls/HlsSampleStreamWrapper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,10 @@ public boolean seekToUs(long positionUs, boolean forceReset) {
516516
}
517517

518518
// If we're not forced to reset, try and seek within the buffer.
519-
if (sampleQueuesBuilt && !forceReset && seekInsideBufferUs(positionUs, seekToMediaChunk)) {
519+
if (sampleQueuesBuilt
520+
&& !forceReset
521+
&& !mediaChunks.isEmpty()
522+
&& seekInsideBufferUs(positionUs, seekToMediaChunk)) {
520523
return false;
521524
}
522525

0 commit comments

Comments
 (0)