From 62030e1090dde45f1f743d8632e616e69c8be1d4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 1 Apr 2015 01:08:48 +0200 Subject: mixer: handle prevention of unneeded af_volume insertion differently Just so that this special-case is out of the common volume path. --- audio/mixer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/audio/mixer.c b/audio/mixer.c index 64735a199b..9ea08b505e 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -131,6 +131,8 @@ static void setvolume_internal(struct mixer *mixer, float l, float r) } float gain = (l + r) / 2.0 / 100.0 * mixer->opts->softvol_max / 100.0; if (!af_control_any_rev(mixer->af, AF_CONTROL_SET_VOLUME, &gain)) { + if (gain == 1.0) + return; MP_VERBOSE(mixer, "Inserting volume filter.\n"); if (!(af_add(mixer->af, "volume", NULL) && af_control_any_rev(mixer->af, AF_CONTROL_SET_VOLUME, &gain))) @@ -141,8 +143,7 @@ static void setvolume_internal(struct mixer *mixer, float l, float r) void mixer_setvolume(struct mixer *mixer, float l, float r) { checkvolume(mixer); // to check mute status - if (mixer->vol_l == l && mixer->vol_r == r) - return; // just prevent af_volume insertion when not needed + mixer->vol_l = av_clipf(l, 0, 100); mixer->vol_r = av_clipf(r, 0, 100); if (mixer->ao && !(mixer->emulate_mute && mixer->muted)) -- cgit v1.2.3