mixer,output: prevent setting volume before outputs are really enabled
Previous versions of MPD would call SetVolume on enabled outputs before they are ready, causing all of MPD to crash. Checking the really_enabled flag prevents this, though it also prevents setting volume before the player starts. Before (with the PipeWire output): [i] ~$ mpc clear volume: 81% repeat: off random: off single: off consume: off [i] ~$ systemctl --user restart mpd.service [i] ~$ mpc volume 100 MPD error: Connection closed by the server [i] ~ 1 $ After: [i] ~$ # mpd is freshly started w/o anything in the queue [i] ~$ mpc volume:100% repeat: off random: off single: off consume: off [i] ~$ mpc volume 80 MPD error: problems setting volume [i] ~ 1 $ mpc volume:100% repeat: off random: off single: off consume: off [i] ~$
This commit is contained in:
parent
c7a4355153
commit
35dbc1a90c
|
@ -84,7 +84,7 @@ output_mixer_set_volume(AudioOutputControl &ao, unsigned volume) noexcept
|
|||
|
||||
/* software mixers are always updated, even if they are
|
||||
disabled */
|
||||
if (!ao.IsEnabled() && !mixer->IsPlugin(software_mixer_plugin))
|
||||
if (!ao.IsReallyEnabled() && !mixer->IsPlugin(software_mixer_plugin))
|
||||
return false;
|
||||
|
||||
try {
|
||||
|
|
|
@ -288,6 +288,13 @@ public:
|
|||
return !output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Caller must lock the mutex.
|
||||
*/
|
||||
bool IsReallyEnabled() const noexcept {
|
||||
return really_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Caller must lock the mutex.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue