Skip to content

Commit

Permalink
Account for situations in which the buffer target is smaller than the…
Browse files Browse the repository at this point in the history
… segment duration (#4595)
  • Loading branch information
dsilhavy authored Oct 14, 2024
1 parent 4fa235b commit a6679ea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,15 @@ function ScheduleController(config) {
if (!type || !currentRepresentation) {
return true;
}
const segmentDuration = currentRepresentation && currentRepresentation.segmentDuration && !isNaN(currentRepresentation.segmentDuration) ? currentRepresentation.segmentDuration : 0;
let segmentDurationToAddToBufferLevel = currentRepresentation && currentRepresentation.segmentDuration && !isNaN(currentRepresentation.segmentDuration) ? currentRepresentation.segmentDuration : 0;
const bufferLevel = dashMetrics.getCurrentBufferLevel(type);
const bufferTarget = getBufferTarget();

return bufferLevel + segmentDuration < getBufferTarget();
if (bufferTarget <= segmentDurationToAddToBufferLevel) {
segmentDurationToAddToBufferLevel = 0;
}

return bufferLevel + segmentDurationToAddToBufferLevel < bufferTarget;
}

/**
Expand Down

0 comments on commit a6679ea

Please sign in to comment.