[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.
This commit is contained in:
chme 2018-11-30 16:16:42 +01:00
parent f6ddec3389
commit fd84dd51b5

View File

@ -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);