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:
@@ -256,6 +256,11 @@ struct AudioOutput {
|
|||||||
* The #AudioFormat requested by #Command::OPEN.
|
* The #AudioFormat requested by #Command::OPEN.
|
||||||
*/
|
*/
|
||||||
AudioFormat audio_format;
|
AudioFormat audio_format;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The #MusicPipe passed to #Command::OPEN.
|
||||||
|
*/
|
||||||
|
const MusicPipe *pipe;
|
||||||
} request;
|
} request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -122,8 +122,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
request.audio_format = audio_format;
|
request.audio_format = audio_format;
|
||||||
|
request.pipe = ∓
|
||||||
pipe.Init(mp);
|
|
||||||
|
|
||||||
if (!thread.IsDefined())
|
if (!thread.IsDefined())
|
||||||
StartThread();
|
StartThread();
|
||||||
|
@@ -145,6 +145,7 @@ AudioOutput::Open()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
in_audio_format = request.audio_format;
|
in_audio_format = request.audio_format;
|
||||||
|
pipe.Init(*request.pipe);
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
@@ -284,8 +285,9 @@ AudioOutput::Reopen()
|
|||||||
{
|
{
|
||||||
assert(open);
|
assert(open);
|
||||||
|
|
||||||
if (request.audio_format != in_audio_format &&
|
if ((request.audio_format != in_audio_format &&
|
||||||
!config_audio_format.IsFullyDefined()) {
|
!config_audio_format.IsFullyDefined()) ||
|
||||||
|
request.pipe != &pipe.GetPipe()) {
|
||||||
Close(true);
|
Close(true);
|
||||||
Open();
|
Open();
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user