audio: master-clock playback timing, output clock compensation, buffer config, interpolated speed

- playback timer uses the audio output device as its master clock: the
  PortAudio callback counts consumed frames (including underrun
  zero-fill) so video cannot drift away from what is heard; wall clock
  remains as fallback when no clocked output is running
- output clock compensates for device output latency; new Preferences >
  Audio buffer size setting (0 = auto)
- SampleBuffer::speed() now uses linear interpolation instead of
  nearest-neighbor sampling
- regression tests: audio-clock driven timer (fwd/rev/speed), wall
  clock fallback, interpolation correctness
This commit is contained in:
2026-07-19 21:44:34 +08:00
parent 0c02ff0d77
commit a7ddc0f114
16 changed files with 266 additions and 8 deletions
+3 -1
View File
@@ -35,6 +35,7 @@
#include <QScreen>
#include <QTextEdit>
#include "audio/audiomanager.h"
#include "common/define.h"
#include "common/html.h"
#include "common/qtutils.h"
@@ -1632,7 +1633,8 @@ void ViewerDisplayWidget::play(const int64_t &start_timestamp,
playback_timebase_ = timebase;
playback_speed_ = playback_speed;
timer_.start(start_timestamp, playback_speed, timebase.to_double());
timer_.start(start_timestamp, playback_speed, timebase.to_double(),
AudioManager::instance());
if (start_updating) {
connect(this, &ViewerDisplayWidget::frame_swapped, this,