[vlc-commits] PulseAudio: improve resampling formula

Rémi Denis-Courmont git at videolan.org
Thu Aug 11 17:09:47 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 11 18:09:16 2011 +0300| [3e00fa130e30266dcb6b6ae75384ae69d46f50f3] | committer: Rémi Denis-Courmont

PulseAudio: improve resampling formula

...for good this time (yeah right).

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

 modules/audio_output/pulse.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index f1af097..727f66d 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -272,9 +272,10 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
         sync = true;
 
     /* Compute playback sample rate */
-    /* This is empirical. Feel free to define something smarter. */
+    /* This is empirical (especially the shift values).
+     * Feel free to define something smarter. */
     int adj = sync ? (outrate - inrate)
-                   : outrate * (delta + change) / (CLOCK_FREQ << 4);
+                   : outrate * ((delta >> 4) + change) / (CLOCK_FREQ << 2);
     /* This avoids too quick rate variation. It sounds really bad and
      * causes unstability (e.g. oscillation around the correct rate). */
     int limit = inrate >> 10;



More information about the vlc-commits mailing list