Skip to content
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

Long playback stall after failed to get next segment reference #3082

Closed
percytse-harmonic opened this issue Jan 8, 2021 · 9 comments
Closed
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@percytse-harmonic
Copy link

Have you read the FAQ and checked for duplicate open issues?
Yes

What version of Shaka Player are you using?
3.0.6

Can you reproduce the issue with our latest release version?
Yes

Can you reproduce the issue with the latest code from master?
Yes

Are you using the demo app or your own custom app?
Demo app

If custom app, can you reproduce the issue using our demo app?
N/A

What browser and OS are you using?
Chrome 87.0.4280.88, Windows 10

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
N/A

What are the manifest and license server URIs?

N/A

What did you do?

Start playback

What did you expect to happen?
Playback smoothly

What actually happened?

Sometimes when streaming_engine failed to get next segment reference, streaming_engine would fail to advance to next segment forever unless there was an interruption (eg. bitrate change)

The following is the log when this issue happed:

simple_abr_manager.js:279 Calling switch_(), bandwidth=4845 kbps
player.js:4829 switch_
streaming_engine.js:431 switch: switching to Stream (video:4)
streaming_engine.js:414 switch: Stream (audio:10) already active
streaming_engine.js:1104 (video:4) cannot find segment endTime: 49700.617633999995
dash_parser.js:1040 Updating manifest...
(Updating manifest... continues forever)

The error is located at getSegmentReferenceNeeded_ of streaming_engine
When mediaState.lastSegmentReference exists and mediaState.segmentIterator is null, a new segmentIterator will be created by segmentIndex.getIteratorForTime:
https://github.com/google/shaka-player/blob/master/lib/media/streaming_engine.js#L1100
In getIteratorForTime of segment_index, no index could be found unfortunately
A new SegmentIterator is created with index = -1

After that, the query of next segment iterator (https://github.com/google/shaka-player/blob/master/lib/media/streaming_engine.js#L1101)
makes currentPosition_ of SegmentIterator increment from -1 to 0 (https://github.com/google/shaka-player/blob/master/lib/media/segment_index.js#L517)
A null segment reference is returned from mediaState.segmentIterator.next().value and a warning is fired:
https://github.com/google/shaka-player/blob/master/lib/media/streaming_engine.js#L1103

In the next update, getSegmentReferenceNeeded_ is called again
This time mediaState.segmentIterator is no longer null and mediaState.segmentIterator.current() is returned. (which is null)
getSegmentReferenceNeeded_ will then always return null segment reference, unless mediaState.segmentIterator is set to null and segmentIndex.getIteratorForTime is called again

To workaround, we have inserted mediaState.segmentIterator = null after line:
https://github.com/google/shaka-player/blob/master/lib/media/streaming_engine.js#L1103
https://github.com/google/shaka-player/blob/master/lib/media/streaming_engine.js#L1135
but not sure if it is the proper fix

@joeyparrish
Copy link
Member

I believe this was fixed in v3.0.7. Can you please try that release?

@joeyparrish joeyparrish added status: duplicate A duplicate of another issue; should be closed after linking to the original issue and removed needs triage labels Jan 12, 2021
@percytse-harmonic
Copy link
Author

Tried v3.0.7 and latest master branch (v3.1.0-pre), long playback stall is still reproducible.
I have sent the manifest URI to [email protected].

@percytse-harmonic
Copy link
Author

Hi, recently we encountered this issue in two scenario:

  1. Switch Bitrate
    When switch bitrate, mediaState.segmentIterator is created again.
    The time passed to segmentIndex.getIteratorForTime equals to the last segment reference's end time.
    No segment reference found and mediaState.segmentIterator position was reset to 0, resulting playback stall.

  2. Jump to gap
    There is a small gap in the buffer:

0: {start: 21485.901929, end: 21509.816596}
1: {start: 21509.937263, end: 21515.93104}

gap_jump_controller detected the gap and performed a jump:

Jumping forward 0.12066699999923003 seconds because of gap starting at 21509.816596 and ending at 21509.937263
(all): seeked: buffered seek: presentationTime=21509.937263

Unfortunately, 21509.937263 was in gap position for audio segment reference

{index: 4528, start: 21507.939263499997, end: 21509.9250413, uri: "Segment-280442222.m4a"}
{index: 4529, start: 21509.9372635, end: 21511.9425969, uri: "Segment-122222.m4a"}

No segment reference found and mediaState.segmentIterator position was reset to 0, resulting playback stall.

@TheModMaker
Copy link
Contributor

I think that issue was in #3191, which has been fixed in 01ce0f4. Please try again with v3.0.10.

@TheModMaker
Copy link
Contributor

Closing due to inactivity. If this is still an issue for you or if you have further questions, you can ask us to reopen or have the bot reopen it by including @shaka-bot reopen in a comment.

@Ljugoboss
Copy link

Ljugoboss commented May 7, 2021

I believe that we've run into this issue as well.
It's reproducable for us in v3.0.6, v3.0.10 and v3.1.0.

We're able to reproduce it by jumping a small gap when close to live, or by swaping bitrates while playing the stream live, simularly as described in #3082 (comment)

Can this issue be reopened? @TheModMaker

Edit: This seems to only happen in a live stream and being close to the the live edge. The closer you are to the live edge, the easier it is to reproduce

@acheung-harmonicinc
Copy link

Hi, we tried v3.0.10 before and as @Ljugoboss pointed out, it is still not fixed, can this be reopened?
@shaka-bot reopen

@TheModMaker TheModMaker reopened this May 10, 2021
@TheModMaker TheModMaker added needs triage and removed status: duplicate A duplicate of another issue; should be closed after linking to the original issue labels May 10, 2021
@TheModMaker
Copy link
Contributor

I haven't been able to reproduce, but having getIteratorForTime return an index of -1 would be invalid.

@TheModMaker TheModMaker added type: bug Something isn't working correctly priority: P2 Smaller impact or easy workaround and removed needs triage labels Jun 2, 2021
@TheModMaker TheModMaker added this to the v3.2 milestone Jun 2, 2021
@TheModMaker
Copy link
Contributor

Closing as a duplicate of #3393, which has the same problem and is easier to reproduce.

@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Aug 1, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

7 participants