Skip to content

Commit

Permalink
Restart ScheduleController after buffer pruning only if due to QuotaE…
Browse files Browse the repository at this point in the history
…xceededError (#3205)
  • Loading branch information
bbert authored Mar 26, 2020
1 parent d17a44c commit 63c99e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function BufferController(config) {
appendedBytesInfo,
wallclockTicked,
isPruningInProgress,
isQuotaExceeded,
initCache,
seekStartTime,
seekClearedBufferingCompleted,
Expand Down Expand Up @@ -262,6 +263,7 @@ function BufferController(config) {
function onAppended(e) {
if (e.error) {
if (e.error.code === QUOTA_EXCEEDED_ERROR_CODE) {
isQuotaExceeded = true;
criticalBufferLevel = getTotalBufferedTime() * 0.8;
logger.warn('Quota exceeded, Critical Buffer: ' + criticalBufferLevel);

Expand All @@ -281,6 +283,7 @@ function BufferController(config) {
}
return;
}
isQuotaExceeded = false;

appendedBytesInfo = e.chunk;
if (appendedBytesInfo && !isNaN(appendedBytesInfo.index)) {
Expand Down Expand Up @@ -745,7 +748,7 @@ function BufferController(config) {
appendToBuffer(mediaChunk);
}
}
eventBus.trigger(Events.BUFFER_CLEARED, { sender: instance, from: e.from, to: e.to, unintended: e.unintended, hasEnoughSpaceToAppend: hasEnoughSpaceToAppend() });
eventBus.trigger(Events.BUFFER_CLEARED, { sender: instance, from: e.from, to: e.to, unintended: e.unintended, hasEnoughSpaceToAppend: hasEnoughSpaceToAppend(), quotaExceeded: isQuotaExceeded });
}
//TODO - REMEMBER removed a timerout hack calling clearBuffer after manifestInfo.minBufferTime * 1000 if !hasEnoughSpaceToAppend() Aug 04 2016
}
Expand Down Expand Up @@ -870,6 +873,7 @@ function BufferController(config) {
appendedBytesInfo = null;
isBufferingCompleted = false;
isPruningInProgress = false;
isQuotaExceeded = false;
seekClearedBufferingCompleted = false;
bufferLevel = 0;
wallclockTicked = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ function ScheduleController(config) {
}
}

if (e.hasEnoughSpaceToAppend && isStopped) {
if (e.hasEnoughSpaceToAppend && e.quotaExceeded && isStopped) {
start();
}
}
Expand Down

0 comments on commit 63c99e2

Please sign in to comment.