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

set currentLevel or startLevel can trigger fragLoopLoadingError #420

Closed
phloxic opened this issue May 4, 2016 · 13 comments
Closed

set currentLevel or startLevel can trigger fragLoopLoadingError #420

phloxic opened this issue May 4, 2016 · 13 comments
Labels

Comments

@phloxic
Copy link
Contributor

phloxic commented May 4, 2016

To reproduce: http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2Fstream.flowplayer.org%2Fnight2.m3u8&enableStreaming=true&autoRecoverError=false&enableWorker=true&levelCapping=-1&defaultAudioCodec=undefined

  1. let it play through
  2. set currentLevel to at least index 3 (h264 main or high profile)
  3. try to replay
  4. first click on play has no effect (should work on first click)
  5. second click starts playback
  6. fragLoopLoadingError

This did not happen in v0.5.25 - did not test v0.5.26 extensively because it was soon overridden by v0.5.27 where the issue is present.

Flowplayer plugin demo using v0.5.29: http://flowplayer.blacktrash.org/fp6/playlist.html
Same playlist using v0.5.25: http://demos.flowplayer.org/playlist/prev-next-overlayed.html
Pick a high quality manually and switch between clips.

I wonder whether there's a problem with streams containing b-frames (not allowed in baseline profile).

@phloxic
Copy link
Contributor Author

phloxic commented May 4, 2016

The problem is especially prominent in Firefox, but I can also repro in Chrome.

phloxic referenced this issue in flowplayer/flowplayer-hlsjs May 4, 2016
Setting currentLevel or startLevel can trigger fragLoopLoading errors.

See: https://github.com/dailymotion/hls.js/issues/420
phloxic referenced this issue in flowplayer/flowplayer-hlsjs May 4, 2016
Setting currentLevel or startLevel can trigger fragLoopLoading errors.

See: https://github.com/dailymotion/hls.js/issues/420
@mangui
Copy link
Member

mangui commented May 6, 2016

Hi @blacktrash
I tried multiple times and cannot reproduce the fragLoopLoadingError on Chrome/OSX or FF/OSX.
would you mind sending debug logs when repro ?

regarding

  1. first click on play has no effect (should work on first click)

when you switch level on video ended, it will reload last video fragment with new quality level.
when clicking on play, it will play a couple of frames of this last fragment @ new quality level. then switch again to video ended. then you need to press play again to restart the playback from scratch.

@phloxic
Copy link
Contributor Author

phloxic commented May 6, 2016

ok - I can even reproduce it with the highest level of the default demo video (has to end on one level below) in FF 46.0.1:
screen shot 2016-05-06 at 10 53 42 am
(lateron the player got stuck in loading animation at 3:50)
let me get some logs.

@phloxic
Copy link
Contributor Author

phloxic commented May 6, 2016

Here's a log from http://flowplayer.blacktrash.org/fp6/playlist.html

[log] > Loading 4 of [0 ,4],level 7, currentTime:3.005351,bufferEnd:8.028
hls.js (line 8363)
GET http://stream.flowplayer.org/night1/6/1080p/4.ts

200 OK
        21ms    
hls.js (line 8568)
[log] > Demuxing 4 of [0 ,4],level 7
hls.js (line 8363)
[log] > track:audio,container:audio/mp4,codecs[level/parsed]=[mp4a.40.5/mp4a.40.5]
hls.js (line 8363)
[log] > track:video,container:video/mp4,codecs[level/parsed]=[avc1.640029/avc1.42c01e]
hls.js (line 8363)
[log] > parsed video,PTS:[8.000,10.000],DTS:[8.000/10.000],nb:50
hls.js (line 8363)
[log] > parsed audio,PTS:[8.034,10.031],DTS:[8.034/10.031],nb:43
hls.js (line 8363)
[log] > media buffered : [2.04,10]
hls.js (line 8363)
[log] > all media data available, signal endOfStream() to MediaSource and stop loading fragment
hls.js (line 8363)
[log] > media source ended
hls.js (line 8363)
[log] > destroy
hls.js (line 8363)
[log] > detachMedia
hls.js (line 8363)
(nothing to output)
hls.js (line 8363)
[log] > set startLevel:undefined
hls.js (line 8363)
[log] > attachMedia
hls.js (line 8363)
[log] > loadSource:http://stream.flowplayer.org/night2.m3u8
hls.js (line 8363)
GET http://stream.flowplayer.org/night2.m3u8

200 OK
        27ms    
hls.js (line 8568)
[log] > trigger BUFFER_RESET
hls.js (line 8363)
[log] > manifest loaded,8 level(s) found, first bitrate:1908050
hls.js (line 8363)
[log] > set startLevel:7
hls.js (line 8363)
[log] > startLoad
hls.js (line 8363)
[log] > demuxing in webworker
hls.js (line 8363)
[log] > switching to level 7
hls.js (line 8363)
[log] > (re)loading playlist for level 7
hls.js (line 8363)
GET http://stream.flowplayer.org/night2/6/1080p/pl.m3u8

200 OK
        22ms    
hls.js (line 8568)
[log] > media source opened
hls.js (line 8363)
[log] > level 7 loaded [0,5],duration:9.976632
hls.js (line 8363)
[log] > Loading 0 of [0 ,5],level 7, currentTime:0,bufferEnd:0.000
hls.js (line 8363)
GET http://stream.flowplayer.org/night2/6/1080p/0.ts

200 OK
        14ms    
hls.js (line 8568)
[log] > Demuxing 0 of [0 ,5],level 7
hls.js (line 8363)
[log] > set nextLevel:7
hls.js (line 8363)
[log] > creating sourceBuffer with mimeType:audio/mp4;codecs=mp4a.40.5
hls.js (line 8363)
[log] > creating sourceBuffer with mimeType:video/mp4;codecs=avc1.640029
hls.js (line 8363)
[log] > track:audio,container:audio/mp4,codecs[level/parsed]=[mp4a.40.5/mp4a.40.5]
hls.js (line 8363)
[log] > track:video,container:video/mp4,codecs[level/parsed]=[avc1.640029/avc1.640029]
hls.js (line 8363)
[log] > parsed video,PTS:[0.033,2.002],DTS:[0.000/1.969],nb:59
hls.js (line 8363)
[log] > parsed audio,PTS:[0.033,1.984],DTS:[0.033/1.984],nb:42
hls.js (line 8363)
[log] > media buffered : [0.033333,1.983809]
hls.js (line 8363)
[log] > Loading 1 of [0 ,5],level 7, currentTime:1.9838394557823134,bufferEnd:1.984
hls.js (line 8363)
GET http://stream.flowplayer.org/night2/6/1080p/1.ts

200 OK
        11ms    
hls.js (line 8568)
[log] > Demuxing 1 of [0 ,5],level 7
hls.js (line 8363)
[log] > parsed video,PTS:[2.002,3.937],DTS:[1.969/3.937],nb:59
hls.js (line 8363)
[log] > parsed audio,PTS:[1.984,3.981],DTS:[1.984/3.981],nb:43
hls.js (line 8363)
[log] > media buffered : [0.033333,3.968711]
hls.js (line 8363)
[log] > Loading 0 of [0 ,5],level 7, currentTime:0,bufferEnd:0.000
hls.js (line 8363)
GET http://stream.flowplayer.org/night2/6/1080p/0.ts

200 OK
        13ms    
hls.js (line 8568)
GET http://stream.flowplayer.org/night2/6/1080p/0.ts

200 OK
        3ms 
