From 857b49cccd3aa39d4deec92f4543f2777d77b0db Mon Sep 17 00:00:00 2001 From: dsilhavy Date: Wed, 15 Jul 2020 11:44:15 +0200 Subject: [PATCH] Adjust low latency sample to include catchup playback rate threshold (#3336) --- samples/low-latency/index.html | 45 ++++++++++++++++++------ src/streaming/models/MediaPlayerModel.js | 5 +-- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/samples/low-latency/index.html b/samples/low-latency/index.html index 82e5e048ec..20b8dd5d4b 100644 --- a/samples/low-latency/index.html +++ b/samples/low-latency/index.html @@ -10,7 +10,7 @@ diff --git a/src/streaming/models/MediaPlayerModel.js b/src/streaming/models/MediaPlayerModel.js index c2f2ee3fad..7ec97d41dd 100644 --- a/src/streaming/models/MediaPlayerModel.js +++ b/src/streaming/models/MediaPlayerModel.js @@ -148,12 +148,13 @@ function MediaPlayerModel() { function getLiveCatchupLatencyThreshold() { try { const liveCatchupLatencyThreshold = settings.get().streaming.liveCatchupLatencyThreshold; + const liveDelay = getLiveDelay(); if (liveCatchupLatencyThreshold !== null && !isNaN(liveCatchupLatencyThreshold)) { - return liveCatchupLatencyThreshold; + return Math.max(liveCatchupLatencyThreshold, liveDelay); } - const liveDelay = getLiveDelay(); + const liveCatchupMinDrift = settings.get().streaming.liveCatchUpMinDrift; const maximumLiveDelay = !isNaN(liveDelay) && liveDelay ? !isNaN(liveCatchupMinDrift) ? settings.get().streaming.liveCatchUpMinDrift + getLiveDelay() : getLiveDelay() : NaN;