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
+5 -1
View File
@@ -26,6 +26,7 @@
#include <QElapsedTimer>
#include "common/define.h"
#include "common/playbackaudioclock.h"
namespace olive
{
@@ -33,7 +34,8 @@ namespace olive
class ViewerPlaybackTimer {
public:
void start(const int64_t &start_timestamp, const int &playback_speed,
const double &timebase);
const double &timebase,
const PlaybackAudioClock *audio_clock = nullptr);
int64_t get_timestamp_now() const;
@@ -44,6 +46,8 @@ private:
int playback_speed_;
double timebase_;
const PlaybackAudioClock *audio_clock_ = nullptr;
};
}