mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
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:
parent
e4b060976b
commit
c1704f2164
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ struct SwitcherData {
|
|||
void Start();
|
||||
void Stop();
|
||||
|
||||
void setWaitScene();
|
||||
bool sceneChangedDuringWait();
|
||||
|
||||
bool prioFuncsValid();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user