From 3c2ff294a1408e5441ab279b66ea0d611d29f40d Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Mon, 25 Feb 2019 22:47:37 +0100 Subject: [PATCH] [player] Fix rewind problem where quality level was lost by player + remember to flush in source_start(), since the input won't do it if input_now_reading has already been closed (e.g. if starting a new track while playback is at the end of another track) --- src/player.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/player.c b/src/player.c index 581a065a..8b349684 100644 --- a/src/player.c +++ b/src/player.c @@ -712,11 +712,15 @@ source_next(void) static int source_start(void) { + short flags; + if (!pb_session.reading_next) return 0; DPRINTF(E_DBG, L_PLAYER, "(Re)opening track: '%s' (id=%d, seek=%d)\n", pb_session.reading_next->path, pb_session.reading_next->item_id, pb_session.reading_next->seek_ms); + input_flush(&flags); + return input_seek(pb_session.reading_next->item_id, (int)pb_session.reading_next->seek_ms); } @@ -829,7 +833,7 @@ session_update_read_eof(void) return; // We inherit this because the input will only notify on quality changes, not - // if it the same as the previous track + // if it is the same as the previous track pb_session.reading_now->quality = pb_session.reading_prev->quality; pb_session.reading_now->output_buffer_samples = pb_session.reading_prev->output_buffer_samples; @@ -1110,6 +1114,7 @@ source_read(int *nbytes, int *nsamples, struct media_quality *quality, uint8_t * if (*nbytes == 0 || quality->channels == 0) { event_read(0); // This will set start_ts even if source isn't open yet + event_read_quality(); // Will poll input for quality since we don't have it return 0; }