Eyevinn/channel-engine

BUG: Playhead Tick Compensation Logic Blocked By Low MaxTickInterval

Closed this issue · 0 comments

In a ChannelEngine's engineOptions, when the maxTickInterval is set lower than the largest expected segment duration - or when the largest segment duration is higher than the default maxTickInterval of 10 seconds, then a playback issue may occur after some time.

When the maxTickInterval is lower then the tickInterval in session.startPlayheadAsync() then the internal playhead tick interval duration will be set too low, depending on the difference between the tick and the maxTick.

This will result in incrementing the channel's v2l stream media-sequences too early. The playhead will know that it is too early and will try to compensate by extending the next tickInterval, padding some extra time. However, it can not compensate as it is limited to the max value.

Consider the example of running the channel engine with assets with segments of 6000ms duration, and with a maxTickInterval set to 5000ms.

The channel-engine Playhead will step (or iterate) after 5000ms, when it should have done it after 6000ms. On the next iteration, depending on the set playheadDiffThreshold value, the diff will be added to the next tick duration as an attempt to compensate and get in sync with the asset. e.i. 6000+1000=7000. But 7000 is also greater than the max and the tick interval will be lowered back to 5000ms.
On the next iteration, the Playhead will try to compensate by 2000ms, e.i. 6000+2000=8000. But again the max value will be used instead.

The difference will accumulate over time and the result will have the channel-engine step through media-sequences too fast, consuming the vod asset earlier than expected. An unwanted side-effect is that some players might not handle this livestream behavior gracefully and will just stop playback altogether.