Fix playback backup timer interval and waveform-only prequeue

- The playback backup timer was using timebase_dbl() in seconds as its
  QTimer interval, which truncated to 0 ms for normal frame rates. This
  caused the timer to fire continuously and starve the event loop when
  the video display was hidden, e.g. in Show Waveform Only mode, freezing
  the UI and stopping the playhead. Multiply by 1000 to use milliseconds.
- If PlayInternal has neither video nor audio to prequeue, call
  FinishPlayPreprocess immediately so the backup timer starts and the
  playhead advances even in waveform-only mode with no audio.
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent 094f4a8e44
commit 468b6f1d1b
+8 -1
View File
@@ -1146,6 +1146,12 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
}
}
// If there's nothing to prequeue, start playback immediately so the
// playhead advances even when only the audio waveform is visible.
if (!prequeuing_video_ && !prequeuing_audio_) {
FinishPlayPreprocess();
}
// Force screen to stay awake
PreventSleep(true);
}
@@ -1388,7 +1394,8 @@ void ViewerWidget::FinishPlayPreprocess()
}
// This is our timer for loading the queue and setting the time
playback_backup_timer_.setInterval(qFloor(timebase_dbl()));
playback_backup_timer_.setInterval(
qMax(1, qFloor(timebase_dbl() * 1000.0)));
playback_backup_timer_.start();
PlaybackTimerUpdate();