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.
This commit is contained in:
parent
71c72ed072
commit
f86d6b0162
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user