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

Selecting initial audio track fails on some manifests #5430

Closed
5 tasks done
agajassi opened this issue Apr 28, 2023 · 2 comments
Closed
5 tasks done

Selecting initial audio track fails on some manifests #5430

agajassi opened this issue Apr 28, 2023 · 2 comments

Comments

@agajassi
Copy link
Contributor

What version of Hls.js are you using?

v1.4.0

What browser (including version) are you using?

Chrome

What OS (including version) are you using?

MacOS Big Sur

Test stream

No response

Configuration

{
  "debug": false,
  "autoStartLoad": false,
  "liveSyncDurationCount": 3,
  "maxBufferLength": 30,
  "backBufferLength": 60,
  "maxMaxBufferLength": 600,
  "manifestLoadingMaxRetry": 2,
  "manifestLoadingRetryDelay": 1000,
  "levelLoadingRetryDelay": 500,
  "fragLoadingRetryDelay": 500,
  "cmcd": {
    "enabled": true,
    "sessionId": "528239b8-4e4a-464c-98f8-76664ace8226",
    "contentId": null,
    "useHeaders": false
  },
  "capLevelToPlayerSize": true,
  "ignoreDevicePixelRatio": true,
  "manifestLoadPolicy": {
    "default": {
      "maxTimeToFirstByteMs": null,
      "maxLoadTimeMs": 20000,
      "timeoutRetry": {
        "maxNumRetry": 2,
        "retryDelayMs": 1000,
        "maxRetryDelayMs": 0
      },
      "errorRetry": {
        "maxNumRetry": 2,
        "retryDelayMs": 1000,
        "maxRetryDelayMs": 8000
      }
    }
  },
  "playlistLoadPolicy": {
    "default": {
      "maxTimeToFirstByteMs": 10000,
      "maxLoadTimeMs": 20000,
      "timeoutRetry": {
        "maxNumRetry": 2,
        "retryDelayMs": 500,
        "maxRetryDelayMs": 0
      },
      "errorRetry": {
        "maxNumRetry": 2,
        "retryDelayMs": 500,
        "maxRetryDelayMs": 8000
      }
    }
  },
  "fragLoadPolicy": {
    "default": {
      "maxTimeToFirstByteMs": 10000,
      "maxLoadTimeMs": 120000,
      "timeoutRetry": {
        "maxNumRetry": 4,
        "retryDelayMs": 500,
        "maxRetryDelayMs": 0
      },
      "errorRetry": {
        "maxNumRetry": 6,
        "retryDelayMs": 500,
        "maxRetryDelayMs": 8000
      }
    }
  }
}

Additional player setup steps

If STABLE-RENDITION-ID attribute of audio tracks is undefined then selectInitialTrack() fails to select a specified audio track. This appears to be a regression. Possibly a side effect of content steering feature work that went in to v1.4.0.

In version 1.3.5 this issue is not reproducible. Only in v1.4.0.

Maybe we can add a guard for undefined in the second if statement of findTrackId() function in the audio-track-controller?

Checklist

  • The issue observed is not already reported by searching on Github under https:/video-dev/hls.js/issues
  • The issue occurs in the stable client (latest release) on https://hlsjs.video-dev.org/demo and not just on my page
  • The issue occurs in the latest client (main branch) on https://hlsjs-dev.video-dev.org/demo and not just on my page
  • The stream has correct Access-Control-Allow-Origin headers (CORS)
  • There are no network errors such as 404s in the browser console when trying to play the stream

Steps to reproduce

  1. Setup HLSjs v1.4.0 player to play a manifest with multiple audio tracks without STABLE-RENDITION-ID attribute.
  2. At AUDIO_TRACKS_UPDATED event switch audio track to something other than default.
  3. Notice how audio track fails to switch

Expected behaviour

Audio track should switch to the specified track.

What actually happened?

Audio track does not switch.

Console output

