From c3d8a5994295c968932c986e680e26a0e7ffb42d Mon Sep 17 00:00:00 2001 From: CastagnaIT Date: Mon, 10 Apr 2023 13:36:01 +0200 Subject: [PATCH] [Subtitles][WebVTT] Fix reversed pts offset correction --- xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp index 1e3bab67df..7e784a619b 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp @@ -66,7 +66,11 @@ OverlayMessage COverlayCodecWebVTT::Decode(DemuxPacket* pPacket) m_webvttHandler.Reset(); - m_webvttHandler.SetPeriodStart(pPacket->m_ptsOffsetCorrection); + // WebVTT subtitles has no relation with packet PTS then if + // a period/chapter change happens (e.g. HLS streaming) VP can detect a discontinuity + // and adjust the packet PTS by substracting the pts offset correction value, + // so here we have to adjust WebVTT subtitles PTS by substracting it at same way + m_webvttHandler.SetPeriodStart(pPacket->m_ptsOffsetCorrection * -1); if (m_isISOFormat) { -- 2.11.4.GIT