output/Internal: move the Mutex to struct AudioOutputControl
struct AudioOutput should not know or care about multi-threading.
This commit is contained in:
@@ -41,8 +41,7 @@ struct notify audio_output_client_notify;
|
|||||||
AudioOutputControl::AudioOutputControl(AudioOutput *_output,
|
AudioOutputControl::AudioOutputControl(AudioOutput *_output,
|
||||||
AudioOutputClient &_client)
|
AudioOutputClient &_client)
|
||||||
:output(_output), client(_client),
|
:output(_output), client(_client),
|
||||||
thread(BIND_THIS_METHOD(Task)),
|
thread(BIND_THIS_METHOD(Task))
|
||||||
mutex(output->mutex)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "Source.hxx"
|
#include "Source.hxx"
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
#include "thread/Thread.hxx"
|
#include "thread/Thread.hxx"
|
||||||
|
#include "thread/Mutex.hxx"
|
||||||
#include "thread/Cond.hxx"
|
#include "thread/Cond.hxx"
|
||||||
#include "system/PeriodClock.hxx"
|
#include "system/PeriodClock.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
@@ -203,7 +204,10 @@ class AudioOutputControl {
|
|||||||
bool skip_delay;
|
bool skip_delay;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mutex &mutex;
|
/**
|
||||||
|
* This mutex protects #open, #fail_timer, #pipe.
|
||||||
|
*/
|
||||||
|
mutable Mutex mutex;
|
||||||
|
|
||||||
AudioOutputControl(AudioOutput *_output, AudioOutputClient &_client);
|
AudioOutputControl(AudioOutput *_output, AudioOutputClient &_client);
|
||||||
|
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
#include "filter/Observer.hxx"
|
#include "filter/Observer.hxx"
|
||||||
#include "thread/Mutex.hxx"
|
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class MusicPipe;
|
class MusicPipe;
|
||||||
@@ -106,11 +105,6 @@ struct AudioOutput {
|
|||||||
*/
|
*/
|
||||||
FilterObserver convert_filter;
|
FilterObserver convert_filter;
|
||||||
|
|
||||||
/**
|
|
||||||
* This mutex protects #open, #fail_timer, #pipe.
|
|
||||||
*/
|
|
||||||
mutable Mutex mutex;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws #std::runtime_error on error.
|
* Throws #std::runtime_error on error.
|
||||||
*/
|
*/
|
||||||
|
@@ -480,7 +480,7 @@ AudioOutputControl::Task()
|
|||||||
|
|
||||||
if (command == Command::NONE) {
|
if (command == Command::NONE) {
|
||||||
woken_for_play = false;
|
woken_for_play = false;
|
||||||
cond.wait(output->mutex);
|
cond.wait(mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "mixer/MixerList.hxx"
|
#include "mixer/MixerList.hxx"
|
||||||
#include "pcm/PcmExport.hxx"
|
#include "pcm/PcmExport.hxx"
|
||||||
#include "system/ByteOrder.hxx"
|
#include "system/ByteOrder.hxx"
|
||||||
|
#include "thread/Mutex.hxx"
|
||||||
#include "thread/Cond.hxx"
|
#include "thread/Cond.hxx"
|
||||||
#include "util/Manual.hxx"
|
#include "util/Manual.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "AndroidSimpleBufferQueue.hxx"
|
#include "AndroidSimpleBufferQueue.hxx"
|
||||||
#include "../../OutputAPI.hxx"
|
#include "../../OutputAPI.hxx"
|
||||||
#include "../../Wrapper.hxx"
|
#include "../../Wrapper.hxx"
|
||||||
|
#include "thread/Mutex.hxx"
|
||||||
#include "thread/Cond.hxx"
|
#include "thread/Cond.hxx"
|
||||||
#include "util/Macros.hxx"
|
#include "util/Macros.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
|
Reference in New Issue
Block a user