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
322bfbaf
Commit
322bfbaf
authored
Nov 21, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/API: simplify the client==nullptr code path in decoder_read()
parent
2718f4c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+10
-18
No files found.
src/decoder/DecoderAPI.cxx
View file @
322bfbaf
...
...
@@ -256,37 +256,29 @@ DecoderBridge::OpenUri(const char *uri)
}
}
/**
* Should be read operation be cancelled? That is the case when the
* player thread has sent a command such as "STOP".
*/
gcc_pure
static
inline
bool
decoder_check_cancel_read
(
const
DecoderBridge
*
bridge
)
{
return
bridge
!=
nullptr
&&
bridge
->
CheckCancelRead
();
}
size_t
decoder_read
(
DecoderClient
*
client
,
InputStream
&
is
,
void
*
buffer
,
size_t
length
)
try
{
/* XXX don't allow decoder==nullptr */
auto
*
bridge
=
(
DecoderBridge
*
)
client
;
assert
(
bridge
==
nullptr
||
bridge
->
dc
.
state
==
DecoderState
::
START
||
bridge
->
dc
.
state
==
DecoderState
::
DECODE
);
assert
(
buffer
!=
nullptr
);
/* XXX don't allow client==nullptr */
if
(
client
==
nullptr
)
return
is
.
LockRead
(
buffer
,
length
);
auto
&
bridge
=
*
(
DecoderBridge
*
)
client
;
assert
(
bridge
.
dc
.
state
==
DecoderState
::
START
||
bridge
.
dc
.
state
==
DecoderState
::
DECODE
);
if
(
length
==
0
)
return
0
;
ScopeLock
lock
(
is
.
mutex
);
while
(
true
)
{
if
(
decoder_check_cancel_read
(
bridge
))
if
(
bridge
.
CheckCancelRead
(
))
return
0
;
if
(
is
.
IsAvailable
())
...
...
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