reload.js:13 Reload Script Loaded
reload.js:31 Page Loaded - Calling webSocketWaiter
reload.js:93 Waiting for socket
logger.ts:74 [log] > Debug logs enabled for "Hls instance" in hls.js version 1.4.0
config.ts:604 [warn] > hls.js config: "manifestLoadingMaxRetry", "manifestLoadingRetryDelay" setting(s) are deprecated, use "manifestLoadPolicy": {"default":{"maxTimeToFirstByteMs":null,"maxLoadTimeMs":20000,"timeoutRetry":{"maxNumRetry":2,"retryDelayMs":1000,"maxRetryDelayMs":0},"errorRetry":{"maxNumRetry":2,"retryDelayMs":1000,"maxRetryDelayMs":8000}}}
(anonymous) @ config.ts:604
(anonymous) @ config.ts:572
t @ hls.ts:121
HlsjsAdapter @ HlsjsAdapter.ts:150
(anonymous) @ HlsjsAdapter.ts:718
fulfilled @ avia.hls.js:12
Promise.then (async)
step @ avia.hls.js:24
(anonymous) @ avia.hls.js:25
__async @ avia.hls.js:9
createHlsjsAdapter @ HlsjsAdapter.ts:47
(anonymous) @ AdapterProxy.ts:94
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
(anonymous) @ avia.js:91
__async @ avia.js:75
createAdapter @ AdapterProxy.ts:81
(anonymous) @ AbstractPresentationMediator.ts:438
(anonymous) @ avia.js:91
__async @ avia.js:75
createAdapter @ AbstractPresentationMediator.ts:436
(anonymous) @ AbstractPresentationMediator.ts:456
(anonymous) @ avia.js:91
__async @ avia.js:75
initializeAdapter @ AbstractPresentationMediator.ts:443
prepareForPlayback @ AbstractPresentationMediator.ts:428
onRegister @ ContentPresentationMediator.ts:83
registerMediator @ View.ts:137
registerMediator @ Facade.ts:150
(anonymous) @ PrepPlaybackCommand.ts:60
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
(anonymous) @ avia.js:91
__async @ avia.js:75
createPresentation @ PrepPlaybackCommand.ts:53
(anonymous) @ PrepPlaybackCommand.ts:49
Promise.then (async)
execute @ PrepPlaybackCommand.ts:47
executeCommand @ Controller.ts:79
notifyObserver @ Observer.ts:38
notifyObservers @ View.ts:93
notifyObservers @ Facade.ts:209
sendNotification @ Facade.ts:204
(anonymous) @ PrepResourceCommand.ts:45
Promise.then (async)
execute @ PrepResourceCommand.ts:23
executeCommand @ Controller.ts:79
notifyObserver @ Observer.ts:38
notifyObservers @ View.ts:93
notifyObservers @ Facade.ts:209
sendNotification @ Facade.ts:204
sendNotification @ AbstractApplication.ts:63
sendAsyncNotification @ VideoPlayer.ts:1068
(anonymous) @ VideoPlayer.ts:474
Promise.then (async)
attachResource @ VideoPlayer.ts:473
obj.<computed> @ ApiDecorators.ts:33
(anonymous) @ index.html:174
Promise.then (async)
next @ index.html:173
(anonymous) @ index.html:188
Promise.then (async)
(anonymous) @ index.html:187
config.ts:604 [warn] > hls.js config: "levelLoadingRetryDelay" setting(s) are deprecated, use "playlistLoadPolicy": {"default":{"maxTimeToFirstByteMs":10000,"maxLoadTimeMs":20000,"timeoutRetry":{"maxNumRetry":2,"retryDelayMs":500,"maxRetryDelayMs":0},"errorRetry":{"maxNumRetry":2,"retryDelayMs":500,"maxRetryDelayMs":8000}}}
(anonymous) @ config.ts:604
(anonymous) @ config.ts:572
t @ hls.ts:121
HlsjsAdapter @ HlsjsAdapter.ts:150
(anonymous) @ HlsjsAdapter.ts:718
fulfilled @ avia.hls.js:12
Promise.then (async)
step @ avia.hls.js:24
(anonymous) @ avia.hls.js:25
__async @ avia.hls.js:9
createHlsjsAdapter @ HlsjsAdapter.ts:47
(anonymous) @ AdapterProxy.ts:94
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
(anonymous) @ avia.js:91
__async @ avia.js:75
createAdapter @ AdapterProxy.ts:81
(anonymous) @ AbstractPresentationMediator.ts:438
(anonymous) @ avia.js:91
__async @ avia.js:75
createAdapter @ AbstractPresentationMediator.ts:436
(anonymous) @ AbstractPresentationMediator.ts:456
(anonymous) @ avia.js:91
__async @ avia.js:75
initializeAdapter @ AbstractPresentationMediator.ts:443
prepareForPlayback @ AbstractPresentationMediator.ts:428
onRegister @ ContentPresentationMediator.ts:83
registerMediator @ View.ts:137
registerMediator @ Facade.ts:150
(anonymous) @ PrepPlaybackCommand.ts:60
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
(anonymous) @ avia.js:91
__async @ avia.js:75
createPresentation @ PrepPlaybackCommand.ts:53
(anonymous) @ PrepPlaybackCommand.ts:49
Promise.then (async)
execute @ PrepPlaybackCommand.ts:47
executeCommand @ Controller.ts:79
notifyObserver @ Observer.ts:38
notifyObservers @ View.ts:93
notifyObservers @ Facade.ts:209
sendNotification @ Facade.ts:204
(anonymous) @ PrepResourceCommand.ts:45
Promise.then (async)
execute @ PrepResourceCommand.ts:23
executeCommand @ Controller.ts:79
notifyObserver @ Observer.ts:38
notifyObservers @ View.ts:93
notifyObservers @ Facade.ts:209
sendNotification @ Facade.ts:204
sendNotification @ AbstractApplication.ts:63
sendAsyncNotification @ VideoPlayer.ts:1068
(anonymous) @ VideoPlayer.ts:474
Promise.then (async)
attachResource @ VideoPlayer.ts:473
obj.<computed> @ ApiDecorators.ts:33
(anonymous) @ index.html:174
Promise.then (async)
next @ index.html:173
(anonymous) @ index.html:188
Promise.then (async)
(anonymous) @ index.html:187
config.ts:604 [warn] > hls.js config: "fragLoadingRetryDelay" setting(s) are deprecated, use "fragLoadPolicy": {"default":{"maxTimeToFirstByteMs":10000,"maxLoadTimeMs":120000,"timeoutRetry":{"maxNumRetry":4,"retryDelayMs":500,"maxRetryDelayMs":0},"errorRetry":{"maxNumRetry":6,"retryDelayMs":500,"maxRetryDelayMs":8000}}}
(anonymous) @ config.ts:604
(anonymous) @ config.ts:572
t @ hls.ts:121
HlsjsAdapter @ HlsjsAdapter.ts:150
(anonymous) @ HlsjsAdapter.ts:718
fulfilled @ avia.hls.js:12
Promise.then (async)
step @ avia.hls.js:24
(anonymous) @ avia.hls.js:25
__async @ avia.hls.js:9
createHlsjsAdapter @ HlsjsAdapter.ts:47
(anonymous) @ AdapterProxy.ts:94
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
(anonymous) @ avia.js:91
__async @ avia.js:75
createAdapter @ AdapterProxy.ts:81
(anonymous) @ AbstractPresentationMediator.ts:438
(anonymous) @ avia.js:91
__async @ avia.js:75
createAdapter @ AbstractPresentationMediator.ts:436
(anonymous) @ AbstractPresentationMediator.ts:456
(anonymous) @ avia.js:91
__async @ avia.js:75
initializeAdapter @ AbstractPresentationMediator.ts:443
prepareForPlayback @ AbstractPresentationMediator.ts:428
onRegister @ ContentPresentationMediator.ts:83
registerMediator @ View.ts:137
registerMediator @ Facade.ts:150
(anonymous) @ PrepPlaybackCommand.ts:60
fulfilled @ avia.js:78
Promise.then (async)
step @ avia.js:90
(anonymous) @ avia.js:91
__async @ avia.js:75
createPresentation @ PrepPlaybackCommand.ts:53
(anonymous) @ PrepPlaybackCommand.ts:49
Promise.then (async)
execute @ PrepPlaybackCommand.ts:47
executeCommand @ Controller.ts:79
notifyObserver @ Observer.ts:38
notifyObservers @ View.ts:93
notifyObservers @ Facade.ts:209
sendNotification @ Facade.ts:204
(anonymous) @ PrepResourceCommand.ts:45
Promise.then (async)
execute @ PrepResourceCommand.ts:23
executeCommand @ Controller.ts:79
notifyObserver @ Observer.ts:38
notifyObservers @ View.ts:93
notifyObservers @ Facade.ts:209
sendNotification @ Facade.ts:204
sendNotification @ AbstractApplication.ts:63
sendAsyncNotification @ VideoPlayer.ts:1068
(anonymous) @ VideoPlayer.ts:474
Promise.then (async)
attachResource @ VideoPlayer.ts:473
obj.<computed> @ ApiDecorators.ts:33
(anonymous) @ index.html:174
Promise.then (async)
next @ index.html:173
(anonymous) @ index.html:188
Promise.then (async)
(anonymous) @ index.html:187
hls.ts:351 [log] > attachMedia
buffer-controller.ts:794 [log] > [buffer-controller]: Media source opened
hls.ts:411 [log] > stopLoad
hls.ts:379 [log] > loadSource:https://entclips.cbsaavideo.com/2022/10/20/2087123011946/1716224_hls_ta/master.m3u8
stream-controller.ts:566 [log] > [stream-controller]: Trigger BUFFER_RESET
reload.js:54 Socket Opened
level-controller.ts:269 [log] > [level-controller]: manifest loaded, 6 level(s) found, first bitrate: 3078926
buffer-controller.ts:142 [log] > 2 bufferCodec event(s) expected
hls.ts:533 [log] > set firstLevel:2
hls.ts:625 [log] > set autoLevelCapping:2
hls.ts:401 [log] > startLoad(-1)
level-controller.ts:351 [log] > [level-controller]: Switching to level 2 from level -1
audio-track-controller.ts:138 [log] > [audio-track-controller]: Updating audio tracks, 6 track(s) found in group:audio_aac
audio-track-controller.ts:195 [log] > [audio-track-controller]: Switching to audio-track 2 "French" lang:fr group:audio_aac
base-stream-controller.ts:1578 [log] > [audio-stream-controller]: Reset loading state
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: STOPPED->IDLE
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: IDLE->WAITING_TRACK
audio-track-controller.ts:195 [log] > [audio-track-controller]: Switching to audio-track 0 "Italian" lang:it group:audio_aac
base-stream-controller.ts:1578 [log] > [audio-stream-controller]: Reset loading state
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: WAITING_TRACK->IDLE
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: IDLE->WAITING_TRACK
subtitle-track-controller.ts:217 [log] > [subtitle-track-controller]: Updating subtitle tracks, 4 track(s) found in "cbsi_webvtt" group-id
level-controller.ts:520 [log] > [level-controller]: Loading level index 2 with URI 1/1 https://entclips.cbsaavideo.com/2022/10/20/2087123011946/1716224_hls_ta/ImDyingUpHere_205R_SNI_HD_PROHQ_2398__1716224_1500/stream.m3u8
base-stream-controller.ts:1713 [log] > [stream-controller]: STOPPED->IDLE
audio-track-controller.ts:272 [log] > [audio-track-controller]: loading audio-track playlist 0 "Italian" lang:it group:audio_aac
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: WAITING_TRACK->STOPPED
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: STOPPED->WAITING_TRACK
base-stream-controller.ts:1713 [log] > [subtitle-stream-controller]: STOPPED->IDLE
audio-track-controller.ts:90 [log] > [audio-track-controller]: audio-track 0 "Italian" lang:it group:audio_aac loaded [0-592]
stream-controller.ts:631 [log] > [stream-controller]: Level 2 loaded [0,592], cc [0, 0] duration:3555.426999999975
buffer-controller.ts:686 [log] > [buffer-controller]: Updating Media Source duration to 3555.427
base-stream-controller.ts:714 [log] > [stream-controller]: Loading fragment 0 cc: 0 of [0-592] level: 2, target: 0
base-stream-controller.ts:1713 [log] > [stream-controller]: IDLE->FRAG_LOADING
audio-track-controller.ts:90 [log] > [audio-track-controller]: audio-track 0 "Italian" lang:it group:audio_aac loaded [0-592]
audio-stream-controller.ts:494 [log] > [audio-stream-controller]: Track 0 loaded [0,592],duration:3555.6289999999735
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: WAITING_TRACK->IDLE
base-stream-controller.ts:714 [log] > [audio-stream-controller]: Loading fragment 0 cc: 0 of [0-592] track: 0, target: 0
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: IDLE->FRAG_LOADING
transmuxer-interface.ts:85 [log] > injecting Web Worker for "audio"
audio-stream-controller.ts:605 [log] > [audio-stream-controller]: Unknown video PTS for cc 0, waiting for video PTS before demuxing audio frag 0 of [0 ,592],track 0
base-stream-controller.ts:1713 [log] > [audio-stream-controller]: FRAG_LOADING->WAITING_INIT_PTS
base-stream-controller.ts:385 [log] > [audio-stream-controller]: Loaded fragment 0 of level 0
25d0889f-e194-442b-a3a4-df0e611d88f6:1 [log] > Debug logs enabled for "audio" in hls.js version 1.4.0
transmuxer-interface.ts:85 [log] > injecting Web Worker for "main"
transmuxer-interface.ts:227 [log] > [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
base-stream-controller.ts:385 [log] > [stream-controller]: Loaded fragment 0 of level 2
b21d3b25-48dc-4a1a-b757-f358ba72a580:1 [log] > Debug logs enabled for "main" in hls.js version 1.4.0


### Chrome media internals output

_No response_
@agajassi agajassi added Bug Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Apr 28, 2023
@robwalch robwalch added this to the 1.4.1 milestone Apr 28, 2023
@robwalch
Copy link
Collaborator

robwalch commented Apr 28, 2023

Hi @agajassi and @dsparacio,

Thanks for the issue and bug report. Can you please share more details about the streams that reproduce this issue. I am not able to reproduce it using the Elephants Dream stream in the demo player.

I understand the problem, but this seems to only be an issue when changing variants (hls.levels), not setting audio track, where the new level uses a different audio group and the player is supposed to select a track in the new group with the same language.

@robwalch robwalch added Need sample stream cannot reproduce Confirmed and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. cannot reproduce Need sample stream labels Apr 28, 2023
@robwalch
Copy link
Collaborator

Was able to repro using "Group-id: subtitle and audio": https://mtoczko.github.io/hls-test-streams/test-group/playlist.m3u8.

@robwalch robwalch added the Verify Fixed An unreleased bug fix has been merged and should be verified before closing. label Apr 29, 2023
@robwalch robwalch closed this as completed May 5, 2023
@robwalch robwalch removed the Verify Fixed An unreleased bug fix has been merged and should be verified before closing. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants