mirror of https://github.com/mpv-player/mpv
audio: don't crash when changing volume if no audio is initialized
Oversight.
This commit is contained in:
parent
2fb2f9b93a
commit
d47b708f00
|
@ -57,6 +57,9 @@ bool mixer_audio_initialized(struct mixer *mixer)
|
||||||
// Called when opts->softvol_volume or opts->softvol_mute were changed.
|
// Called when opts->softvol_volume or opts->softvol_mute were changed.
|
||||||
void mixer_update_volume(struct mixer *mixer)
|
void mixer_update_volume(struct mixer *mixer)
|
||||||
{
|
{
|
||||||
|
if (!mixer->af)
|
||||||
|
return;
|
||||||
|
|
||||||
float gain = MPMAX(mixer->opts->softvol_volume / 100.0, 0);
|
float gain = MPMAX(mixer->opts->softvol_volume / 100.0, 0);
|
||||||
if (mixer->opts->softvol_mute == 1)
|
if (mixer->opts->softvol_mute == 1)
|
||||||
gain = 0.0;
|
gain = 0.0;
|
||||||
|
|
Loading…
Reference in New Issue