Commit 3ab90564 authored by Max Kellermann's avatar Max Kellermann

output/Shout: open the encoder first, then open connection

This order will be necessary for proper AudioFormat initialization, because the encoder may change the format.
parent f46d5453
...@@ -348,21 +348,15 @@ ShoutOpen(shout_t *shout_conn) ...@@ -348,21 +348,15 @@ ShoutOpen(shout_t *shout_conn)
void void
ShoutOutput::Open(AudioFormat &audio_format) ShoutOutput::Open(AudioFormat &audio_format)
{ {
ShoutOpen(shout_conn);
try {
encoder = prepared_encoder->Open(audio_format); encoder = prepared_encoder->Open(audio_format);
try { try {
ShoutOpen(shout_conn);
WritePage(); WritePage();
} catch (const std::runtime_error &) { } catch (...) {
delete encoder; delete encoder;
throw; throw;
} }
} catch (const std::runtime_error &) {
shout_close(shout_conn);
throw;
}
} }
std::chrono::steady_clock::duration std::chrono::steady_clock::duration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment