aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-28 18:24:42 +0100
committerMax Kellermann <max@duempel.org>2015-10-28 18:24:42 +0100
commitcf1de782051ec0be5db1076c9fefb2e9df09048f (patch)
treeacc331956b03cf1d0b204a70fda29190f9392de6
parentccea6dd74bb598881c7dddc2d278583fecbaeca5 (diff)
downloadmpd-cf1de782051ec0be5db1076c9fefb2e9df09048f.tar.gz
mpd-cf1de782051ec0be5db1076c9fefb2e9df09048f.tar.xz
mpd-cf1de782051ec0be5db1076c9fefb2e9df09048f.zip
player/Thread: remove decoder error check from ActivateDecoder()
It is futile to check for decoder errors before the decoder has finished startup. At this time, it's unlikely that the decoder has already failed.
-rw-r--r--src/player/Thread.cxx45
1 files changed, 8 insertions, 37 deletions
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index 9c90e56c6..993bcfedf 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -260,7 +260,7 @@ private:
*
* The player lock is not held.
*/
- bool ActivateDecoder();
+ void ActivateDecoder();
/**
* Wrapper for MultipleOutputs::Open(). Upon failure, it
@@ -298,10 +298,8 @@ private:
* sending chunks from the next one.
*
* The player lock is not held.
- *
- * @return true on success, false on error (playback will be stopped)
*/
- bool SongBorder();
+ void SongBorder();
public:
/*
@@ -369,7 +367,7 @@ Player::ForwardDecoderError()
return true;
}
-bool
+void
Player::ActivateDecoder()
{
assert(queued || pc.command == PlayerCommand::SEEK);
@@ -378,16 +376,6 @@ Player::ActivateDecoder()
queued = false;
pc.Lock();
-
- if (!ForwardDecoderError()) {
- delete pc.next_song;
- pc.next_song = nullptr;
-
- pc.Unlock();
-
- return false;
- }
-
pc.ClearTaggedSong();
delete song;
@@ -409,8 +397,6 @@ Player::ActivateDecoder()
/* call syncPlaylistWithQueue() in the main thread */
pc.listener.OnPlayerSync();
-
- return true;
}
/**
@@ -579,11 +565,7 @@ Player::SeekDecoder()
/* re-start the decoder */
StartDecoder(*pipe);
- if (!ActivateDecoder()) {
- /* decoder failure */
- player_command_finished(pc);
- return false;
- }
+ ActivateDecoder();
} else {
if (!IsDecoderAtCurrentSong()) {
/* the decoder is already decoding the "next" song,
@@ -933,7 +915,7 @@ Player::PlayNextChunk()
return true;
}
-inline bool
+inline void
Player::SongBorder()
{
FormatDefault(player_domain, "played \"%s\"", song->GetURI());
@@ -942,8 +924,7 @@ Player::SongBorder()
pc.outputs.SongBorder();
- if (!ActivateDecoder())
- return false;
+ ActivateDecoder();
pc.Lock();
@@ -957,8 +938,6 @@ Player::SongBorder()
if (border_pause)
idle_add(IDLE_PLAYER);
-
- return true;
}
inline void
@@ -967,14 +946,7 @@ Player::Run()
pipe = new MusicPipe();
StartDecoder(*pipe);
- if (!ActivateDecoder()) {
- assert(song == nullptr);
-
- StopDecoder();
- player_command_finished(pc);
- delete pipe;
- return;
- }
+ ActivateDecoder();
pc.Lock();
pc.state = PlayerState::PLAY;
@@ -1101,8 +1073,7 @@ Player::Run()
} else if (IsDecoderAtNextSong()) {
/* at the beginning of a new song */
- if (!SongBorder())
- break;
+ SongBorder();
} else if (dc.LockIsIdle()) {
/* check the size of the pipe again, because
the decoder thread may have added something