From 579c4dac34546357a5fd1dfd67712df6a5930bf6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 7 Apr 2015 21:23:23 +0200 Subject: audio: change a detail about filter insertion The af_add() function has a problem: if the inserted filter returns AF_DETACH during init, the function will have a dangling pointer. Until now this was avoided by making sure none of the used filters actually return AF_DETACH, but it's getting infeasible. Solve this by requiring passing an unique label to af_add(), which is then used instead of the pointer. --- audio/mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio/mixer.c') diff --git a/audio/mixer.c b/audio/mixer.c index 0eb9c86453..7ae7ed458d 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -135,7 +135,7 @@ static void setvolume_internal(struct mixer *mixer, float l, float r) if (gain == 1.0) return; MP_VERBOSE(mixer, "Inserting volume filter.\n"); - if (!(af_add(mixer->af, "volume", NULL) + if (!(af_add(mixer->af, "volume", "softvol", NULL) && af_control_any_rev(mixer->af, AF_CONTROL_SET_VOLUME, &gain))) MP_ERR(mixer, "No volume control available.\n"); } @@ -222,7 +222,7 @@ void mixer_setbalance(struct mixer *mixer, float val) if (val == 0) return; - if (!(af_pan_balance = af_add(mixer->af, "pan", NULL))) { + if (!(af_pan_balance = af_add(mixer->af, "pan", "autopan", NULL))) { MP_ERR(mixer, "No balance control available.\n"); return; } -- cgit v1.2.3