[Xfce4-commits] <xfce4-volumed:master> Prevent possible SIGFPE if a track has a 0 volume range
Steve Dodier
noreply at xfce.org
Thu Nov 18 17:00:02 CET 2010
Updating branch refs/heads/master
to ffa0271f280f7234d7ab1250f8ce9484390ef302 (commit)
from 998fcc86d0358b32f2a529e13569d76d72fea959 (commit)
commit ffa0271f280f7234d7ab1250f8ce9484390ef302
Author: Steve Dodier <sidnioulz at gmail.com>
Date: Thu Nov 18 16:42:10 2010 +0100
Prevent possible SIGFPE if a track has a 0 volume range
ChangeLog | 3 +++
src/xvd_mixer.c | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b86387b..8dcb950 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
2010-11-18 Steve Dodier <sidnioulz at gmail.com>
+ * Add a value check incase a GStreamer track has a volume range of 0 (fixes lp #624520)
+
+2010-11-18 Steve Dodier <sidnioulz at gmail.com>
* Fix xfce4-volumed.desktop's exec argument (fixes lp #538407)
2010-11-02 Steve Dodier <sidnioulz at gmail.com>
diff --git a/src/xvd_mixer.c b/src/xvd_mixer.c
index 5c04d9d..1cb7977 100644
--- a/src/xvd_mixer.c
+++ b/src/xvd_mixer.c
@@ -356,10 +356,13 @@ xvd_calculate_avg_volume(XvdInstance *Inst,
gint num_channels)
{
if (Inst->track) {
- gint i, s=0;
+ gint i, s=0, step;
for (i=0; i<num_channels; i++) {
- s += ((volumes[i] - Inst->track->min_volume) * 100 /
- (Inst->track->max_volume - Inst->track->min_volume));
+ step=Inst->track->max_volume - Inst->track->min_volume;
+ if (!step)
+ ++step;
+
+ s += ((volumes[i] - Inst->track->min_volume) * 100 / step);
}
Inst->current_vol = s/num_channels;
}
More information about the Xfce4-commits
mailing list