diff options
author | Max Kellermann <max@musicpd.org> | 2016-12-28 10:16:11 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-12-28 10:16:11 +0100 |
commit | bd8d8eef3ea1d63e4346ebaf3f7acc25a4fe7057 (patch) | |
tree | 1465b5a03233b8c507a8031122378504bb8733f5 | |
parent | e786207cc22a9455dc4ce8c1cd31147a52d29559 (diff) |
output/Timer: no "time" initialization if !started
-rw-r--r-- | src/output/Timer.cxx | 6 |
1 files 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 <assert.h> 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; |