From f6ddec3389d81b2f82d71f22b2ba78226203281e Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 30 Nov 2018 15:41:28 +0100 Subject: [PATCH 1/2] [player] On pause the current streaming item needs to be stopped, if it is not the current playing item. This happens if the input already switched to the next item in the queue starting to stream it to the outputs (2 second buffer) while the outputs are still playing the last seconds of the old item. --- src/player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/player.c b/src/player.c index 63e88e34..9a0ee1c4 100644 --- a/src/player.c +++ b/src/player.c @@ -593,7 +593,7 @@ source_pause(uint64_t pos) if (!ps_playing) return -1; - if (cur_streaming && (cur_streaming == ps_playing)) + if (cur_streaming) { if (ps_playing != cur_streaming) { From fd84dd51b524f672fee188bc718a557ffa60ff66 Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 30 Nov 2018 16:16:42 +0100 Subject: [PATCH 2/2] [player] Do not abort if pausing a stream or pipe playback Instead we stop reading from the source and check on playback resume if the source needs to be reopened. --- src/player.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/player.c b/src/player.c index 9a0ee1c4..dfcdeafb 100644 --- a/src/player.c +++ b/src/player.c @@ -2003,6 +2003,19 @@ playback_start_item(void *arg, int *retval) // Resume playback of current source ps = source_now_playing(); DPRINTF(E_DBG, L_PLAYER, "Resume playback of '%s' (id=%d, item-id=%d)\n", ps->path, ps->id, ps->item_id); + + // Check if source needs to be reopend + if (!ps->setup_done) + { + DPRINTF(E_INFO, L_PLAYER, "Opening '%s'\n", ps->path); + + ret = input_setup(ps); + if (ret < 0) + { + DPRINTF(E_LOG, L_PLAYER, "Failed to open '%s'\n", ps->path); + return -1; + } + } } else { @@ -2330,10 +2343,11 @@ playback_pause_bh(void *arg, int *retval) if (cur_streaming->data_kind == DATA_KIND_HTTP || cur_streaming->data_kind == DATA_KIND_PIPE) { - DPRINTF(E_DBG, L_PLAYER, "Source is not pausable, abort playback\n"); + // For stream and pipe input we stop reading from the source but still switch to the paused state. + // (Resuming playback will reopen the source) + DPRINTF(E_DBG, L_PLAYER, "Source is not pausable, stop playback\n"); - playback_abort(); - return COMMAND_END; + input_stop(cur_streaming); } status_update(PLAY_PAUSED);