Commit bd8d8eef authored by Max Kellermann's avatar Max Kellermann

output/Timer: no "time" initialization if !started

parent e786207c
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
#include <assert.h> #include <assert.h>
Timer::Timer(const AudioFormat af) Timer::Timer(const AudioFormat af)
: time(0), :started(false),
started(false),
rate(af.sample_rate * af.GetFrameSize()) rate(af.sample_rate * af.GetFrameSize())
{ {
} }
...@@ -41,7 +40,6 @@ void Timer::Start() ...@@ -41,7 +40,6 @@ void Timer::Start()
void Timer::Reset() void Timer::Reset()
{ {
time = 0;
started = false; started = false;
} }
...@@ -56,6 +54,8 @@ void Timer::Add(int size) ...@@ -56,6 +54,8 @@ void Timer::Add(int size)
unsigned Timer::GetDelay() const unsigned Timer::GetDelay() const
{ {
assert(started);
int64_t delay = (int64_t)(time - MonotonicClockUS()) / 1000; int64_t delay = (int64_t)(time - MonotonicClockUS()) / 1000;
if (delay < 0) if (delay < 0)
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment