diff options
author | Max Kellermann <max@duempel.org> | 2015-11-05 00:41:54 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-11-05 00:41:54 +0100 |
commit | 3b71e2abefd50dbb6548712f13aea28701e72317 (patch) | |
tree | c4b56f0eb5d3f431a52a7ff0cd44a7a6110c5ad9 | |
parent | 30cad0c5f1db1363dd2225598e2e2b4237cf537b (diff) | |
download | mpd-3b71e2abefd50dbb6548712f13aea28701e72317.tar.gz mpd-3b71e2abefd50dbb6548712f13aea28701e72317.tar.xz mpd-3b71e2abefd50dbb6548712f13aea28701e72317.zip |
player/Thread: call DecoderCommand::SEEK only on existing decoder
If the decoder was just started, it already seeks to the desired
position.
Diffstat (limited to '')
-rw-r--r-- | src/player/Thread.cxx | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 7a9715f1b..9a5732ada 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -575,6 +575,9 @@ Player::SeekDecoder() /* re-start the decoder */ StartDecoder(*pipe); ActivateDecoder(); + + if (!WaitDecoderStartup()) + return false; } else { if (!IsDecoderAtCurrentSong()) { /* the decoder is already decoding the "next" song, @@ -585,29 +588,31 @@ Player::SeekDecoder() delete pc.next_song; pc.next_song = nullptr; queued = false; - } - /* wait for the decoder to complete initialization */ + /* wait for the decoder to complete initialization + (just in case that happens to be still in + progress) */ - if (!WaitDecoderStartup()) - return false; + if (!WaitDecoderStartup()) + return false; - /* send the SEEK command */ + /* send the SEEK command */ - SongTime where = pc.seek_time; - if (!pc.total_time.IsNegative()) { - const SongTime total_time(pc.total_time); - if (where > total_time) - where = total_time; - } + SongTime where = pc.seek_time; + if (!pc.total_time.IsNegative()) { + const SongTime total_time(pc.total_time); + if (where > total_time) + where = total_time; + } - if (!dc.Seek(where + start_time)) { - /* decoder failure */ - pc.LockCommandFinished(); - return false; - } + if (!dc.Seek(where + start_time)) { + /* decoder failure */ + pc.LockCommandFinished(); + return false; + } - elapsed_time = where; + elapsed_time = where; + } pc.LockCommandFinished(); |