Commit f86d6b01 authored by Max Kellermann's avatar Max Kellermann

output/Control: move pipe initialization to the OutputThread

Un-protect the SharedPipeConsumer instance, and make it available in the OutputThread only. This gives more well-defined mutex protection.
parent 71c72ed0
......@@ -256,6 +256,11 @@ struct AudioOutput {
* The #AudioFormat requested by #Command::OPEN.
*/
AudioFormat audio_format;
/**
* The #MusicPipe passed to #Command::OPEN.
*/
const MusicPipe *pipe;
} request;
/**
......
......@@ -122,8 +122,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
}
request.audio_format = audio_format;
pipe.Init(mp);
request.pipe = ∓
if (!thread.IsDefined())
StartThread();
......
......@@ -145,6 +145,7 @@ AudioOutput::Open()
return;
in_audio_format = request.audio_format;
pipe.Init(*request.pipe);
bool success;
......@@ -284,8 +285,9 @@ AudioOutput::Reopen()
{
assert(open);
if (request.audio_format != in_audio_format &&
!config_audio_format.IsFullyDefined()) {
if ((request.audio_format != in_audio_format &&
!config_audio_format.IsFullyDefined()) ||
request.pipe != &pipe.GetPipe()) {
Close(true);
Open();
} else {
......
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