player/Thread: don't restart unseekable song after failed seek attempt
The check IsSeekableCurrentSong() was added by commit
44b200240f
in version 0.20.19, but it
caused a regression: by doing the branch only if the current song is
seekable, the player would restart the current song if it was not
seekable, and later the initial seek would fail; but we already know
it's not seekable, and so we should fail early.
This commit is contained in:
parent
9661062ae2
commit
f2d8fd769d
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ ver 0.21.12 (not yet released)
|
||||||
- opus, vorbis: decode the "end of stream" packet
|
- opus, vorbis: decode the "end of stream" packet
|
||||||
* output
|
* output
|
||||||
- jack: fix mono-to-stereo conversion
|
- jack: fix mono-to-stereo conversion
|
||||||
|
* player
|
||||||
|
- don't restart unseekable song after failed seek attempt
|
||||||
* Windows
|
* Windows
|
||||||
- support backslash in relative URIs loaded from playlists
|
- support backslash in relative URIs loaded from playlists
|
||||||
|
|
||||||
|
|
|
@ -320,6 +320,11 @@ public:
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool IsCurrentSong(const DetachedSong &_song) const noexcept;
|
bool IsCurrentSong(const DetachedSong &_song) const noexcept;
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
|
bool IsUnseekableCurrentSong(const DetachedSong &_song) const noexcept {
|
||||||
|
return !seekable && IsCurrentSong(_song);
|
||||||
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool IsSeekableCurrentSong(const DetachedSong &_song) const noexcept {
|
bool IsSeekableCurrentSong(const DetachedSong &_song) const noexcept {
|
||||||
return seekable && IsCurrentSong(_song);
|
return seekable && IsCurrentSong(_song);
|
||||||
|
|
|
@ -599,6 +599,19 @@ Player::SeekDecoder() noexcept
|
||||||
{
|
{
|
||||||
assert(pc.next_song != nullptr);
|
assert(pc.next_song != nullptr);
|
||||||
|
|
||||||
|
if (pc.seek_time > SongTime::zero() && // TODO: allow this only if the song duration is known
|
||||||
|
dc.IsUnseekableCurrentSong(*pc.next_song)) {
|
||||||
|
/* seeking into the current song; but we already know
|
||||||
|
it's not seekable, so let's fail early */
|
||||||
|
/* note the seek_time>0 check: if seeking to the
|
||||||
|
beginning, we can simply restart the decoder */
|
||||||
|
pc.next_song.reset();
|
||||||
|
pc.SetError(PlayerError::DECODER,
|
||||||
|
std::make_exception_ptr(std::runtime_error("Not seekable")));
|
||||||
|
pc.CommandFinished();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
CancelPendingSeek();
|
CancelPendingSeek();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue