Skip to content

Commit

Permalink
Merge pull request #2646 from aescarcha/fixAppendBuffer
Browse files Browse the repository at this point in the history
Removed the buffer append queue control from BufferController
  • Loading branch information
epiclabsDASH committed Jun 18, 2018
2 parents ab7f586 + c40b478 commit 8afd0aa
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/streaming/controllers/BufferController.js
Expand Up @@ -83,21 +83,18 @@ function BufferController(config) {
bufferState,
appendedBytesInfo,
wallclockTicked,
isAppendingInProgress,
isPruningInProgress,
initCache,
seekStartTime,
seekClearedBufferingCompleted,
pendingPruningRanges,
chunksToAppend,
bufferResetInProgress,
mediaChunk;


function setup() {
logger = Debug(context).getInstance().getLogger(instance);
initCache = InitCache(context).getInstance();
chunksToAppend = [];

resetInitialSettings();
}
Expand Down Expand Up @@ -239,17 +236,11 @@ function BufferController(config) {
}
}

function appendToBuffer(chunk, forceAppend) {
if (!isAppendingInProgress || forceAppend) {
isAppendingInProgress = true;
appendedBytesInfo = chunk;
buffer.append(chunk);
function appendToBuffer(chunk) {
buffer.append(chunk);

if (chunk.mediaInfo.type === Constants.VIDEO) {
eventBus.trigger(Events.VIDEO_CHUNK_RECEIVED, { chunk: chunk });
}
} else {
chunksToAppend.push(chunk);
if (chunk.mediaInfo.type === Constants.VIDEO) {
eventBus.trigger(Events.VIDEO_CHUNK_RECEIVED, { chunk: chunk });
}
}

Expand Down Expand Up @@ -314,13 +305,6 @@ function BufferController(config) {
} else if (appendedBytesInfo) {
eventBus.trigger(Events.BYTES_APPENDED_END_FRAGMENT, dataEvent);
}

if (chunksToAppend.length === 0) {
isAppendingInProgress = false;
} else {
const chunk = chunksToAppend.shift();
appendToBuffer(chunk, true);
}
}

function onQualityChanged(e) {
Expand All @@ -340,8 +324,6 @@ function BufferController(config) {
//a seek command has occured, reset lastIndex value, it will be set next time that onStreamCompleted will be called.
lastIndex = Number.POSITIVE_INFINITY;
}
chunksToAppend = [];
isAppendingInProgress = false;
if (type !== Constants.FRAGMENTED_TEXT) {
// remove buffer after seeking operations
pruneAllSafely();
Expand Down Expand Up @@ -862,7 +844,6 @@ function BufferController(config) {
maxAppendedIndex = 0;
appendedBytesInfo = null;
isBufferingCompleted = false;
isAppendingInProgress = false;
isPruningInProgress = false;
seekClearedBufferingCompleted = false;
bufferLevel = 0;
Expand Down

0 comments on commit 8afd0aa

Please sign in to comment.