-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seekTo(0) followed by a TrackSelection jumps back to live point. #9347
Comments
Also noticed... The position discontinuity caused by the
Is propagated all the way to EPII @marcbaechinger is there something I've missed here? |
@marcbaechinger I've got the fix for this, writing up a pull request now. I have the code change, just want to add test cases too. |
This is a fix for issue google#9347 Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) and the `preparePositionUs` is used by the player in the `onPrepared()` callback to set the render position it should not use it again. The bug is a track selection causes a jump to live if you are at position 0 in the timeline, even after playback was started from the live point (the prepare position override). # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Thu Sep 2 11:30:31 2021 -0700 # # On branch p-fix-exo-issue-9347 # Changes to be committed: # modified: library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java # modified: library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java # # Untracked files: # validation_data.json #
This is a fix for issue google#9347 Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) and the `preparePositionUs` is used by the player in the `onPrepared()` callback to set the render position it should not use it again. The bug is a track selection causes a jump to live if you are at position 0 in the timeline, even after playback was started from the live point (the prepare position override).
This is a fix for issue google#9347 Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) and the `preparePositionUs` is used by the player in the `onPrepared()` callback to set the render position it should not use it again. The bug is a track selection causes a jump to live if you are at position 0 in the timeline, even after playback was started from the live point (the prepare position override).
There are a couple of issues/PRs evolving around the same problem, let me consolidate this a bit by marking this as a duplicate of #7975 as they both have the same root cause. |
MaskingMediaSource needs to resolve the prepare position set for a MaskingPeriod while the source was still unprepared to the first actual prepare position. It currently assumes that the period-window offset and the default position is zero. This assumption is correct when a PlaceholderTimeline is used, but it may not be true if the real timeline is already known (e.g. when re-preparing a live stream after a playback error). Fix this by using the known timeline at the time of the preparation. Also: - Update a test that should have caught this to use lazy re-preparation. - Change the demo app code to use the recommended way to restart playback after a BehindLiveWindowException. Issue: #8675 PiperOrigin-RevId: 361604191
Using 0 as the unset prepare position is the root cause of a number of issues, as outliine in the ExoPlayer issue #7975 The premise of this fix is that once the prepare override is used (the initial call to `selectTracks()`) it is never needed again, so simply invalidate it after use.
Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) it should not use it again. The bug is a track selection causes a jump to live if you are at position 0 in the timeline, even after playback was started from the live point (the prepare position override).
This is a fix for issue google#9347 Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) and the `preparePositionUs` is used by the player in the `onPrepared()` callback to set the render position it should not use it again. The bug is a track selection causes a jump to live if you are at position 0 in the timeline, even after playback was started from the live point (the prepare position override).
Steps To Reproduce
Add this code to the demo
PlayerActivity
:Run it sending the intent to the player:
Issue Analysis
The
MaskingMediaPeriod
forces position back to live start when TrackSelection is triggered following a seek to 0.I believe this issue is related to issue #7975, specifically the code that handles changing the position, source here.
For the 2.12.x ExoPlayer this results in the player hangs in BUFFERING state but believing there is way more buffer then there is because position does not change. Changes since 2.12 (e.g. dynamic live edge) appear to have changed that behavior so now it simply jumps from position 0 (the expected position) to live edge. We will be fixing this for 2.12 (our current version) and will try to provide a forward port pull request for
dev-v2
Plan is to only apply the override position on the initial playback start, not every track selection as it is done now.
Logging
Here's where the error occurs, MMP overrides the position and returns it from
selectTracks()
The text was updated successfully, but these errors were encountered: