[vlc-commits] AudioTrack: use the render position from the DSP to compute the delay

Adrien Maglo git at videolan.org
Fri Mar 28 12:21:07 CET 2014


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Mar 28 12:19:03 2014 +0100| [8d6be5e2024f75b4705d2b25dc98ba6999162725] | committer: Adrien Maglo

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

Do not use the frequency rate in the computation.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d6be5e2024f75b4705d2b25dc98ba6999162725
---

 modules/audio_output/audiotrack.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 125a201..7b16cdd 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -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;
 }



More information about the vlc-commits mailing list