Skip to content

Commit

Permalink
Merge pull request xbmc#24402 from enen92/reset_data_cache
Browse files Browse the repository at this point in the history
Players: Always reset CDataCacheCore on close file
  • Loading branch information
enen92 authored Jan 8, 2024
2 parents bc828f2 + 03e1bad commit 050d2af
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 30 deletions.
23 changes: 15 additions & 8 deletions xbmc/cores/DataCacheCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,27 @@ void CDataCacheCore::Reset()
{
{
std::unique_lock<CCriticalSection> lock(m_stateSection);

m_stateInfo.m_speed = 1.0;
m_stateInfo.m_tempo = 1.0;
m_stateInfo.m_stateSeeking = false;
m_stateInfo.m_renderGuiLayer = false;
m_stateInfo.m_renderVideoLayer = false;
m_stateInfo = {};
m_playerStateChanged = false;
}

{
std::unique_lock<CCriticalSection> lock(m_videoPlayerSection);
m_playerVideoInfo = {};
}
{
std::unique_lock<CCriticalSection> lock(m_audioPlayerSection);
m_playerAudioInfo = {};
}
m_hasAVInfoChanges = false;
{
std::unique_lock<CCriticalSection> lock(m_renderSection);
m_renderInfo = {};
}
{
std::unique_lock<CCriticalSection> lock(m_contentSection);

m_contentInfo.Reset();
}
m_timeInfo = {};
}

bool CDataCacheCore::HasAVInfoChanges()
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/ExternalPlayer/ExternalPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ bool CExternalPlayer::CloseFile(bool reopen)
TerminateProcess(m_processInfo.hProcess, 1);
}
#endif

CServiceBroker::GetDataCacheCore().Reset();
return true;
}

Expand Down
5 changes: 4 additions & 1 deletion xbmc/cores/RetroPlayer/RetroPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@ bool CRetroPlayer::CloseFile(bool reopen /* = false */)
m_gameClient.reset();

m_renderManager.reset();
if (m_processInfo)
{
m_processInfo->ResetInfo();
}
m_processInfo.reset();

CLog::Log(LOGDEBUG, "RetroPlayer[PLAYER]: Playback ended");
m_callback.OnPlayBackEnded();

Expand Down
17 changes: 1 addition & 16 deletions xbmc/cores/RetroPlayer/process/RPProcessInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,7 @@ void CRPProcessInfo::ResetInfo()
{
if (m_dataCache != nullptr)
{
m_dataCache->SetVideoDecoderName("", false);
m_dataCache->SetVideoDeintMethod("");
m_dataCache->SetVideoPixelFormat("");
m_dataCache->SetVideoDimensions(0, 0);
m_dataCache->SetVideoFps(0.0f);
m_dataCache->SetVideoDAR(1.0f);
m_dataCache->SetAudioDecoderName("");
m_dataCache->SetAudioChannels("");
m_dataCache->SetAudioSampleRate(0);
m_dataCache->SetAudioBitsPerSample(0);
m_dataCache->SetRenderClockSync(false);
m_dataCache->SetStateSeeking(false);
m_dataCache->SetSpeed(1.0f, 1.0f);
m_dataCache->SetGuiRender(true); //! @todo
m_dataCache->SetVideoRender(false); //! @todo
m_dataCache->SetPlayTimes(0, 0, 0, 0);
m_dataCache->Reset();
}
}

Expand Down
4 changes: 1 addition & 3 deletions xbmc/cores/VideoPlayer/VideoPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,7 @@ bool CVideoPlayer::CloseFile(bool reopen)
}

m_Edl.Clear();
CServiceBroker::GetDataCacheCore().SetEditList(m_Edl.GetEditList());
CServiceBroker::GetDataCacheCore().SetCuts(m_Edl.GetCutMarkers());
CServiceBroker::GetDataCacheCore().SetSceneMarkers(m_Edl.GetSceneMarkers());
CServiceBroker::GetDataCacheCore().Reset();

m_HasVideo = false;
m_HasAudio = false;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/paplayer/PAPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ bool PAPlayer::CloseFile(bool reopen)
lock.lock();
}
}

CServiceBroker::GetDataCacheCore().Reset();
return true;
}

Expand Down
2 changes: 2 additions & 0 deletions xbmc/network/upnp/UPnPPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,11 @@ bool CUPnPPlayer::CloseFile(bool reopen)
m_callback.OnPlayBackStopped();
}
StopThread(true);
CServiceBroker::GetDataCacheCore().Reset();
return true;
failed:
m_logger->error("CloseFile - unable to stop playback");
CServiceBroker::GetDataCacheCore().Reset();
return false;
}

Expand Down

0 comments on commit 050d2af

Please sign in to comment.