From 669dad856353ba97a912c106da0892f57a61bedf Mon Sep 17 00:00:00 2001 From: enen92 <92enen@gmail.com> Date: Mon, 12 Feb 2024 14:42:50 +0000 Subject: VideoPlayer: Fix stalls when seeking with tempo enabled --- xbmc/cores/VideoPlayer/AudioSinkAE.cpp | 3 ++- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xbmc/cores/VideoPlayer/AudioSinkAE.cpp b/xbmc/cores/VideoPlayer/AudioSinkAE.cpp index 0af936fde2..7e9fb0a629 100644 --- a/xbmc/cores/VideoPlayer/AudioSinkAE.cpp +++ b/xbmc/cores/VideoPlayer/AudioSinkAE.cpp @@ -112,11 +112,12 @@ unsigned int CAudioSinkAE::AddPackets(const DVDAudioFrame &audioframe) m_syncError = 0.0; } - //Calculate a timeout when this definitely should be done + // Calculate a timeout when this definitely should be done double timeout; timeout = DVD_SEC_TO_TIME(m_pAudioStream->GetDelay()) + audioframe.duration; timeout += DVD_SEC_TO_TIME(1.0); timeout += m_pClock->GetAbsoluteClock(); + timeout *= m_pClock->GetClockSpeed(); unsigned int total = audioframe.nb_frames - audioframe.framesOut; unsigned int frames = total; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index c93beaa6ac..bf3f606798 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -3989,8 +3989,9 @@ void CVideoPlayer::FlushBuffers(double pts, bool accurate, bool sync) m_VideoPlayerRadioRDS->Flush(); m_VideoPlayerAudioID3->Flush(); - if (m_playSpeed == DVD_PLAYSPEED_NORMAL || - m_playSpeed == DVD_PLAYSPEED_PAUSE) + if (m_playSpeed == DVD_PLAYSPEED_NORMAL || m_playSpeed == DVD_PLAYSPEED_PAUSE || + (m_playSpeed >= DVD_PLAYSPEED_NORMAL * m_processInfo->MinTempoPlatform() && + m_playSpeed <= DVD_PLAYSPEED_NORMAL * m_processInfo->MaxTempoPlatform())) { // make sure players are properly flushed, should put them in stalled state auto msg = std::make_shared(1s, SYNCSOURCE_AUDIO | SYNCSOURCE_VIDEO); -- cgit v1.2.3