Commit 990f473b authored by Max Kellermann's avatar Max Kellermann

player/Control: initialize seek_time in EnqueueSongLocked()

Allows removing a few special cases in the player thread.
parent cf1de782
...@@ -417,6 +417,7 @@ private: ...@@ -417,6 +417,7 @@ private:
assert(next_song == nullptr); assert(next_song == nullptr);
next_song = song; next_song = song;
seek_time = SongTime::zero();
SynchronousCommand(PlayerCommand::QUEUE); SynchronousCommand(PlayerCommand::QUEUE);
} }
......
...@@ -324,9 +324,7 @@ Player::StartDecoder(MusicPipe &_pipe) ...@@ -324,9 +324,7 @@ Player::StartDecoder(MusicPipe &_pipe)
assert(queued || pc.command == PlayerCommand::SEEK); assert(queued || pc.command == PlayerCommand::SEEK);
assert(pc.next_song != nullptr); assert(pc.next_song != nullptr);
SongTime start_time = pc.next_song->GetStartTime(); SongTime start_time = pc.next_song->GetStartTime() + pc.seek_time;
if (pc.command == PlayerCommand::SEEK)
start_time += pc.seek_time;
dc.Start(new DetachedSong(*pc.next_song), dc.Start(new DetachedSong(*pc.next_song),
start_time, pc.next_song->GetEndTime(), start_time, pc.next_song->GetEndTime(),
...@@ -950,9 +948,7 @@ Player::Run() ...@@ -950,9 +948,7 @@ Player::Run()
pc.Lock(); pc.Lock();
pc.state = PlayerState::PLAY; pc.state = PlayerState::PLAY;
elapsed_time = pc.seek_time;
if (pc.command == PlayerCommand::SEEK)
elapsed_time = pc.seek_time;
pc.CommandFinished(); pc.CommandFinished();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment