player/Control: initialize seek_time in EnqueueSongLocked()

Allows removing a few special cases in the player thread.
This commit is contained in:
Max Kellermann 2015-11-05 00:29:03 +01:00
parent cf1de78205
commit 990f473bb3
2 changed files with 3 additions and 6 deletions

View File

@ -417,6 +417,7 @@ private:
assert(next_song == nullptr);
next_song = song;
seek_time = SongTime::zero();
SynchronousCommand(PlayerCommand::QUEUE);
}

View File

@ -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();