SRGSSR / srgmediaplayer-apple

An advanced media player library, simple and reliable
MIT License
158 stars 33 forks source link

Infinite seek loop when a blocked segment is found at the end of the stream #103

Closed defagos closed 3 years ago

defagos commented 3 years ago

If a blocked segment extends until the end of the associated media, the player will perform an infinite seek loop when reaching it, leading to a crash.

Issue type

Incorrect behavior and crash.

Environment information

The simulator is a valid device as well. If all versions or devices seem to be affected, simply enter 'Any'

Reproducibility

Always reproducible

Steps to reproduce

  1. Use one of the demos available.
  2. Define a blocked segment which reaches the end of the media.
  3. Play and seek into the blocked segment.
defagos commented 3 years ago

Here is what happens:

defagos commented 3 years ago

I updated the UTs and made two fix proposals:

  1. The first one does not change how skip notifications are sent. It just ensures that recursive skips are fixed.
  2. The second one is an improvement. Previously, if we had contiguous blocked segments, skips were made one segment at a time, leading to skip notifications being emitted for all of them. This second proposal improves the situation by emitting skip notifications only for the first blocked segment. The player then looks for the next playable seek location and resumes there, without emitting skip notifications for other blocked segments in between (which was not adding any value IMHO). I updated the UT accordingly.

We can discuss whether this second fix proposal makes sense or if the 1st one should be kept.

defagos commented 3 years ago

Fix available on the feature/seek-loop-fix branch.

pyby commented 3 years ago

Good idea to seek to the next playable location. I also improve to seek to end and get the correct end playback state, if seek is out of the duration range.