-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Seek nearest SYNC does not adjust stale playlists
`getPlaylistSnapshot()` can return a cached but potentially quite stale playlist that may be unsuitable for resolving a seek position. This change fixes a race conditon that can cause a failed attempt to resolve a seek position with a stale playlist. Pre-conditions for the race: * A is the cached snapshot from previous playback of playlist A * B is the selected playlist at time of the seek * \* — is current playback position in period * QQQ — positions in A cannot be seek targets from B, they have rolled out from `Timeline.Window` * WWW — are positions in A that cannot be resolved in A, but would be in A` ``` +=================*==+ | Period | +=================*==+ +QQQ-------+ | A | +QQQ-------+ +-------WWW+ | B | +-------WWW+ seek and switch back to A occur here... +----------+ | A' | +----------+ ``` The seek request is issued with `Timeline.Window` from playlist B, yet the call to `getAdjustedSeekPositionUs()` occurs: 1. After the current track selection swithces back to A 2. But before playlist snapshot A` is loaded, replacing the old A The check is simple, does basic sanity check on `targetPositionInPlaylistUs` (that it is < durationUs of the selected playlist). This covers the positions WWW.
- Loading branch information
1 parent
6288182
commit 201ece9
Showing
4 changed files
with
75 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
testdata/src/test/assets/media/m3u8/media_playlist_live_first
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#EXTM3U | ||
#EXT-X-MEDIA-SEQUENCE:2 | ||
#EXT-X-INDEPENDENT-SEGMENTS | ||
#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:00:00.106Z | ||
#EXT-X-MAP:URI="init.mp4" | ||
#EXTINF:4, | ||
2.mp4 | ||
#EXTINF:4, | ||
3.mp4 | ||
#EXTINF:4, | ||
4.mp4 | ||
#EXTINF:4, | ||
5.mp4 | ||
#EXTINF:4, | ||
6.mp4 | ||
#EXTINF:4, | ||
7.mp4 |
15 changes: 15 additions & 0 deletions
15
testdata/src/test/assets/media/m3u8/media_playlist_live_second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#EXTM3U | ||
#EXT-X-MEDIA-SEQUENCE:4 | ||
#EXT-X-INDEPENDENT-SEGMENTS | ||
#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:00:08.106Z | ||
#EXT-X-MAP:URI="init.mp4" | ||
#EXTINF:4, | ||
4.mp4 | ||
#EXTINF:4, | ||
5.mp4 | ||
#EXTINF:4, | ||
6.mp4 | ||
#EXTINF:4, | ||
7.mp4 | ||
#EXTINF:4, | ||
8.mp4 |