summaryrefslogtreecommitdiffstats
path: root/src/modules/oss/oss-util.c
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2010-10-09 15:38:43 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2010-10-15 01:10:00 +0530
commit49101fc540aec9a249e97a9f650be38f9f92f5ac (patch)
tree6b2049a66cb3f4c43adcb424468ff2deb852df84 /src/modules/oss/oss-util.c
parent1d2ef7923d28a74e08a4309b6fa3d36481d2df3b (diff)
volume: Clamp volume to PA_VOLUME_MAX
This ensures that we always clamp the volume to PA_VOLUME_MAX. While this currently has no effect, it will be required for making sure we don't exceed PA_VOLUME_MAX when its value changes in the future.
Diffstat (limited to 'src/modules/oss/oss-util.c')
-rw-r--r--src/modules/oss/oss-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/oss/oss-util.c b/src/modules/oss/oss-util.c
index b95023c3..966a6ca1 100644
--- a/src/modules/oss/oss-util.c
+++ b/src/modules/oss/oss-util.c
@@ -271,10 +271,10 @@ int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_
pa_cvolume_reset(volume, ss->channels);
- volume->values[0] = ((vol & 0xFF) * PA_VOLUME_NORM) / 100;
+ volume->values[0] = PA_CLAMP_VOLUME(((vol & 0xFF) * PA_VOLUME_NORM) / 100);
if (volume->channels >= 2)
- volume->values[1] = (((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100;
+ volume->values[1] = PA_CLAMP_VOLUME((((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100);
pa_log_debug("Read mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume));
return 0;