summaryrefslogtreecommitdiffstats
path: root/audio/mixer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-31 23:57:45 +0200
committerwm4 <wm4@nowhere>2015-04-01 00:20:07 +0200
commit1d2b81b55017e1e0c60e140b6eb1edff6f260525 (patch)
tree67aa86f64b16f221e14c6a50885c0bb8b99d95fe /audio/mixer.c
parente408dd20c76ae2f252a8e760b34aceb297dc46e4 (diff)
downloadmpv-1d2b81b55017e1e0c60e140b6eb1edff6f260525.tar.bz2
mpv-1d2b81b55017e1e0c60e140b6eb1edff6f260525.tar.xz
mixer: add more debug output
For remote-debugging volume rstore problems.
Diffstat (limited to 'audio/mixer.c')
-rw-r--r--audio/mixer.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/audio/mixer.c b/audio/mixer.c
index 2358835248..27c809c6eb 100644
--- a/audio/mixer.c
+++ b/audio/mixer.c
@@ -89,6 +89,7 @@ static void checkvolume(struct mixer *mixer)
vol.left = (gain / (mixer->opts->softvol_max / 100.0)) * 100.0;
vol.right = (gain / (mixer->opts->softvol_max / 100.0)) * 100.0;
} else {
+ MP_DBG(mixer, "Reading volume from AO.\n");
// Rely on the values not changing if the query is not supported
ao_control(mixer->ao, AOCONTROL_GET_VOLUME, &vol);
ao_control(mixer->ao, AOCONTROL_GET_MUTE, &mixer->muted);
@@ -124,6 +125,7 @@ static void setvolume_internal(struct mixer *mixer, float l, float r)
{
struct ao_control_vol vol = {.left = l, .right = r};
if (!mixer->softvol) {
+ MP_DBG(mixer, "Setting volume on AO.\n");
if (ao_control(mixer->ao, AOCONTROL_SET_VOLUME, &vol) != CONTROL_OK)
MP_ERR(mixer, "Failed to change audio output volume.\n");
return;
@@ -252,7 +254,6 @@ static void probe_softvol(struct mixer *mixer)
mixer->ao_softvol = mixer->ao_perapp ||
ao_control(mixer->ao, AOCONTROL_HAS_SOFT_VOLUME, 0) == 1;
-
if (mixer->opts->softvol == SOFTVOL_AUTO) {
// No system-wide volume => fine with AO volume control.
mixer->softvol = !mixer->ao_softvol;
@@ -260,6 +261,8 @@ static void probe_softvol(struct mixer *mixer)
mixer->softvol = mixer->opts->softvol == SOFTVOL_YES;
}
+ MP_DBG(mixer, "Will use af_volume: %s\n", mixer->softvol ? "yes" : "no");
+
// If we can't use real volume control => force softvol.
if (!mixer->softvol) {
ao_control_vol_t vol;
@@ -319,6 +322,7 @@ static void restore_volume(struct mixer *mixer)
force_vol_l = v_l;
force_vol_r = v_r;
force_mute = !!m;
+ MP_DBG(mixer, "Restoring volume from resume config.\n");
}
}
talloc_free(mixer->opts->mixer_restore_volume_data);
@@ -334,10 +338,14 @@ static void restore_volume(struct mixer *mixer)
opts->mixer_init_mute = -1;
checkvolume(mixer);
- if (force_vol_l >= 0 && force_vol_r >= 0)
+ if (force_vol_l >= 0 && force_vol_r >= 0) {
+ MP_DBG(mixer, "Restoring previous volume.\n");
mixer_setvolume(mixer, force_vol_l, force_vol_r);
- if (force_mute >= 0)
+ }
+ if (force_mute >= 0) {
+ MP_DBG(mixer, "Restoring previous mute toggle.\n");
mixer_setmute(mixer, force_mute);
+ }
}
// Called after the audio filter chain is built or rebuilt.
@@ -349,6 +357,8 @@ void mixer_reinit_audio(struct mixer *mixer, struct ao *ao, struct af_stream *af
mixer->ao = ao;
mixer->af = af;
+ MP_DBG(mixer, "Reinit...\n");
+
probe_softvol(mixer);
restore_volume(mixer);
@@ -365,8 +375,11 @@ void mixer_uninit_audio(struct mixer *mixer)
if (!mixer->ao)
return;
+ MP_DBG(mixer, "Uninit...\n");
+
checkvolume(mixer);
if (mixer->muted_by_us && !mixer->softvol && !mixer->ao_softvol) {
+ MP_DBG(mixer, "Draining.\n");
/* Current audio output API combines playing the remaining buffered
* audio and uninitializing the AO into one operation, even though
* ideally unmute would happen between those two steps. We can't do