summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-01 01:08:48 +0200
committerwm4 <wm4@nowhere>2015-04-01 01:08:48 +0200
commit62030e1090dde45f1f743d8632e616e69c8be1d4 (patch)
tree6c50373059504fee8275ee1ef5f78a212a423929
parent72fcdc32dba2e9fa88b58ca7a4fbe156f4e5c2c5 (diff)
downloadmpv-62030e1090dde45f1f743d8632e616e69c8be1d4.tar.bz2
mpv-62030e1090dde45f1f743d8632e616e69c8be1d4.tar.xz
mixer: handle prevention of unneeded af_volume insertion differently
Just so that this special-case is out of the common volume path.
-rw-r--r--audio/mixer.c5
1 files 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))