decoder/Control: add "noexcept"
This commit is contained in:
parent
2a774a1fea
commit
9a8a3beae4
@ -29,13 +29,13 @@
|
||||
|
||||
DecoderControl::DecoderControl(Mutex &_mutex, Cond &_client_cond,
|
||||
const AudioFormat _configured_audio_format,
|
||||
const ReplayGainConfig &_replay_gain_config)
|
||||
const ReplayGainConfig &_replay_gain_config) noexcept
|
||||
:thread(BIND_THIS_METHOD(RunThread)),
|
||||
mutex(_mutex), client_cond(_client_cond),
|
||||
configured_audio_format(_configured_audio_format),
|
||||
replay_gain_config(_replay_gain_config) {}
|
||||
|
||||
DecoderControl::~DecoderControl()
|
||||
DecoderControl::~DecoderControl() noexcept
|
||||
{
|
||||
ClearError();
|
||||
|
||||
@ -43,7 +43,7 @@ DecoderControl::~DecoderControl()
|
||||
}
|
||||
|
||||
void
|
||||
DecoderControl::WaitForDecoder()
|
||||
DecoderControl::WaitForDecoder() noexcept
|
||||
{
|
||||
assert(!client_is_waiting);
|
||||
client_is_waiting = true;
|
||||
@ -56,7 +56,7 @@ DecoderControl::WaitForDecoder()
|
||||
|
||||
void
|
||||
DecoderControl::SetReady(const AudioFormat audio_format,
|
||||
bool _seekable, SignedSongTime _duration)
|
||||
bool _seekable, SignedSongTime _duration) noexcept
|
||||
{
|
||||
assert(state == DecoderState::START);
|
||||
assert(pipe != nullptr);
|
||||
@ -94,7 +94,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const noexcept
|
||||
void
|
||||
DecoderControl::Start(DetachedSong *_song,
|
||||
SongTime _start_time, SongTime _end_time,
|
||||
MusicBuffer &_buffer, MusicPipe &_pipe)
|
||||
MusicBuffer &_buffer, MusicPipe &_pipe) noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
|
||||
@ -113,7 +113,7 @@ DecoderControl::Start(DetachedSong *_song,
|
||||
}
|
||||
|
||||
void
|
||||
DecoderControl::Stop()
|
||||
DecoderControl::Stop() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
|
||||
@ -162,7 +162,7 @@ DecoderControl::Seek(SongTime t)
|
||||
}
|
||||
|
||||
void
|
||||
DecoderControl::Quit()
|
||||
DecoderControl::Quit() noexcept
|
||||
{
|
||||
assert(thread.IsDefined());
|
||||
|
||||
@ -173,7 +173,7 @@ DecoderControl::Quit()
|
||||
}
|
||||
|
||||
void
|
||||
DecoderControl::CycleMixRamp()
|
||||
DecoderControl::CycleMixRamp() noexcept
|
||||
{
|
||||
previous_mix_ramp = std::move(mix_ramp);
|
||||
mix_ramp.Clear();
|
||||
|
@ -177,20 +177,20 @@ struct DecoderControl {
|
||||
*/
|
||||
DecoderControl(Mutex &_mutex, Cond &_client_cond,
|
||||
const AudioFormat _configured_audio_format,
|
||||
const ReplayGainConfig &_replay_gain_config);
|
||||
~DecoderControl();
|
||||
const ReplayGainConfig &_replay_gain_config) noexcept;
|
||||
~DecoderControl() noexcept;
|
||||
|
||||
/**
|
||||
* Locks the object.
|
||||
*/
|
||||
void Lock() const {
|
||||
void Lock() const noexcept {
|
||||
mutex.lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlocks the object.
|
||||
*/
|
||||
void Unlock() const {
|
||||
void Unlock() const noexcept {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ struct DecoderControl {
|
||||
* player thread. The object should be locked prior to
|
||||
* calling this function.
|
||||
*/
|
||||
void Signal() {
|
||||
void Signal() noexcept {
|
||||
cond.signal();
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ struct DecoderControl {
|
||||
* is only valid in the decoder thread. The object must be locked
|
||||
* prior to calling this function.
|
||||
*/
|
||||
void Wait() {
|
||||
void Wait() noexcept {
|
||||
cond.wait(mutex);
|
||||
}
|
||||
|
||||
@ -219,9 +219,9 @@ struct DecoderControl {
|
||||
*
|
||||
* Caller must hold the lock.
|
||||
*/
|
||||
void WaitForDecoder();
|
||||
void WaitForDecoder() noexcept;
|
||||
|
||||
bool IsIdle() const {
|
||||
bool IsIdle() const noexcept {
|
||||
return state == DecoderState::STOP ||
|
||||
state == DecoderState::ERROR;
|
||||
}
|
||||
@ -261,7 +261,7 @@ struct DecoderControl {
|
||||
* Caller must lock the object.
|
||||
*/
|
||||
void SetReady(const AudioFormat audio_format,
|
||||
bool _seekable, SignedSongTime _duration);
|
||||
bool _seekable, SignedSongTime _duration) noexcept;
|
||||
|
||||
/**
|
||||
* Checks whether an error has occurred, and if so, rethrows
|
||||
@ -290,7 +290,7 @@ struct DecoderControl {
|
||||
*
|
||||
* Caller must lock the object.
|
||||
*/
|
||||
void ClearError() {
|
||||
void ClearError() noexcept {
|
||||
if (state == DecoderState::ERROR) {
|
||||
error = std::exception_ptr();
|
||||
state = DecoderState::STOP;
|
||||
@ -320,7 +320,7 @@ private:
|
||||
* To be called from the client thread. Caller must lock the
|
||||
* object.
|
||||
*/
|
||||
void WaitCommandLocked() {
|
||||
void WaitCommandLocked() noexcept {
|
||||
while (command != DecoderCommand::NONE)
|
||||
WaitForDecoder();
|
||||
}
|
||||
@ -332,7 +332,7 @@ private:
|
||||
* To be called from the client thread. Caller must lock the
|
||||
* object.
|
||||
*/
|
||||
void SynchronousCommandLocked(DecoderCommand cmd) {
|
||||
void SynchronousCommandLocked(DecoderCommand cmd) noexcept {
|
||||
command = cmd;
|
||||
Signal();
|
||||
WaitCommandLocked();
|
||||
@ -345,13 +345,13 @@ private:
|
||||
* To be called from the client thread. This method locks the
|
||||
* object.
|
||||
*/
|
||||
void LockSynchronousCommand(DecoderCommand cmd) {
|
||||
void LockSynchronousCommand(DecoderCommand cmd) noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
ClearError();
|
||||
SynchronousCommandLocked(cmd);
|
||||
}
|
||||
|
||||
void LockAsynchronousCommand(DecoderCommand cmd) {
|
||||
void LockAsynchronousCommand(DecoderCommand cmd) noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
command = cmd;
|
||||
Signal();
|
||||
@ -365,7 +365,7 @@ public:
|
||||
* To be called from the decoder thread. Caller must lock the
|
||||
* mutex.
|
||||
*/
|
||||
void CommandFinishedLocked() {
|
||||
void CommandFinishedLocked() noexcept {
|
||||
assert(command != DecoderCommand::NONE);
|
||||
|
||||
command = DecoderCommand::NONE;
|
||||
@ -383,30 +383,30 @@ public:
|
||||
* the caller)
|
||||
*/
|
||||
void Start(DetachedSong *song, SongTime start_time, SongTime end_time,
|
||||
MusicBuffer &buffer, MusicPipe &pipe);
|
||||
MusicBuffer &buffer, MusicPipe &pipe) noexcept;
|
||||
|
||||
void Stop();
|
||||
void Stop() noexcept;
|
||||
|
||||
/**
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
void Seek(SongTime t);
|
||||
|
||||
void Quit();
|
||||
void Quit() noexcept;
|
||||
|
||||
const char *GetMixRampStart() const {
|
||||
const char *GetMixRampStart() const noexcept {
|
||||
return mix_ramp.GetStart();
|
||||
}
|
||||
|
||||
const char *GetMixRampEnd() const {
|
||||
const char *GetMixRampEnd() const noexcept {
|
||||
return mix_ramp.GetEnd();
|
||||
}
|
||||
|
||||
const char *GetMixRampPreviousEnd() const {
|
||||
const char *GetMixRampPreviousEnd() const noexcept {
|
||||
return previous_mix_ramp.GetEnd();
|
||||
}
|
||||
|
||||
void SetMixRamp(MixRampInfo &&new_value) {
|
||||
void SetMixRamp(MixRampInfo &&new_value) noexcept {
|
||||
mix_ramp = std::move(new_value);
|
||||
}
|
||||
|
||||
@ -414,10 +414,10 @@ public:
|
||||
* Move mixramp_end to mixramp_prev_end and clear
|
||||
* mixramp_start/mixramp_end.
|
||||
*/
|
||||
void CycleMixRamp();
|
||||
void CycleMixRamp() noexcept;
|
||||
|
||||
private:
|
||||
void RunThread();
|
||||
void RunThread() noexcept;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -514,7 +514,7 @@ try {
|
||||
}
|
||||
|
||||
void
|
||||
DecoderControl::RunThread()
|
||||
DecoderControl::RunThread() noexcept
|
||||
{
|
||||
SetThreadName("decoder");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user