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

Do not add failed push operations in the BufferedHistory #1323

Merged
merged 1 commit into from
Dec 11, 2023

Commits on Dec 11, 2023

  1. Do not add failed push operations in the BufferedHistory

    This commit fixes a kind of rare issue that is tricky to reproduce that
    may happen after a `QuotaExceededError` is encountered when pushing a
    chunk to the audio and video `SourceBuffer` due to memory limitations.
    
    In that situation, we could be left in the following scenario:
      1. We're loading a chunk and pushing it to the `SourceBuffer`
      2. The `SourceBuffer` throws a `QuotaExceededError`, generally this
         means that the device needs more memory to add that chunk
      3. The SegmentBuffer code still adds the chunk to its `SegmentInventory`
         (as it may still have been partially pushed to the SourceBuffer,
         we're not 100% sure of what happened on the lower-level code) and
         to that `SegmentInventory`'s `BufferedHistory`.
      4. The stream code catches the error, try to remove some buffered data
         and retry to push the same chunk.
      5. Same QuotaExceededError
      6. The SegmentBuffer code agains, re do the whole `SegmentInventory` +
         `BufferedHistory` insertion thing for the same reasons
      7. The stream code re-catches the issue, here it takes more drastic
         measures, mainly reducing the amount of buffer that is built in
         advance.
      8. The stream code then check if it re-needs the chunk. However, it
         sees through the `BufferedHistory` that it already tried to load it
         two times, and that in those two times, the browser did not buffer
         it (there ignoring that there was a `QuotaExceededError` involved).
      9. The stream code thus assumes a browser/device issue with that
         segment, and loads the next one instead.
     10. When it's time to decode the skipped chunk, the RxPlayer
         automatically seek over it, which is good, but we would have
         prefered to actually log it.
    
    This commit fixes the issue by clearly identifying in the
    `SegmentInventory` chunks whose push operation had an issue. Those are:
      1. never added to the `BufferedHistory`
      2. always re-loaded if they become needed again
    
    We could also have not added them to the `SegmentInventory` altogether
    but I still think it's better to do it, as in the very rare chance that
    chunk still had been at least partially pushed, our logic would be more
    accurate.
    peaBerberian committed Dec 11, 2023
    Configuration menu
    Copy the full SHA
    79ebbfc View commit details
    Browse the repository at this point in the history