diff options
author | Max Kellermann <max@musicpd.org> | 2017-01-15 01:18:34 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-01-15 01:24:17 +0100 |
commit | d14ec6aea560be509200e99b13890ac28e79b7e1 (patch) | |
tree | 8e53e1acdd4361b8e73db7aee9ce72781b25e7ca /src/output | |
parent | 917cedf893ee73317ed191f95ab201656f0d5b30 (diff) |
output/Thread: reconfigure ConvertFilter for its new input AudioFormat
If the input AudioFormat changes but the out_audio_format doesn't
change (e.g. because there is a fixed "format" setting in this
"audio_output" section), the ConvertFilter needs to be reconfigured.
This didn't happen, resulting in awful static noise after changing
songs.
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/OutputThread.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 809cae6cc..047dbe0c0 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -140,6 +140,18 @@ AudioOutput::Open() } open = true; + } else if (f != out_audio_format) { + /* reconfigure the final ConvertFilter for its new + input AudioFormat */ + + try { + convert_filter_set(convert_filter.Get(), + out_audio_format); + } catch (const std::runtime_error &e) { + Close(false); + std::throw_with_nested(FormatRuntimeError("Failed to convert for \"%s\" [%s]", + name, plugin.name)); + } } if (f != source.GetInputAudioFormat() || f != out_audio_format) { |