From bd8d8eef3ea1d63e4346ebaf3f7acc25a4fe7057 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 28 Dec 2016 10:16:11 +0100 Subject: [PATCH] output/Timer: no "time" initialization if !started --- src/output/Timer.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/output/Timer.cxx b/src/output/Timer.cxx index 8e1b6ee7e..cf7532c9c 100644 --- a/src/output/Timer.cxx +++ b/src/output/Timer.cxx @@ -27,8 +27,7 @@ #include Timer::Timer(const AudioFormat af) - : time(0), - started(false), + :started(false), rate(af.sample_rate * af.GetFrameSize()) { } @@ -41,7 +40,6 @@ void Timer::Start() void Timer::Reset() { - time = 0; started = false; } @@ -56,6 +54,8 @@ void Timer::Add(int size) unsigned Timer::GetDelay() const { + assert(started); + int64_t delay = (int64_t)(time - MonotonicClockUS()) / 1000; if (delay < 0) return 0;