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

Improve audio switch #2437

Conversation

nicosang
Copy link
Contributor

Hi,

this PR has to improve fast audio switch. The main idea is that when an audio switch occurs, the stream has not to stop playing. In order to achieve this goal, those steps are executed :

  • push the new initialize segment
  • request media segment at the current playing time of stream
  • when this new media segment has been downloaded, fully clean audio buffer and push this new media segment

A test can be done with the stream : http://dash.akamaized.net/dash264/TestCases/10a/1/iis_forest_short_poem_multi_lang_480p_single_adapt_aaclc_sidx.mpd

Nico

@dsander
Copy link

dsander commented Feb 26, 2018

Not sure if it is intentional or unintentional but this PR fixes audio stream switching for us, the original issue was #2239 which was close via #2411, but it still did not work in development.

Now switching both then paused and playing back the video works without issues.

Log from development:

$ player.setCurrentTrack(player.getTracksFor('audio')[4])
[3975] Clearing buffer because track changed - 17.54 
[3975] Removing audio buffer from: 0 to 17.54 
[3975] Stream -  Process track changed at current time 7.81 
[3976] Stream -  Update stream controller 
[3977] Perform SIDX load: http://sbdev:3000/proxies/media_1/multiple/FLAVOURSYS-AUDIOCHECK.mxf/media-audio-aia-mp4a.mp4 

[3978] Removed audio buffer from: 0 to 17.54 
[3978] AbrController (audio) switching from buffer occupancy to throughput ABR rule (buffer: 0.000). 
[3979] Buffer is empty! Stalling! 
[3980] Waiting for more buffer before starting playback for audio 
[3980] Schedule controller starting for audio 
[3980] Native video element event: ratechange:  0 
[3981] ScheduleController - audio - switch track has been asked, get init request for audio with representationid = audio-en-mp4a 
[3981] Append Init fragment audio  with representationId: audio-en-mp4a  and quality: 0 
[3982] Parsing segments from SIDX. 
[3984] AbrController (audio) stay on 0/0 (buffer: 0) 
[3984] Getting the request for audio time : 7.81 
[3984] SegmentBase: 0 / 17.04 
[3984] ScheduleController - audio - getNextFragment - request is http://sbdev:3000/proxies/media_1/multiple/FLAVOURSYS-AUDIOCHECK.mxf/media-audio-aia-mp4a.mp4 
[4015] [ScheduleController] onFragmentLoadingCompleted for audio 
[4018] Video Element Error: MEDIA_ERR_DECODE (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Append: stream parsing failed. Data size=131072 append_window_start=0 append_window_end=inf) 

@epiclabsDASH epiclabsDASH added this to the v2.6.7 milestone Feb 26, 2018
@epiclabsDASH epiclabsDASH merged commit 19f7c0d into Dash-Industry-Forum:development Feb 26, 2018
@nicosang nicosang deleted the ImproveAudioSwitch branch February 26, 2018 15:44
@nweber
Copy link
Contributor

nweber commented Feb 26, 2018

I've been doing some testing with this using multiple video tracks.. In my testing, when using dash.setTrackSwitchModeFor('video', TRACK_SWITCH_MODE_ALWAYS_REPLACE); I'm seeing some odd behavior when switching tracks. The video continues to play for ~1 second, then playback stalls, and then after ~2 seconds playback resumes.

Additionally, if I immediately seek backwards after a track switch completes I still see the old track data.

I'm trying to get a test stream to demonstrate the problem.

I didn't see any mention of the track switch mode in your PR, so I'm not sure if that's related. I'm not exactly sure which use case your PR is fixing, so perhaps I'm misunderstanding the goal of this PR. When I go to the reference player (which does include this PR now, it looks like), and test with my own test stream, switching audio tracks still completely stops the player.

@nicosang
Copy link
Contributor Author

Hi @nweber ,

this PR was focused on audio track switch when the option is TRACK_SWITCH_MODE_ALWAYS_REPLACE. Your issue is for both, audio and video tracks switch, isn't it?
Could you, please, provide us a stream that we can use to reproduce your issue?

Nico

@nweber
Copy link
Contributor

nweber commented Mar 1, 2018

@nicosang Here you go!

Stream: https://s3.amazonaws.com/ssi-us-east-1-elemental-hls/bbb/streams/bbb.mpd

http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html?url=https://s3.amazonaws.com/ssi-us-east-1-elemental-hls/bbb/streams/bbb.mpd

If you change the video switch mode to "always replace" you should see playback stall when switching video tracks. Switching audio tracks is working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants