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

Live Stream Network Error Recovery leads to a seek to middle of the stream #1352

Closed
4 tasks done
jgainfort opened this issue Sep 18, 2017 · 3 comments
Closed
4 tasks done

Comments

@jgainfort
Copy link
Contributor

Environment
  • Link to playable M3U8 file: Can provide via pm
  • Hls.js version: 0.8.2
  • Browser name/version: Chrome/63.0.3217.0
  • OS name/version: macOS 10.12.6
Steps to reproduce

Open hls.js demo page and provide a live source
Let play for 10-30 minutes
Noticed some bufferStalls / recovers, nothing out of the ordinary
highBuffer stall / fatal error

Then on recover these errors popped up

Uncaught DOMException: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source.
at checkBuffer (http://streambox.fr/mse/hls.js-0.8.2/demo/?src=http%3A%2F%2Fsprtott25-i.akamaihd.net%2Fhls%2Flive%2F250903%2FBill-Test0918084455-ua%2Fmaster.m3u8&enableStreaming=true&autoRecoverError=true&enableWorker=true&dumpfMP4=false&levelCapping=-1&defaultAudioCodec=undefined:848:79)

Playback recovered but instead of playing at live point seeked back

[log] > Loading 345 of [0 ,689],level 6, currentTime:3637.302,bufferEnd:3637.302
logger.js:37 [log] > Loading 346 of [0 ,689],level 6, currentTime:2073.171,bufferEnd:2073.171

Expected behavior

Continue playback near live point

Actual behavior

Seeks to half way point in DVR and continue playback

Console output
[logs.zip](https://github.com/video-dev/hls.js/files/1311531/logs.zip)
Logs were long so zipped them up. 
For media errors reported on Chrome browser, please also paste the output of chrome://media-internals 

Property | Value
-- | --
00:00:00 00 | origin_url | http://streambox.fr/
00:00:00 00 | frame_url | http://streambox.fr/mse/hls.js-0.8.2/demo/?src=http%3A%2F%2Fsprtott25-i.akamaihd.net%2Fhls%2Flive%2F250903%2FBill-Test0918084455-ua%2Fmaster.m3u8&enableStreaming=true&autoRecoverError=true&enableWorker=true&dumpfMP4=false&levelCapping=-1&defaultAudioCodec=undefined
00:00:00 00 | frame_title | hls.js demo
00:00:00 00 | url | blob:http://streambox.fr/2d9dd359-fffd-4730-adf5-0d60c2a305a4
00:00:00 00 | pipeline_state | kStarting
00:00:00 993 | found_audio_stream | true
00:00:00 993 | audio_codec_name | aac
00:00:00 994 | found_video_stream | true
00:00:00 994 | video_codec_name | h264
00:00:00 998 | audio_dds | false
00:00:00 998 | audio_decoder | FFmpegAudioDecoder
00:00:00 999 | video_dds | false
00:00:00 999 | video_decoder | GpuVideoDecoder
00:00:00 999 | pipeline_state | kPlaying
00:00:00 993 | duration | 4122.285986
00:00:01 56 | seek_target | 2067.207935
00:00:01 56 | pipeline_state | kSeeking
00:00:01 56 | pipeline_state | kPlaying
00:00:01 58 | audio_buffering_state | BUFFERING_HAVE_ENOUGH
00:00:01 81 | height | 1080
00:00:01 81 | width | 1920
00:00:01 86 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:00:01 86 | pipeline_buffering_state | BUFFERING_HAVE_ENOUGH
00:00:01 86 | event | PLAY
00:00:01 04 | duration | 4122.285999
00:00:06 101 | duration | 4128.325366
00:00:12 76 | duration | 4134.331366
00:00:18 57 | duration | 4140.838366
00:00:24 109 | duration | 4146.844366
00:00:30 15 | duration | 4152.850366
00:00:36 30 | duration | 4158.856366
00:00:41 941 | duration | 4164.862366
00:00:47 919 | duration | 4170.868366
00:00:53 988 | duration | 4176.874366
00:00:59 862 | duration | 4182.880366
00:01:05 883 | duration | 4188.886366
00:01:11 887 | duration | 4194.892366
00:01:17 790 | duration | 4200.898366
00:01:23 762 | duration | 4206.904366
00:01:30 106 | duration | 4212.910366
00:01:35 860 | duration | 4218.916366
00:01:36 598 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:01:36 599 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:01:41 935 | duration | 4224.922366
00:01:53 579 | info | Selected video track: []
00:01:53 579 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:01:53 580 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:02:27 763 | duration | 4259.424366
00:02:58 186 | info | Selected video track: [12]
00:02:58 186 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:02:58 278 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:02:58 885 | duration | 4301.466366
00:03:12 134 | info | Selected video track: []
00:03:12 134 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:03:12 135 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:03:19 270 | info | Selected video track: [12]
00:03:19 270 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:03:19 404 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:03:19 293 | duration | 4319.484366
00:03:22 901 | duration | 4325.490366
00:03:28 881 | duration | 4331.496366
00:03:39 197 | info | Selected video track: []
00:03:39 197 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:03:39 198 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:03:56 99 | info | Selected video track: [12]
00:03:56 99 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:03:56 167 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:03:56 116 | duration | 4355.520366
00:04:07 653 | info | Selected video track: []
00:04:07 653 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:04:07 654 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:04:40 771 | duration | 4397.562366
00:04:41 181 | duration | 4403.568366
00:04:59 111 | audio_buffering_state | BUFFERING_HAVE_NOTHING
00:04:59 111 | pipeline_buffering_state | BUFFERING_HAVE_NOTHING
00:05:02 417 | info | Selected video track: [12]
00:05:02 423 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:05:02 440 | duration | 4421.586366
00:05:03 464 | audio_buffering_state | BUFFERING_HAVE_ENOUGH
00:05:03 513 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:05:03 515 | pipeline_buffering_state | BUFFERING_HAVE_ENOUGH
00:05:04 865 | duration | 4427.592366
00:05:10 846 | duration | 4433.598366
00:05:16 851 | duration | 4439.604366
00:05:22 854 | duration | 4445.610366
00:05:28 897 | duration | 4451.616366
00:05:34 773 | duration | 4457.622366
00:05:40 712 | duration | 4463.628366
00:05:46 689 | duration | 4469.634366
00:05:52 671 | duration | 4475.640366
00:06:01 519 | duration | 4481.646366
00:06:07 714 | duration | 4487.652366
00:06:13 606 | duration | 4493.658366
00:06:19 706 | duration | 4499.664366
00:06:25 658 | duration | 4505.670366
00:06:31 496 | duration | 4511.676366
00:06:37 475 | duration | 4517.682366
00:06:43 455 | duration | 4523.688366
00:06:49 615 | duration | 4529.694366
00:06:55 399 | duration | 4535.700366
00:07:01 381 | duration | 4541.706366
00:07:07 348 | duration | 4547.712366
00:07:13 313 | duration | 4553.718366
00:07:19 202 | duration | 4559.724366
00:07:25 234 | duration | 4565.730366
00:07:31 158 | duration | 4571.736366
00:07:37 134 | duration | 4577.742366
00:07:43 206 | duration | 4583.748366
00:07:49 81 | duration | 4589.754366
00:07:55 58 | duration | 4595.760366
00:07:59 539 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:07:59 539 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:08:01 34 | duration | 4601.766366
00:08:07 10 | duration | 4607.772366
00:08:12 987 | duration | 4613.778366
00:08:18 957 | duration | 4619.784366
00:08:24 933 | duration | 4625.790366
00:08:30 906 | duration | 4631.796366
00:08:35 43 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:08:35 44 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:08:36 947 | duration | 4637.802366
00:08:42 856 | duration | 4643.808366
00:08:48 832 | duration | 4649.814366
00:08:50 674 | info | Selected video track: []
00:08:50 674 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:08:50 675 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:08:55 27 | duration | 4655.820366
00:09:00 784 | duration | 4661.826366
00:09:09 843 | duration | 4667.832366
00:09:15 734 | duration | 4673.838366
00:09:21 711 | duration | 4679.844366
00:09:27 691 | duration | 4685.850366
00:09:33 668 | duration | 4691.856366
00:09:37 888 | info | Selected video track: [12]
00:09:37 888 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:09:37 992 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:09:39 647 | duration | 4697.862366
00:09:45 621 | duration | 4703.868366
00:09:49 589 | info | Selected video track: []
00:09:49 589 | video_buffering_state | BUFFERING_HAVE_NOTHING
00:09:49 590 | video_buffering_state | BUFFERING_HAVE_ENOUGH
00:09:51 598 | duration | 4709.874366
00:09:57 607 | duration | 4715.880366
00:10:03 552 | duration | 4721.886366
@mangui
Copy link
Member

mangui commented Sep 20, 2017

this happens because of https://github.com/video-dev/hls.js/blob/master/src/controller/stream-controller.js#L1432-L1440

middle fragment is loaded after error recovery.
as target start position (last currentTime) is not buffered, hls.js is wrongly seeking to first buffered range, which is in the middle of the stream.

the seek on first buffered logic has been introduced for
#238

this logic was meant to cope with small PTS delta. we might avoid that seeking if delta between target start position and buffered(0).start is large enough

mangui added a commit that referenced this issue Sep 20, 2017
… start position on loadedmetadata

related to 2069b72

related to #1352
@mangui
Copy link
Member

mangui commented Sep 20, 2017

actually the logic was almost there but buggy ;-)
should be fixed now

@jgainfort
Copy link
Contributor Author

@mangui Awesome! Glad that it was easy to solve.

@mangui mangui changed the title Live Stream Error Recovery Live Stream Network Error Recovery leads to a seek to middle of the stream Sep 25, 2017
@mangui mangui mentioned this issue Dec 21, 2017
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants