output/Thread: remember the original filter audio format in local variable

This commit is contained in:
Max Kellermann 2017-01-15 01:21:14 +01:00
parent 6c293a3d7f
commit 193dd71600

View File

@ -111,8 +111,7 @@ AudioOutput::Open()
f = source.Open(request.audio_format, *request.pipe, f = source.Open(request.audio_format, *request.pipe,
prepared_replay_gain_filter, prepared_replay_gain_filter,
prepared_other_replay_gain_filter, prepared_other_replay_gain_filter,
prepared_filter) prepared_filter);
.WithMask(config_audio_format);
if (mixer != nullptr && mixer->IsPlugin(software_mixer_plugin)) if (mixer != nullptr && mixer->IsPlugin(software_mixer_plugin))
software_mixer_set_filter(*mixer, volume_filter.Get()); software_mixer_set_filter(*mixer, volume_filter.Get());
@ -121,14 +120,16 @@ AudioOutput::Open()
name, plugin.name)); name, plugin.name));
} }
if (open && f != filter_audio_format) { const auto cf = f.WithMask(config_audio_format);
if (open && cf != filter_audio_format) {
/* if the filter's output format changes, the output /* if the filter's output format changes, the output
must be reopened as well */ must be reopened as well */
CloseOutput(true); CloseOutput(true);
open = false; open = false;
} }
filter_audio_format = f; filter_audio_format = cf;
if (!open) { if (!open) {
try { try {