shaka-player-embedded icon indicating copy to clipboard operation
shaka-player-embedded copied to clipboard

Handle slow decoding better

Open theodab opened this issue 7 years ago • 0 comments

Currently we only stall the media pipeline if we don't have enough (encoded) data buffered. This means that if the device isn't decoding frames fast enough, the current time will continue to move despite the frames not changing. The previous way was to use the decoded frames to stall the buffer; but this isn't ideal either since it doesn't allow us to drop frames.

The behavior for slow decoders is split into two areas: (1) dropping frames to keep up with the current playhead time and (2) stalling the media pipeline (i.e. stop current time from progressing) so the decoding can catch up.

We should avoid stalling the pipeline due to decoder problems since, with small stalls, it looks better to move time forward rather than stop time and start it again. But if there are large delays or if we aren't playing anything, we should stall the pipeline.

We should also add discarding encoded frames. If we detect that the playhead is at the next keyframe, we should just ignore the remaining frames, reset, and start again at the next keyframe. We should also look more into FFmpeg's API to handle discarding the decoded frames but still processing them for dependent frames. Our attempts in the past didn't work since it seemed like it would not process them and would lead to problems decoding the next frames.

theodab avatar Nov 15 '18 23:11 theodab