player/Thread: call DecoderCommand::SEEK only on existing decoder
If the decoder was just started, it already seeks to the desired position.
This commit is contained in:
parent
30cad0c5f1
commit
3b71e2abef
@ -575,6 +575,9 @@ Player::SeekDecoder()
|
|||||||
/* re-start the decoder */
|
/* re-start the decoder */
|
||||||
StartDecoder(*pipe);
|
StartDecoder(*pipe);
|
||||||
ActivateDecoder();
|
ActivateDecoder();
|
||||||
|
|
||||||
|
if (!WaitDecoderStartup())
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!IsDecoderAtCurrentSong()) {
|
if (!IsDecoderAtCurrentSong()) {
|
||||||
/* the decoder is already decoding the "next" song,
|
/* the decoder is already decoding the "next" song,
|
||||||
@ -585,30 +588,32 @@ Player::SeekDecoder()
|
|||||||
delete pc.next_song;
|
delete pc.next_song;
|
||||||
pc.next_song = nullptr;
|
pc.next_song = nullptr;
|
||||||
queued = false;
|
queued = false;
|
||||||
|
|
||||||
|
/* wait for the decoder to complete initialization
|
||||||
|
(just in case that happens to be still in
|
||||||
|
progress) */
|
||||||
|
|
||||||
|
if (!WaitDecoderStartup())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dc.Seek(where + start_time)) {
|
||||||
|
/* decoder failure */
|
||||||
|
pc.LockCommandFinished();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed_time = where;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for the decoder to complete initialization */
|
|
||||||
|
|
||||||
if (!WaitDecoderStartup())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dc.Seek(where + start_time)) {
|
|
||||||
/* decoder failure */
|
|
||||||
pc.LockCommandFinished();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
elapsed_time = where;
|
|
||||||
|
|
||||||
pc.LockCommandFinished();
|
pc.LockCommandFinished();
|
||||||
|
|
||||||
assert(xfade_state == CrossFadeState::UNKNOWN);
|
assert(xfade_state == CrossFadeState::UNKNOWN);
|
||||||
|
Loading…
Reference in New Issue
Block a user