video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.46k stars 2.55k forks source link

Live streams reload interval out of scope #801

Closed sergiojm closed 7 years ago

sergiojm commented 7 years ago
Environment

The reload manifest time doesn't take in consideration fragLoadingProcessingMs.

When out of scope fragLoadingProcessingMs goes from 30 ms to 900 ms. When setting reload playlist the remux didnt occur yet.

With chunks like 2s means half of the duration, so starts to lag and lower the levels, and after a while it freezes.

Added some extra logging to check values. On scope: level/reloadInterval: 1985 fragLoadingProcessingMs: 39.065000000060536

Out of scope: reloadInterva:l 1942 fragLoadingProcessingMs: 940.7900000000009

and level/adjustedbw/currentBw/bitrate/avgDuration/maxFetchDuration/fetchDuration: 3/1927636/2409545.1366317654/2000000/2/8.345087/2.075080447336777

level/adjustedbw/currentBw/bitrate/avgDuration/maxFetchDuration/fetchDuration: 2/1927636/2409545.1366317654/1000000/2.02013605441509/8.345087/1.0479862068692043

sergiojm commented 7 years ago

With out of scope the playback rate says 1 but since the clocks change, also get delayed.

Means that is going to a far away from live position.

With no alternative audio there is no problem, cause the ts are on the buffers already, but changing a audio track(changing level also is a issue) the manifest will not find alternative audio tracks for the currentTime.

Possible fix for this is the ensureLivePosition to send back to live pos.

As a note looking at youtube live dash you can see when u come back to scope it send the current time to live pos.

mangui commented 7 years ago

@sergiojm not quite sure to understand your issue. could you send logs / stream permalink

sergiojm commented 7 years ago

The logs don't dump fragLoadingProcessingMs, how can I active to dump trace logs?

Example:

  1. 12s of chunks available on a playlist. Playing 10s away from live sync Go to a diferent tab on chrome(as example) After a while your are playing something like 20s or more from live sync position.(playbackrate its set to 1). Changing level or alternative audio track, downloads a new playlist which dont have the chunks for your currentTime.

Second impact not critical: Use any kind of live stream, go to a different tab on chrome, and the remux/process time will increase from 30ms to 900ms.

Which leads to a bitrate speed on the stats from bwEstimator to be very low. So starts to go to lower levels until it reachs level 0. But it should do some quick recover after getting focus again(go back to the tab)

Also impacts playlist reload settimeout which doesn't take in consideration the time for processing a frag.

The reloadInterval should not have great impact, since it can download 2 or 3 ts in a row but for short low latency is going to break after a while of play experience.

This is because CPU clock speed on an out of focus tab/window it reduces tremendous.

sergiojm commented 7 years ago

Tested with latest version 0.6.9 and now working properly.

Closing