DecoderThread: clear the pipe when handling late SEEK

See code comment.  Fixes assertion failure in
decoder_command_finished().
This commit is contained in:
Max Kellermann 2014-09-07 21:31:10 +02:00
parent 7ada7def9e
commit a6bb27483b
2 changed files with 12 additions and 1 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ ver 0.18.14 (not yet released)
- fix range parser bug on certain 32 bit architectures
* decoder
- audiofile: fix crash after seeking
- fix assertion failure after seeking
ver 0.18.13 (2014/08/31)
* protocol

View File

@ -26,6 +26,7 @@
#include "Song.hxx"
#include "system/FatalError.hxx"
#include "Mapper.hxx"
#include "MusicPipe.hxx"
#include "fs/Traits.hxx"
#include "fs/AllocatedPath.hxx"
#include "DecoderAPI.hxx"
@ -418,9 +419,18 @@ decoder_task(void *arg)
dc.replay_gain_prev_db = dc.replay_gain_db;
dc.replay_gain_db = 0;
/* fall through */
decoder_run(dc);
break;
case DecoderCommand::SEEK:
/* this seek was too late, and the decoder had
already finished; start a new decoder */
/* we need to clear the pipe here; usually the
PlayerThread is responsible, but it is not
aware that the decoder has finished */
dc.pipe->Clear(*dc.buffer);
decoder_run(dc);
break;