avplayer: do not start the video multiple times (#3638)

This commit is contained in:
Vladislav Mikhalin
2025-09-21 16:03:24 +03:00
committed by GitHub
parent 51c96b8ee6
commit 525d24a7fc

View File

@@ -176,7 +176,8 @@ bool AvPlayerState::GetStreamInfo(u32 stream_index, AvPlayerStreamInfo& info) {
// Called inside GAME thread
bool AvPlayerState::Start() {
std::shared_lock lock(m_source_mutex);
if (m_up_source == nullptr || !m_up_source->Start()) {
if (m_current_state == AvState::Ready || m_current_state == AvState::Stop || Stop()) {
if (!m_up_source->Start()) {
LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
return false;
}
@@ -185,6 +186,10 @@ bool AvPlayerState::Start() {
return true;
}
LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
return false;
}
// Called inside GAME thread
bool AvPlayerState::Pause() {
std::shared_lock lock(m_source_mutex);