[vlc-commits] PulseAudio: clean volume conversion boundaries a bit

Rémi Denis-Courmont git at videolan.org
Fri Nov 14 16:29:40 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 14 17:29:14 2014 +0200| [1e29fbdd866a6af3a66fc399d47b7933335190b0] | committer: Rémi Denis-Courmont

PulseAudio: clean volume conversion boundaries a bit

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

 modules/audio_output/pulse.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 069cf6a..6ec2eec 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -569,15 +569,16 @@ static int VolumeSet(audio_output_t *aout, float vol)
     aout_sys_t *sys = aout->sys;
     pa_stream *s = sys->stream;
     pa_operation *op;
+    pa_volume_t volume;
 
     /* VLC provides the software volume so convert directly to PulseAudio
      * software volume, pa_volume_t. This is not a linear amplification factor
      * so do not use PulseAudio linear amplification! */
     vol *= PA_VOLUME_NORM;
-    if (unlikely(vol >= PA_VOLUME_MAX))
-        vol = PA_VOLUME_MAX;
-
-    pa_volume_t volume = lroundf(vol);
+    if (unlikely(vol >= (float)PA_VOLUME_MAX))
+        volume = PA_VOLUME_MAX;
+    else
+        volume = lroundf(vol);
 
     if (s == NULL)
     {



More information about the vlc-commits mailing list