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,13 +176,18 @@ bool AvPlayerState::GetStreamInfo(u32 stream_index, AvPlayerStreamInfo& info) {
// Called inside GAME thread // Called inside GAME thread
bool AvPlayerState::Start() { bool AvPlayerState::Start() {
std::shared_lock lock(m_source_mutex); 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()) {
LOG_ERROR(Lib_AvPlayer, "Could not start playback."); if (!m_up_source->Start()) {
return false; LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
return false;
}
SetState(AvState::Play);
OnPlaybackStateChanged(AvState::Play);
return true;
} }
SetState(AvState::Play);
OnPlaybackStateChanged(AvState::Play); LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
return true; return false;
} }
// Called inside GAME thread // Called inside GAME thread