From d3238ddf150eb51c37498b2a3723b483aa0f4e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 3 Jan 2025 09:16:37 +0100 Subject: [PATCH] fix: Fix change timestampOffset on discontinuities when not necessary (#7823) This change fixes a bug in a Safari test --- lib/media/media_source_engine.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index 47fc7b5e56..6280472e4d 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -1599,6 +1599,13 @@ shaka.media.MediaSourceEngine = class { return; } + // Avoid changing timestampOffset when the difference is less than 100 ms + // from the end of the current buffer. + const bufferEnd = this.bufferEnd(contentType); + if (bufferEnd && Math.abs(bufferEnd - timestampOffset) < 0.1) { + return; + } + // Queue an abort() to help MSE splice together overlapping segments. // We set appendWindowEnd when we change periods in DASH content, and the // period transition may result in overlap.