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

Safari decode error on overlapping append (regression in startup) #6441

Open
5 tasks done
tvinko opened this issue May 24, 2024 · 10 comments
Open
5 tasks done

Safari decode error on overlapping append (regression in startup) #6441

tvinko opened this issue May 24, 2024 · 10 comments
Labels
Browser issue If there is an underlying issue with the browser that hls.js is running on, this tag should be used. browser: Safari Bug Confirmed

Comments

@tvinko
Copy link

tvinko commented May 24, 2024

What version of Hls.js are you using?

1.5.0

What browser (including version) are you using?

Safari 17.4.1

What OS (including version) are you using?

IOS

Test stream

https://js-tests.b-cdn.net/freezing.html

Configuration

{
debug: true,
abrEwmaDefaultEstimate: 5000000,
maxBufferLength: 120,
minBufferLength: 20,
autoStartLoad: true,}

Additional player setup steps

No response

Checklist

Steps to reproduce

Open video from provided url on iPhone device

Expected behaviour

Playing video

What actually happened?

Video freezes in the first second. It works fine till v1.5 or on native hls support.

I'm aware that there were some changes from v1.5+ with adding support for MMS that can affect this.

Console output

[Log] [log] >"Debug logs enabled for \"Hls instance\" in hls.js version 1.5.0" (hls.min.js, line 1)
[Log] [log] >"stopLoad" (hls.min.js, line 1)
[Log] [log] >"loadSource:https://vz-1cd8a68b-1aa.b-cdn.net/cb6f1dd3-85b5-4cf5-9570-6f35d9b1b244/playlist.m3u8" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Trigger BUFFER_RESET" (hls.min.js, line 1)
[Log] [log] >"attachMedia" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""created media source: ManagedMediaSource" (hls.min.js, line 1)
[Error] [error] >"Media element src was set while attaching MediaSource (blob:https://js-tests.b-cdn.net/754706aa-7f88-4274-9c16-d701ed34411d > undefined)"
	(anonymous function) (hls.min.js:1:251929)
[Log] [log] >"[level-controller]:""manifest loaded, 4 level(s) found, first bitrate: 1420335" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""1 bufferCodec event(s) expected" (hls.min.js, line 1)
[Log] [log] >"set currentLevel:2" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Switching to level 2 (480p SDR avc1,mp4a @2450614) from level -1" (hls.min.js, line 1)
[Log] [log] >"set currentLevel:-1" (hls.min.js, line 1)
[Log] [log] >"startLoad(-1)" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Loading level index 2 with https://vz-1cd8a68b-1aa.b-cdn.net/cb6f1dd3-85b5-4cf5-9570-6f35d9b1b244/480p/video.m3u8" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Switching to level 2 (480p SDR avc1,mp4a @2450614) from level 2" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Loading level index 2 with https://vz-1cd8a68b-1aa.b-cdn.net/cb6f1dd3-85b5-4cf5-9570-6f35d9b1b244/480p/video.m3u8" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""STOPPED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[subtitle-stream-controller]:""STOPPED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""Media source opened" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->STOPPED" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Switching to level 2 (480p SDR avc1,mp4a @2450614) from level 2" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Loading level index 2 with https://vz-1cd8a68b-1aa.b-cdn.net/cb6f1dd3-85b5-4cf5-9570-6f35d9b1b244/480p/video.m3u8" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""STOPPED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[subtitle-stream-controller]:""IDLE->STOPPED" (hls.min.js, line 1)
[Log] [log] >"[subtitle-stream-controller]:""STOPPED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Level 2 loaded [0,115][part-115--1], cc [0, 0] duration:462.833333" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""Updating Media Source duration to 462.833" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 0 cc: 0 of [0-115] level: 2, target: 0" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"injecting Web Worker for \"main\"" (hls.min.js, line 1)
[Log] [log] >"[transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 2 id: 1↵        discontinuity: true↵        trackSwitch…" (hls.min.js, line 1)
"[transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 2 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 0
        initSegmentChange: true"
[Log] [log] >"[stream-controller]:""Loaded fragment 0 of level 2" (hls.min.js, line 1)
[Log] [log] >"Debug logs enabled for \"main\" in hls.js version 1.5.0" (bd430b2b-5f77-4c1b-ada3-f058c4887d91, line 1)
[Log] [log] >"[mp4-remuxer]: ISGenerated flag reset" (hls.min.js, line 1)
[Log] [log] >"[mp4-remuxer]: initPTS & initDTS reset" (hls.min.js, line 1)
[Log] [log] >"[mp4-remuxer]: reset next timestamp" (hls.min.js, line 1)
[Log] [log] >"manifest codec:mp4a.40.2, ADTS type:2, samplingIndex:3" (hls.min.js, line 1)
[Log] [log] >"parsed codec:mp4a.40.5, rate:48000, channels:2" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Init audio buffer, container:audio/mp4, codecs[selected/level/parsed]=[mp4a.40.2/mp4a.40.2/mp4a.40.5]" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Init video buffer, container:video/mp4, codecs[level/parsed]=[avc1.4d401f/avc1.4d401f]" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""0 bufferCodec event(s) expected audio,video" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""creating sourceBuffer(audio/mp4;codecs=mp4a.40.2)" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""creating sourceBuffer(video/mp4;codecs=avc1.4d401f)" (hls.min.js, line 1)
[Log] [log] >"[audio-stream-controller]:""InitPTS for cc: 0 found from main: 132000" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 0 of level 2" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 0 of level 2 (frag:[0.000-4.000] > buffer:[0.000-3.947])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Info] [info] >"[abr] switch candidate:2->3 adjustedbw(36848000)-bitrate=32121481 ttfb:0.0 avgDuration:4.0 maxFetchDuration:3.9 fetchDuration:0.…" (hls.min.js, line 1)
"[abr] switch candidate:2->3 adjustedbw(36848000)-bitrate=32121481 ttfb:0.0 avgDuration:4.0 maxFetchDuration:3.9 fetchDuration:0.6 firstSelection:false codecSet:avc1,mp4a videoRange:SDR hls.loadLevel:2"
[Log] [log] >"[stream-controller]:""Adapting to level 3 from level 2" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Switching to level 3 (720p SDR avc1,mp4a @4726519) from level 2" (hls.min.js, line 1)
[Log] [log] >"[level-controller]:""Loading level index 3 with https://vz-1cd8a68b-1aa.b-cdn.net/cb6f1dd3-85b5-4cf5-9570-6f35d9b1b244/720p/video.m3u8" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->WAITING_LEVEL" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Level 3 loaded [0,115][part-115--1], cc [0, 0] duration:462.83042400000033" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""WAITING_LEVEL->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 0 cc: 0 of [0-115] level: 3, target: 3.947" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 3 id: 1↵        discontinuity: false↵      …" (hls.min.js, line 1)
"[transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 3 id: 1
        discontinuity: false
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 0
        initSegmentChange: false"
[Log] [log] >"[stream-controller]:""Loaded fragment 0 of level 3" (hls.min.js, line 1)
[Log] [log] >"[mp4-remuxer]: ISGenerated flag reset" (hls.min.js, line 1)
[Log] [log] >"[mp4-remuxer]: initPTS & initDTS reset" (hls.min.js, line 1)
[Log] [log] >"[mp4-remuxer]: reset next timestamp" (hls.min.js, line 1)
[Log] [log] >"manifest codec:mp4a.40.2, ADTS type:2, samplingIndex:3" (hls.min.js, line 1)
[Log] [log] >"parsed codec:mp4a.40.5, rate:48000, channels:2" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Init audio buffer, container:audio/mp4, codecs[selected/level/parsed]=[mp4a.40.2/mp4a.40.2/mp4a.40.5]" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Init video buffer, container:video/mp4, codecs[level/parsed]=[avc1.4d4020/avc1.4d4020]" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""changing audio sourceBuffer type to audio/mp4;codecs=mp4a.40.5" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""switching codec mp4a.40.2 to mp4a.40.5" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 0 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 0 of level 3 (frag:[0.000-4.004] > buffer:[0.000-3.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 1 cc: 0 of [0-115] level: 3, target: 3.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 1 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 1 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 1 of level 3 (frag:[3.989-8.008] > buffer:[0.000-7.979])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 2 cc: 0 of [0-115] level: 3, target: 7.979" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 2 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 2 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 2 of level 3 (frag:[7.979-12.012] > buffer:[0.000-11.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 3 cc: 0 of [0-115] level: 3, target: 11.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 3 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 3 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 3 of level 3 (frag:[11.989-16.016] > buffer:[0.000-16.000])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 4 cc: 0 of [0-115] level: 3, target: 16" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 4 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 4 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 4 of level 3 (frag:[16.000-20.003] > buffer:[0.000-19.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 5 cc: 0 of [0-115] level: 3, target: 19.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 5 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 5 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 5 of level 3 (frag:[19.989-24.007] > buffer:[0.000-23.979])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 6 cc: 0 of [0-115] level: 3, target: 23.979" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 6 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 6 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 6 of level 3 (frag:[23.979-28.011] > buffer:[0.000-27.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 7 cc: 0 of [0-115] level: 3, target: 27.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 7 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 7 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 7 of level 3 (frag:[27.989-32.015] > buffer:[0.000-32.000])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 8 cc: 0 of [0-115] level: 3, target: 32" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 8 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 8 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 8 of level 3 (frag:[32.000-36.003] > buffer:[0.000-35.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 9 cc: 0 of [0-115] level: 3, target: 35.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 9 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 9 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 9 of level 3 (frag:[35.989-40.007] > buffer:[0.000-39.979])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 10 cc: 0 of [0-115] level: 3, target: 39.979" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 10 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 10 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 10 of level 3 (frag:[39.979-44.011] > buffer:[0.000-43.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 11 cc: 0 of [0-115] level: 3, target: 43.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 11 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 11 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 11 of level 3 (frag:[43.989-48.015] > buffer:[0.000-48.000])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 12 cc: 0 of [0-115] level: 3, target: 48" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 12 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 12 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 12 of level 3 (frag:[48.000-52.002] > buffer:[0.000-51.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 13 cc: 0 of [0-115] level: 3, target: 51.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 13 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 13 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 13 of level 3 (frag:[51.989-56.006] > buffer:[0.000-55.979])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 14 cc: 0 of [0-115] level: 3, target: 55.979" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loaded fragment 14 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->PARSING" (hls.min.js, line 1)
[Log] [log] >"[transmuxer.ts]: Flushed fragment 14 of level 3" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSING->PARSED" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Buffered main sn: 14 of level 3 (frag:[55.979-60.010] > buffer:[0.000-59.989])" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""PARSED->IDLE" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""Loading fragment 15 cc: 0 of [0-115] level: 3, target: 59.989" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""IDLE->FRAG_LOADING" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""Media source ended" (hls.min.js, line 1)
[Log] [log] >"[buffer-controller]""Media source closed" (hls.min.js, line 1)
[Log] [log] >"[stream-controller]:""FRAG_LOADING->STOPPED" (hls.min.js, line 1)
[Log] [log] >"[subtitle-stream-controller]:""IDLE->STOPPED" (hls.min.js, line 1)

Chrome media internals output

No response

@tvinko tvinko added Bug Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels May 24, 2024
@robwalch robwalch added browser: Safari Confirmed and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels May 24, 2024
@robwalch
Copy link
Collaborator

robwalch commented May 24, 2024

I can reproduce the issue on desktop Safari 17.5 on macos Sonoma. I only see it when switching up on start (from any of levels 0-2 to 3) and then playing past the one second mark. The playback error is logged by the browser:

The video playback was aborted due to a corruption problem or because the video used features your browser did not support - Media failed to decode

There is no issue playing each media playlist individually so this looks like a problem with what I noticed are overlapping appends on start. You can workaround it by setting "startLevel": 3. I can't reproduce decode errors after starting on this variant. I suggest filing a bug against Safari with Feedback Assistant.

It works fine till v1.5 or on native hls support.
I'm aware that there were some changes from v1.5+ with adding support for MMS that can affect this.

The decode error is not there in v1.4.13 with desktop Safari, but I notice there is no overlapping append of the first segment(s) of each loaded variant. Disabling MMS with preferManagedMediaSource: false, does not resolve the issue either, so I think we can say it's not related to MMS. It's more likely related to a change in fragment selection resulting in the overlapping append, which I would not expect to cause a decode error - that looks like a Safari MSE bug IMO.

@robwalch robwalch added the Browser issue If there is an underlying issue with the browser that hls.js is running on, this tag should be used. label May 24, 2024
@tvinko
Copy link
Author

tvinko commented May 27, 2024

Hey @robwalch , thanks for those insights.

I'm having similar issues with Airplay that is not casted from iphone to macos -> works prior the v1.5.0 and on native hls ios implementation (testing from hls demo and with no warnings or errors in console)

I'm waiting for customer permissions to publish the video, and I'll create a new issue for inspection.

@robwalch
Copy link
Collaborator

robwalch commented May 27, 2024

I'm having similar issues with Airplay

Does this help?

https://webkit.org/blog/15036/how-to-use-media-source-extensions-with-airplay/

If so please file another issue. I'd like to keep this issue scoped to the decoding error in Safari with overlapping appends.

@robwalch
Copy link
Collaborator

The reason for the overlapping appends on switch is the difference in durations. The first segment in the lowest variant lists a duration of "4.000000" while the first segment of the highest lists "4.004011". maxFragLookUpTolerance used to look over this kind of discrepancy but that is no longer the case.

@tvinko
Copy link
Author

tvinko commented May 28, 2024

The reason for the overlapping appends on switch is the difference in durations. The first segment in the lowest variant lists a duration of "4.000000" while the first segment of the highest lists "4.004011". maxFragLookUpTolerance used to look over this kind of discrepancy but that is no longer the case.

Thanks for noticing that, indeed. Although FFProbe shows 4, the playlist reports different. Is there any equivalent to maxFragLookUpTolerance?

@robwalch
Copy link
Collaborator

robwalch commented May 28, 2024

Thanks for noticing that, indeed. Although FFProbe shows 4, the playlist reports different. Is there any equivalent to maxFragLookUpTolerance?

Not for this scenario. We would either need to add a new tolerance for picking the next fragment on switch - it should very small by default (1/200s or %1 of fragment duration) and could be configurable. Or, we could look into inserting a flush operation or seek to flush the decoder for overlapping appends. I don't think the latter is appropriate for a patch. New config options usually wouldn't be included in a patch either, but would be OK as a configurable enhancement where the default matches current behavior (default of 0). Any preference on your end?

@robwalch robwalch changed the title Attaching MediaSource issue Safari decode error on overlapping append May 31, 2024
@robwalch robwalch added this to the 1.5.10 milestone May 31, 2024
robwalch added a commit that referenced this issue May 31, 2024
…ist within 1/200s tolerance

Fixes edge-case starting in v1.5 that causes #6441
robwalch added a commit that referenced this issue May 31, 2024
…ist within 1/200s tolerance

Fixes edge-case starting in v1.5 that causes #6441
@robwalch robwalch changed the title Safari decode error on overlapping append Safari decode error on overlapping append (regression in startup) May 31, 2024
@robwalch
Copy link
Collaborator

robwalch commented May 31, 2024

I'm going to push a patch with #6471 that should address your start up issue and prevent overlapping appends for the first VOD segments which do not overlap (with a small allowance of 1/200s or less masked by maxFragLookupTolerance).

robwalch added a commit that referenced this issue Jun 1, 2024
…ist within 1/200s tolerance (#6471)

Fixes edge-case starting in v1.5 that causes #6441
@tvinko
Copy link
Author

tvinko commented Jun 2, 2024

Hey @robwalch sorry for the late response.

Many thanks for your fast response and the patch!

@robwalch
Copy link
Collaborator

robwalch commented Jun 3, 2024

Hi @tvinko,

Let me know if v1.5.10 resolves the issue for you. If you are still experiencing the decode error at or even after startup let me know.

@robwalch robwalch removed this from the 1.5.10 milestone Jun 3, 2024
@tvinko
Copy link
Author

tvinko commented Jun 5, 2024

Hey @robwalch fixed!

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser issue If there is an underlying issue with the browser that hls.js is running on, this tag should be used. browser: Safari Bug Confirmed
Projects
None yet
Development

No branches or pull requests

2 participants