[vlc-commits] PulseAudio: try to keep all resampling on VLC side

Rémi Denis-Courmont git at videolan.org
Wed Nov 21 21:43:15 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 21 22:41:15 2012 +0200| [344713d09f8bbdd6267feed80256a842092818bc] | committer: Rémi Denis-Courmont

PulseAudio: try to keep all resampling on VLC side

This reduces overall CPU consumption.

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

 modules/audio_output/pulse.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 85ed3be..c80785b 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -779,7 +779,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
                                   | PA_STREAM_INTERPOLATE_TIMING
                                   | PA_STREAM_NOT_MONOTONIC
                                   | PA_STREAM_AUTO_TIMING_UPDATE
-                                  /*| PA_STREAM_FIX_RATE*/;
+                                  | PA_STREAM_FIX_RATE;
 
     struct pa_buffer_attr attr;
     attr.maxlength = -1;
@@ -867,6 +867,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
         goto fail;
     }
 
+    const struct pa_sample_spec *spec = pa_stream_get_sample_spec(s);
 #if PA_CHECK_VERSION(1,0,0)
     if (encoding != PA_ENCODING_INVALID) {
         const pa_format_info *info = pa_stream_get_format_info(s);
@@ -877,10 +878,13 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
             fmt->i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
         } else {
             msg_Dbg(aout, "digital pass-through enabled");
-            pa_stream_set_latency_update_callback(s, NULL, NULL);
+            spec = NULL;
         }
     }
 #endif
+    if (spec != NULL)
+        fmt->i_rate = spec->rate;
+
     stream_buffer_attr_cb(s, aout);
     var_AddCallback (aout, "audio-device", StreamMove, s);
     stream_moved_cb(s, aout);



More information about the vlc-commits mailing list