Skip to content

Commit

Permalink
buffer-controller CR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenMe committed Oct 6, 2019
1 parent 18955e2 commit af51c03
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/controller/buffer-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class BufferController extends EventHandler {
// signals that mediaSource should have endOfStream called
private _needsEos: boolean = false;

// Track whether the parsed manifest signaled alternate audio
private _altAudio: boolean = false;

private config: BufferControllerConfig;

// this is optional because this property is removed from the class sometimes
Expand All @@ -58,6 +55,9 @@ class BufferController extends EventHandler {
// The number of BUFFER_CODEC events received before any sourceBuffers are created
public bufferCodecEventsExpected: number = 0;

// The total number of BUFFER_CODEC events received
private _bufferCodecEventsTotal: number = 0;

// A reference to the attached media element
public media: HTMLMediaElement | null = null;

Expand Down Expand Up @@ -146,8 +146,7 @@ class BufferController extends EventHandler {
// sourcebuffers will be created all at once when the expected nb of tracks will be reached
// in case alt audio is not used, only one BUFFER_CODEC event will be fired from main stream controller
// it will contain the expected nb of source buffers, no need to compute it
this._altAudio = data.altAudio;
this.bufferCodecEventsExpected = data.altAudio ? 2 : 1;
this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = data.altAudio ? 2 : 1;
logger.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`);
}

Expand Down Expand Up @@ -206,7 +205,7 @@ class BufferController extends EventHandler {
this.mediaSource = null;
this.media = null;
this._objectUrl = null;
this.bufferCodecEventsExpected = this._altAudio ? 2 : 1;
this.bufferCodecEventsExpected = this._bufferCodecEventsTotal;
this.pendingTracks = {};
this.tracks = {};
this.sourceBuffer = {};
Expand Down

0 comments on commit af51c03

Please sign in to comment.