Skip to content

Commit

Permalink
audio-stream-controller: fix frag loading stuck in case of quick audi…
Browse files Browse the repository at this point in the history
…o switch

use case
switching to audio track 0
frag 0 track 0 buffered
frag 1 track 0 buffered
frag 2 track 0 buffered
switching to audio track 1
(track 0 frags are not evicted until first frag of track 1 is parsed)
switching to audio track 0
-> frag 0 track 0 already marked as buffered and audio-stream-controller keeps selecting it.

related to video-dev#1669
  • Loading branch information
mangui committed Apr 17, 2018
1 parent dcc265c commit f920be5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/controller/audio-stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ class AudioStreamController extends TaskLoop {
hls.trigger(Event.KEY_LOADING, { frag: frag });
} else {
logger.log(`Loading ${frag.sn}, cc: ${frag.cc} of [${trackDetails.startSN} ,${trackDetails.endSN}],track ${trackId}, currentTime:${pos},bufferEnd:${bufferEnd.toFixed(3)}`);
// Check if fragment is not loaded
if (this.fragmentTracker.getState(frag) === FragmentState.NOT_LOADED) {
// only load if fragment is not loaded or if in audio switch
// we force a frag loading in audio switch as fragment tracker might not have evicted previous frags in case of quick audio switch
if (audioSwitch || this.fragmentTracker.getState(frag) === FragmentState.NOT_LOADED) {
this.fragCurrent = frag;
this.startFragRequested = true;
if (!isNaN(frag.sn))
Expand Down

0 comments on commit f920be5

Please sign in to comment.