output/Thread: move code to InternalOpen()
This commit is contained in:
@@ -339,6 +339,12 @@ public:
|
|||||||
void LockAllowPlay();
|
void LockAllowPlay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* Runs inside the OutputThread. Handles exceptions.
|
||||||
|
*/
|
||||||
|
void InternalOpen(AudioFormat audio_format,
|
||||||
|
const MusicPipe &pipe) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the output's delay reaches zero.
|
* Wait until the output's delay reaches zero.
|
||||||
*
|
*
|
||||||
|
@@ -203,6 +203,22 @@ AudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
AudioOutputControl::InternalOpen(const AudioFormat audio_format,
|
||||||
|
const MusicPipe &pipe) noexcept
|
||||||
|
{
|
||||||
|
last_error = nullptr;
|
||||||
|
fail_timer.Reset();
|
||||||
|
|
||||||
|
try {
|
||||||
|
output->Open(audio_format, pipe);
|
||||||
|
} catch (const std::runtime_error &e) {
|
||||||
|
LogError(e);
|
||||||
|
fail_timer.Update();
|
||||||
|
last_error = std::current_exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioOutput::Close(bool drain)
|
AudioOutput::Close(bool drain)
|
||||||
{
|
{
|
||||||
@@ -452,18 +468,7 @@ AudioOutputControl::Task()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::OPEN:
|
case Command::OPEN:
|
||||||
last_error = nullptr;
|
InternalOpen(request.audio_format, *request.pipe);
|
||||||
fail_timer.Reset();
|
|
||||||
|
|
||||||
try {
|
|
||||||
output->Open(request.audio_format,
|
|
||||||
*request.pipe);
|
|
||||||
} catch (const std::runtime_error &e) {
|
|
||||||
LogError(e);
|
|
||||||
fail_timer.Update();
|
|
||||||
last_error = std::current_exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user