Commit 8d6be5e2 authored by Adrien Maglo's avatar Adrien Maglo

AudioTrack: use the render position from the DSP to compute the delay

Do not use the frequency rate in the computation.
parent b74e590d
......@@ -206,19 +206,17 @@ static int TimeGet(audio_output_t *p_aout, mtime_t *restrict delay)
if (p_sys->at_getRenderPosition(&hal, &dsp, MUSIC))
return -1;
hal = (uint32_t)((uint64_t)hal * p_sys->rate / 44100);
if (p_sys->samples_written == 0) {
p_sys->initial = hal;
p_sys->initial = dsp;
return -1;
}
hal -= p_sys->initial;
if (hal == 0)
dsp -= p_sys->initial;
if (dsp == 0)
return -1;
if (delay)
*delay = ((mtime_t)p_sys->samples_written - hal) * CLOCK_FREQ / p_sys->rate;
*delay = ((mtime_t)p_sys->samples_written - dsp) * CLOCK_FREQ / p_sys->rate;
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