aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-05 00:29:03 +0100
committerMax Kellermann <max@duempel.org>2015-11-05 00:29:03 +0100
commit990f473bb3b590de34931c9dfa485e2a33d832fd (patch)
tree2e3b6f486a9907477776d14c34be0e047af93556
parentcf1de782051ec0be5db1076c9fefb2e9df09048f (diff)
downloadmpd-990f473bb3b590de34931c9dfa485e2a33d832fd.tar.gz
mpd-990f473bb3b590de34931c9dfa485e2a33d832fd.tar.xz
mpd-990f473bb3b590de34931c9dfa485e2a33d832fd.zip
player/Control: initialize seek_time in EnqueueSongLocked()
Allows removing a few special cases in the player thread.
-rw-r--r--src/player/Control.hxx1
-rw-r--r--src/player/Thread.cxx8
2 files changed, 3 insertions, 6 deletions
diff --git a/src/player/Control.hxx b/src/player/Control.hxx
index a2807a9a1..2b15e89d8 100644
--- a/src/player/Control.hxx
+++ b/src/player/Control.hxx
@@ -417,6 +417,7 @@ private:
assert(next_song == nullptr);
next_song = song;
+ seek_time = SongTime::zero();
SynchronousCommand(PlayerCommand::QUEUE);
}
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index 993bcfedf..b251cddfb 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -324,9 +324,7 @@ Player::StartDecoder(MusicPipe &_pipe)
assert(queued || pc.command == PlayerCommand::SEEK);
assert(pc.next_song != nullptr);
- SongTime start_time = pc.next_song->GetStartTime();
- if (pc.command == PlayerCommand::SEEK)
- start_time += pc.seek_time;
+ SongTime start_time = pc.next_song->GetStartTime() + pc.seek_time;
dc.Start(new DetachedSong(*pc.next_song),
start_time, pc.next_song->GetEndTime(),
@@ -950,9 +948,7 @@ Player::Run()
pc.Lock();
pc.state = PlayerState::PLAY;
-
- if (pc.command == PlayerCommand::SEEK)
- elapsed_time = pc.seek_time;
+ elapsed_time = pc.seek_time;
pc.CommandFinished();