hls.js (line 8568)
[log] > Demuxing 0 of [0 ,5],level 7
hls.js (line 8363)
[log] > parsed video,PTS:[0.033,2.002],DTS:[0.000/1.969],nb:59
hls.js (line 8363)
[log] > parsed audio,PTS:[0.033,1.984],DTS:[0.033/1.984],nb:42
hls.js (line 8363)
[log] > media buffered : [0.033333,3.968711]
hls.js (line 8363)
[log] > Loading 0 of [0 ,5],level 7, currentTime:0,bufferEnd:0.000
hls.js (line 8363)
[log] > Demuxing 0 of [0 ,5],level 7
hls.js (line 8363)
[log] > parsed video,PTS:[0.033,2.002],DTS:[0.000/1.969],nb:59
hls.js (line 8363)
[log] > parsed audio,PTS:[0.033,1.984],DTS:[0.033/1.984],nb:42
hls.js (line 8363)
[log] > media buffered : [0.033333,3.968711]
hls.js (line 8363)
[log] > Loading 0 of [0 ,5],level 7, currentTime:0,bufferEnd:0.000
hls.js (line 8363)
[error] > cannot recover fragLoopLoadingError error
hls.js (line 8363)
[warn] > mediaController: fragLoopLoadingError while loading frag,switch to ERROR state ...
hls.js (line 8363)
[log] > destroy
hls.js (line 8363)
[log] > detachMedia
hls.js (line 8363)
[warn] > mediaController: fragLoopLoadingError while loading frag,switch to ERROR state ...
hls.js (line 8363)

Hm, where's the baseline avc1 coming from here, what was parsed:

hls.js (line 8568)
[log] > Demuxing 4 of [0 ,4],level 7
hls.js (line 8363)
[log] > track:audio,container:audio/mp4,codecs[level/parsed]=[mp4a.40.5/mp4a.40.5]
hls.js (line 8363)
[log] > track:video,container:video/mp4,codecs[level/parsed]=[avc1.640029/avc1.42c01e]

@phloxic
Copy link
Contributor Author

phloxic commented May 6, 2016

Here's a demo without Flowplayer: http://flowplayer.blacktrash.org/fp6/hlsjs-pure.html - it sets hls.startLevel in MANIFEST_PARSED and hls.nextLevel = hls.startLevel in the first FRAG_LOADED event to make startLevel sticky (for use in quality selectors).

@phloxic
Copy link
Contributor Author

phloxic commented May 6, 2016

It's somewhat hard to repro because once the fragments are cached, it doesn't happen anymore. And purging cache reliably is such a pain. - But I can definitely repro after v0.5.25 (where this does not happen).

@mangui
Copy link
Member

mangui commented May 6, 2016

I was not able to reproduce it but I understand what is going on.
definitely related to dailymotion@ffb6ec6

since this commit,
with media buffered : [0.033333,3.968711] and currentTime : 0, bufferEnd is reported as 0 when media.readyState > 0(metadata available)

@mangui
Copy link
Member

mangui commented May 6, 2016

but dailymotion@ffb6ec6 is still useful for some scenarios ... we need to find a way to address both:

  • correctly merge interfragment holes on buffered areas
  • don't merge holes on never-buffered areas

@phloxic
Copy link
Contributor Author

phloxic commented May 6, 2016

I see. Strictly speaking a hole before a first fragment isn't an _inter_fragment hole ;-)
Is ffb6ec6 also for a hole before the first fragment? If not that's the one which could be excluded. Or maybe VOD streams could be excluded in this case.

@mangui
Copy link
Member

mangui commented May 6, 2016

Well in fact [0,0.033] should be treated as interfrag hole.... it was the case before this commit.

@mangui
Copy link
Member

mangui commented May 6, 2016

Basically the start offset of the playlist ( frag[0].start.... 0 for VoD) should be treated as special case.

mangui added a commit that referenced this issue May 9, 2016
…is located before buffered ranges, but within maxHoleDuration range"

This reverts commit ffb6ec6.
related to #420
@mangui
Copy link
Member

mangui commented May 9, 2016

FYI I just reverted dailymotion@ffb6ec6 as it is more critical to avoid fraglooploading and playback stall

@mangui mangui added Bug and removed Need info labels May 9, 2016
@phloxic
Copy link
Contributor Author

phloxic commented May 9, 2016

@mangui - thanks.

mangui added a commit that referenced this issue May 9, 2016
…is located before buffered ranges, but within maxHoleDuration range"

This reverts commit ffb6ec6.
related to #420
@mangui mangui closed this as completed May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants