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
78ec7d0f
Commit
78ec7d0f
authored
Sep 08, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Thread: throw StopDecoder on DecoderCommand::STOP
parent
a1e9678b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+5
-8
No files found.
src/decoder/DecoderThread.cxx
View file @
78ec7d0f
...
@@ -49,14 +49,11 @@ static constexpr Domain decoder_thread_domain("decoder_thread");
...
@@ -49,14 +49,11 @@ static constexpr Domain decoder_thread_domain("decoder_thread");
/**
/**
* Opens the input stream with InputStream::Open(), and waits until
* Opens the input stream with InputStream::Open(), and waits until
* the stream gets ready. If a decoder STOP command is received
* the stream gets ready.
* during that, it cancels the operation (but does not close the
* stream).
*
*
* Unlock the decoder before calling this function.
* Unlock the decoder before calling this function.
*
*
* @return an InputStream on success or if #DecoderCommand::STOP is
* @return an InputStream on success, nullptr on error
* received, nullptr on error
*/
*/
static
InputStreamPtr
static
InputStreamPtr
decoder_input_stream_open
(
DecoderControl
&
dc
,
const
char
*
uri
,
Error
&
error
)
decoder_input_stream_open
(
DecoderControl
&
dc
,
const
char
*
uri
,
Error
&
error
)
...
@@ -73,7 +70,7 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri, Error &error)
...
@@ -73,7 +70,7 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri, Error &error)
is
->
Update
();
is
->
Update
();
while
(
!
is
->
IsReady
())
{
while
(
!
is
->
IsReady
())
{
if
(
dc
.
command
==
DecoderCommand
::
STOP
)
if
(
dc
.
command
==
DecoderCommand
::
STOP
)
return
nullptr
;
throw
StopDecoder
()
;
dc
.
Wait
();
dc
.
Wait
();
...
@@ -117,7 +114,7 @@ decoder_stream_decode(const DecoderPlugin &plugin,
...
@@ -117,7 +114,7 @@ decoder_stream_decode(const DecoderPlugin &plugin,
FormatDebug
(
decoder_thread_domain
,
"probing plugin %s"
,
plugin
.
name
);
FormatDebug
(
decoder_thread_domain
,
"probing plugin %s"
,
plugin
.
name
);
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
return
true
;
throw
StopDecoder
()
;
/* rewind the stream, so each plugin gets a fresh start */
/* rewind the stream, so each plugin gets a fresh start */
input_stream
.
Rewind
(
IgnoreError
());
input_stream
.
Rewind
(
IgnoreError
());
...
@@ -157,7 +154,7 @@ decoder_file_decode(const DecoderPlugin &plugin,
...
@@ -157,7 +154,7 @@ decoder_file_decode(const DecoderPlugin &plugin,
FormatDebug
(
decoder_thread_domain
,
"probing plugin %s"
,
plugin
.
name
);
FormatDebug
(
decoder_thread_domain
,
"probing plugin %s"
,
plugin
.
name
);
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
return
true
;
throw
StopDecoder
()
;
{
{
const
ScopeUnlock
unlock
(
decoder
.
dc
.
mutex
);
const
ScopeUnlock
unlock
(
decoder
.
dc
.
mutex
);
...
...
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