Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
9a8a3bea
Commit
9a8a3bea
authored
Nov 26, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Control: add "noexcept"
parent
2a774a1f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
33 deletions
+33
-33
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+8
-8
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+24
-24
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+1
-1
No files found.
src/decoder/DecoderControl.cxx
View file @
9a8a3bea
...
@@ -29,13 +29,13 @@
...
@@ -29,13 +29,13 @@
DecoderControl
::
DecoderControl
(
Mutex
&
_mutex
,
Cond
&
_client_cond
,
DecoderControl
::
DecoderControl
(
Mutex
&
_mutex
,
Cond
&
_client_cond
,
const
AudioFormat
_configured_audio_format
,
const
AudioFormat
_configured_audio_format
,
const
ReplayGainConfig
&
_replay_gain_config
)
const
ReplayGainConfig
&
_replay_gain_config
)
noexcept
:
thread
(
BIND_THIS_METHOD
(
RunThread
)),
:
thread
(
BIND_THIS_METHOD
(
RunThread
)),
mutex
(
_mutex
),
client_cond
(
_client_cond
),
mutex
(
_mutex
),
client_cond
(
_client_cond
),
configured_audio_format
(
_configured_audio_format
),
configured_audio_format
(
_configured_audio_format
),
replay_gain_config
(
_replay_gain_config
)
{}
replay_gain_config
(
_replay_gain_config
)
{}
DecoderControl
::~
DecoderControl
()
DecoderControl
::~
DecoderControl
()
noexcept
{
{
ClearError
();
ClearError
();
...
@@ -43,7 +43,7 @@ DecoderControl::~DecoderControl()
...
@@ -43,7 +43,7 @@ DecoderControl::~DecoderControl()
}
}
void
void
DecoderControl
::
WaitForDecoder
()
DecoderControl
::
WaitForDecoder
()
noexcept
{
{
assert
(
!
client_is_waiting
);
assert
(
!
client_is_waiting
);
client_is_waiting
=
true
;
client_is_waiting
=
true
;
...
@@ -56,7 +56,7 @@ DecoderControl::WaitForDecoder()
...
@@ -56,7 +56,7 @@ DecoderControl::WaitForDecoder()
void
void
DecoderControl
::
SetReady
(
const
AudioFormat
audio_format
,
DecoderControl
::
SetReady
(
const
AudioFormat
audio_format
,
bool
_seekable
,
SignedSongTime
_duration
)
bool
_seekable
,
SignedSongTime
_duration
)
noexcept
{
{
assert
(
state
==
DecoderState
::
START
);
assert
(
state
==
DecoderState
::
START
);
assert
(
pipe
!=
nullptr
);
assert
(
pipe
!=
nullptr
);
...
@@ -94,7 +94,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const noexcept
...
@@ -94,7 +94,7 @@ DecoderControl::IsCurrentSong(const DetachedSong &_song) const noexcept
void
void
DecoderControl
::
Start
(
DetachedSong
*
_song
,
DecoderControl
::
Start
(
DetachedSong
*
_song
,
SongTime
_start_time
,
SongTime
_end_time
,
SongTime
_start_time
,
SongTime
_end_time
,
MusicBuffer
&
_buffer
,
MusicPipe
&
_pipe
)
MusicBuffer
&
_buffer
,
MusicPipe
&
_pipe
)
noexcept
{
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
@@ -113,7 +113,7 @@ DecoderControl::Start(DetachedSong *_song,
...
@@ -113,7 +113,7 @@ DecoderControl::Start(DetachedSong *_song,
}
}
void
void
DecoderControl
::
Stop
()
DecoderControl
::
Stop
()
noexcept
{
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
@@ -162,7 +162,7 @@ DecoderControl::Seek(SongTime t)
...
@@ -162,7 +162,7 @@ DecoderControl::Seek(SongTime t)
}
}
void
void
DecoderControl
::
Quit
()
DecoderControl
::
Quit
()
noexcept
{
{
assert
(
thread
.
IsDefined
());
assert
(
thread
.
IsDefined
());
...
@@ -173,7 +173,7 @@ DecoderControl::Quit()
...
@@ -173,7 +173,7 @@ DecoderControl::Quit()
}
}
void
void
DecoderControl
::
CycleMixRamp
()
DecoderControl
::
CycleMixRamp
()
noexcept
{
{
previous_mix_ramp
=
std
::
move
(
mix_ramp
);
previous_mix_ramp
=
std
::
move
(
mix_ramp
);
mix_ramp
.
Clear
();
mix_ramp
.
Clear
();
...
...
src/decoder/DecoderControl.hxx
View file @
9a8a3bea
...
@@ -177,20 +177,20 @@ struct DecoderControl {
...
@@ -177,20 +177,20 @@ struct DecoderControl {
*/
*/
DecoderControl
(
Mutex
&
_mutex
,
Cond
&
_client_cond
,
DecoderControl
(
Mutex
&
_mutex
,
Cond
&
_client_cond
,
const
AudioFormat
_configured_audio_format
,
const
AudioFormat
_configured_audio_format
,
const
ReplayGainConfig
&
_replay_gain_config
);
const
ReplayGainConfig
&
_replay_gain_config
)
noexcept
;
~
DecoderControl
();
~
DecoderControl
()
noexcept
;
/**
/**
* Locks the object.
* Locks the object.
*/
*/
void
Lock
()
const
{
void
Lock
()
const
noexcept
{
mutex
.
lock
();
mutex
.
lock
();
}
}
/**
/**
* Unlocks the object.
* Unlocks the object.
*/
*/
void
Unlock
()
const
{
void
Unlock
()
const
noexcept
{
mutex
.
unlock
();
mutex
.
unlock
();
}
}
...
@@ -199,7 +199,7 @@ struct DecoderControl {
...
@@ -199,7 +199,7 @@ struct DecoderControl {
* player thread. The object should be locked prior to
* player thread. The object should be locked prior to
* calling this function.
* calling this function.
*/
*/
void
Signal
()
{
void
Signal
()
noexcept
{
cond
.
signal
();
cond
.
signal
();
}
}
...
@@ -208,7 +208,7 @@ struct DecoderControl {
...
@@ -208,7 +208,7 @@ struct DecoderControl {
* is only valid in the decoder thread. The object must be locked
* is only valid in the decoder thread. The object must be locked
* prior to calling this function.
* prior to calling this function.
*/
*/
void
Wait
()
{
void
Wait
()
noexcept
{
cond
.
wait
(
mutex
);
cond
.
wait
(
mutex
);
}
}
...
@@ -219,9 +219,9 @@ struct DecoderControl {
...
@@ -219,9 +219,9 @@ struct DecoderControl {
*
*
* Caller must hold the lock.
* Caller must hold the lock.
*/
*/
void
WaitForDecoder
();
void
WaitForDecoder
()
noexcept
;
bool
IsIdle
()
const
{
bool
IsIdle
()
const
noexcept
{
return
state
==
DecoderState
::
STOP
||
return
state
==
DecoderState
::
STOP
||
state
==
DecoderState
::
ERROR
;
state
==
DecoderState
::
ERROR
;
}
}
...
@@ -261,7 +261,7 @@ struct DecoderControl {
...
@@ -261,7 +261,7 @@ struct DecoderControl {
* Caller must lock the object.
* Caller must lock the object.
*/
*/
void
SetReady
(
const
AudioFormat
audio_format
,
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
* Checks whether an error has occurred, and if so, rethrows
...
@@ -290,7 +290,7 @@ struct DecoderControl {
...
@@ -290,7 +290,7 @@ struct DecoderControl {
*
*
* Caller must lock the object.
* Caller must lock the object.
*/
*/
void
ClearError
()
{
void
ClearError
()
noexcept
{
if
(
state
==
DecoderState
::
ERROR
)
{
if
(
state
==
DecoderState
::
ERROR
)
{
error
=
std
::
exception_ptr
();
error
=
std
::
exception_ptr
();
state
=
DecoderState
::
STOP
;
state
=
DecoderState
::
STOP
;
...
@@ -320,7 +320,7 @@ private:
...
@@ -320,7 +320,7 @@ private:
* To be called from the client thread. Caller must lock the
* To be called from the client thread. Caller must lock the
* object.
* object.
*/
*/
void
WaitCommandLocked
()
{
void
WaitCommandLocked
()
noexcept
{
while
(
command
!=
DecoderCommand
::
NONE
)
while
(
command
!=
DecoderCommand
::
NONE
)
WaitForDecoder
();
WaitForDecoder
();
}
}
...
@@ -332,7 +332,7 @@ private:
...
@@ -332,7 +332,7 @@ private:
* To be called from the client thread. Caller must lock the
* To be called from the client thread. Caller must lock the
* object.
* object.
*/
*/
void
SynchronousCommandLocked
(
DecoderCommand
cmd
)
{
void
SynchronousCommandLocked
(
DecoderCommand
cmd
)
noexcept
{
command
=
cmd
;
command
=
cmd
;
Signal
();
Signal
();
WaitCommandLocked
();
WaitCommandLocked
();
...
@@ -345,13 +345,13 @@ private:
...
@@ -345,13 +345,13 @@ private:
* To be called from the client thread. This method locks the
* To be called from the client thread. This method locks the
* object.
* object.
*/
*/
void
LockSynchronousCommand
(
DecoderCommand
cmd
)
{
void
LockSynchronousCommand
(
DecoderCommand
cmd
)
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
ClearError
();
ClearError
();
SynchronousCommandLocked
(
cmd
);
SynchronousCommandLocked
(
cmd
);
}
}
void
LockAsynchronousCommand
(
DecoderCommand
cmd
)
{
void
LockAsynchronousCommand
(
DecoderCommand
cmd
)
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
command
=
cmd
;
command
=
cmd
;
Signal
();
Signal
();
...
@@ -365,7 +365,7 @@ public:
...
@@ -365,7 +365,7 @@ public:
* To be called from the decoder thread. Caller must lock the
* To be called from the decoder thread. Caller must lock the
* mutex.
* mutex.
*/
*/
void
CommandFinishedLocked
()
{
void
CommandFinishedLocked
()
noexcept
{
assert
(
command
!=
DecoderCommand
::
NONE
);
assert
(
command
!=
DecoderCommand
::
NONE
);
command
=
DecoderCommand
::
NONE
;
command
=
DecoderCommand
::
NONE
;
...
@@ -383,30 +383,30 @@ public:
...
@@ -383,30 +383,30 @@ public:
* the caller)
* the caller)
*/
*/
void
Start
(
DetachedSong
*
song
,
SongTime
start_time
,
SongTime
end_time
,
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.
* Throws #std::runtime_error on error.
*/
*/
void
Seek
(
SongTime
t
);
void
Seek
(
SongTime
t
);
void
Quit
();
void
Quit
()
noexcept
;
const
char
*
GetMixRampStart
()
const
{
const
char
*
GetMixRampStart
()
const
noexcept
{
return
mix_ramp
.
GetStart
();
return
mix_ramp
.
GetStart
();
}
}
const
char
*
GetMixRampEnd
()
const
{
const
char
*
GetMixRampEnd
()
const
noexcept
{
return
mix_ramp
.
GetEnd
();
return
mix_ramp
.
GetEnd
();
}
}
const
char
*
GetMixRampPreviousEnd
()
const
{
const
char
*
GetMixRampPreviousEnd
()
const
noexcept
{
return
previous_mix_ramp
.
GetEnd
();
return
previous_mix_ramp
.
GetEnd
();
}
}
void
SetMixRamp
(
MixRampInfo
&&
new_value
)
{
void
SetMixRamp
(
MixRampInfo
&&
new_value
)
noexcept
{
mix_ramp
=
std
::
move
(
new_value
);
mix_ramp
=
std
::
move
(
new_value
);
}
}
...
@@ -414,10 +414,10 @@ public:
...
@@ -414,10 +414,10 @@ public:
* Move mixramp_end to mixramp_prev_end and clear
* Move mixramp_end to mixramp_prev_end and clear
* mixramp_start/mixramp_end.
* mixramp_start/mixramp_end.
*/
*/
void
CycleMixRamp
();
void
CycleMixRamp
()
noexcept
;
private
:
private
:
void
RunThread
();
void
RunThread
()
noexcept
;
};
};
#endif
#endif
src/decoder/DecoderThread.cxx
View file @
9a8a3bea
...
@@ -514,7 +514,7 @@ try {
...
@@ -514,7 +514,7 @@ try {
}
}
void
void
DecoderControl
::
RunThread
()
DecoderControl
::
RunThread
()
noexcept
{
{
SetThreadName
(
"decoder"
);
SetThreadName
(
"decoder"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment