From fd84dd51b524f672fee188bc718a557ffa60ff66 Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 30 Nov 2018 16:16:42 +0100 Subject: [PATCH] [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);