[vlc-commits] PulseAudio: improve resampling formula
Rémi Denis-Courmont
git at videolan.org
Thu Aug 11 17:10:02 CEST 2011
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 11 18:09:16 2011 +0300| [8e2b5d8d6cb3db2ad4139f6a9b4452720ccc122a] | committer: Rémi Denis-Courmont
PulseAudio: improve resampling formula
...for good this time (yeah right).
(cherry picked from commit 3e00fa130e30266dcb6b6ae75384ae69d46f50f3)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=8e2b5d8d6cb3db2ad4139f6a9b4452720ccc122a
---
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 0225003..a377f66 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -215,9 +215,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