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
4cd21f1e
Commit
4cd21f1e
authored
Nov 07, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Control: throw exception on Seek() error
parent
403f0f8c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
21 deletions
+18
-21
AllCommands.cxx
src/command/AllCommands.cxx
+0
-1
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+9
-15
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+4
-2
Thread.cxx
src/player/Thread.cxx
+5
-3
No files found.
src/command/AllCommands.cxx
View file @
4cd21f1e
...
...
@@ -362,7 +362,6 @@ CommandResult
command_process
(
Client
&
client
,
unsigned
num
,
char
*
line
)
try
{
Response
r
(
client
,
num
);
Error
error
;
/* get the command name (first word on the line) */
/* we have to set current_command because Response::Error()
...
...
src/decoder/DecoderControl.cxx
View file @
4cd21f1e
...
...
@@ -22,7 +22,8 @@
#include "DecoderError.hxx"
#include "MusicPipe.hxx"
#include "DetachedSong.hxx"
#include "util/Error.hxx"
#include <stdexcept>
#include <assert.h>
...
...
@@ -104,8 +105,8 @@ DecoderControl::Stop()
SynchronousCommandLocked
(
DecoderCommand
::
STOP
);
}
bool
DecoderControl
::
Seek
(
SongTime
t
,
Error
&
error_r
)
void
DecoderControl
::
Seek
(
SongTime
t
)
{
assert
(
state
!=
DecoderState
::
START
);
assert
(
state
!=
DecoderState
::
ERROR
);
...
...
@@ -118,28 +119,21 @@ DecoderControl::Seek(SongTime t, Error &error_r)
case
DecoderState
:
:
STOP
:
/* TODO: if this happens, the caller should be given a
chance to restart the decoder */
error_r
.
Set
(
decoder_domain
,
"Decoder is dead"
);
return
false
;
throw
std
::
runtime_error
(
"Decoder is dead"
);
case
DecoderState
:
:
DECODE
:
break
;
}
if
(
!
seekable
)
{
error_r
.
Set
(
decoder_domain
,
"Not seekable"
);
return
false
;
}
if
(
!
seekable
)
throw
std
::
runtime_error
(
"Not seekable"
);
seek_time
=
t
;
seek_error
=
false
;
LockSynchronousCommand
(
DecoderCommand
::
SEEK
);
if
(
seek_error
)
{
error_r
.
Set
(
decoder_domain
,
"Decoder failed to seek"
);
return
false
;
}
return
true
;
if
(
seek_error
)
throw
std
::
runtime_error
(
"Decoder failed to seek"
);
}
void
...
...
src/decoder/DecoderControl.hxx
View file @
4cd21f1e
...
...
@@ -40,7 +40,6 @@
#undef ERROR
#endif
class
Error
;
class
DetachedSong
;
class
MusicBuffer
;
class
MusicPipe
;
...
...
@@ -367,7 +366,10 @@ public:
void
Stop
();
bool
Seek
(
SongTime
t
,
Error
&
error_r
);
/**
* Throws #std::runtime_error on error.
*/
void
Seek
(
SongTime
t
);
void
Quit
();
...
...
src/player/Thread.cxx
View file @
4cd21f1e
...
...
@@ -618,10 +618,12 @@ Player::SeekDecoder()
where
=
total_time
;
}
Error
error
;
if
(
!
dc
.
Seek
(
where
+
start_time
,
error
))
{
try
{
dc
.
Seek
(
where
+
start_time
);
}
catch
(...)
{
/* decoder failure */
pc
.
SetError
(
PlayerError
::
DECODER
,
std
::
move
(
error
));
pc
.
SetError
(
PlayerError
::
DECODER
,
std
::
current_exception
());
pc
.
LockCommandFinished
();
return
false
;
}
...
...
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