Fix rapid scene switches by random tab

Wait scene was not set while waiting for scene changes on the random
tab.
If wait scene was ever set by other means (sequence) the scene switcher
would immediately wake up as the wait scene is not the expected value.
This commit is contained in:
WarmUpTill 2021-05-22 19:23:55 +02:00 committed by WarmUpTill
parent e4b060976b
commit c1704f2164
3 changed files with 9 additions and 2 deletions

View File

@ -484,6 +484,7 @@ void SwitcherData::Thread()
}
vblog(LOG_INFO, "try to sleep for %ld", duration.count());
setWaitScene();
cv.wait_for(lock, duration);
startTime = std::chrono::high_resolution_clock::now();
@ -510,6 +511,7 @@ void SwitcherData::Thread()
vblog(LOG_INFO, "sleep for %ld before switching scene",
duration.count());
setWaitScene();
cv.wait_for(lock, duration);
if (stop) {
@ -686,6 +688,12 @@ void SwitcherData::Stop()
client.disconnect();
}
void SwitcherData::setWaitScene()
{
waitScene = obs_frontend_get_current_scene();
obs_source_release(waitScene);
}
bool SwitcherData::sceneChangedDuringWait()
{
obs_source_t *currentSource = obs_frontend_get_current_scene();

View File

@ -192,6 +192,7 @@ struct SwitcherData {
void Start();
void Stop();
void setWaitScene();
bool sceneChangedDuringWait();
bool prioFuncsValid();

View File

@ -440,8 +440,6 @@ void SceneSequenceSwitch::prepareUninterruptibleMatch(
{
int dur = delay.seconds * 1000;
if (dur > 0) {
switcher->waitScene = obs_weak_source_get_source(currentScene);
obs_source_release(switcher->waitScene);
linger = dur;
}
}