Skip to content

Commit

Permalink
Removed duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmccartney committed Feb 11, 2025
1 parent 7558960 commit 3f37b30
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,26 +894,13 @@ function BufferController(config) {
return;
}

//If the player is in low latency mode, use the lowLatencyStallThreshold
if (playbackController.getLowLatencyModeEnabled()) {
if ((bufferLevel <= settings.get().streaming.buffer.lowLatencyStallThreshold) && !isBufferingCompleted) {
_notifyBufferStateChanged(MetricsConstants.BUFFER_EMPTY);
} else {
if (isBufferingCompleted || bufferLevel > settings.get().streaming.buffer.lowLatencyStallThreshold) {
_notifyBufferStateChanged(MetricsConstants.BUFFER_LOADED);
}
}
//Set stall threshold based on player mode
const stallThreshold = playbackController.getLowLatencyModeEnabled() ? settings.get().streaming.buffer.lowLatencyStallThreshold : settings.get().streaming.buffer.stallThreshold;

}
//If the player is not im low latency mode, use the stallThreshold
else {
if ((bufferLevel <= settings.get().streaming.buffer.stallThreshold) && !isBufferingCompleted) {
_notifyBufferStateChanged(MetricsConstants.BUFFER_EMPTY);
} else {
if (isBufferingCompleted || bufferLevel > settings.get().streaming.buffer.stallThreshold) {
_notifyBufferStateChanged(MetricsConstants.BUFFER_LOADED);
}
}
if ((bufferLevel <= stallThreshold) && !isBufferingCompleted) {
_notifyBufferStateChanged(MetricsConstants.BUFFER_EMPTY);
} else if (isBufferingCompleted || bufferLevel > stallThreshold) {
_notifyBufferStateChanged(MetricsConstants.BUFFER_LOADED);
}
}

Expand Down

0 comments on commit 3f37b30

Please sign in to comment.