mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 06:33:21 -05:00
[player] Prevent crash if output is failed and triggers a playback_abort
when a pause or seek is requested
This commit is contained in:
parent
b9e069939e
commit
544791ef59
20
src/player.c
20
src/player.c
@ -2240,15 +2240,17 @@ playback_seek_bh(void *arg, int *retval)
|
||||
int ms;
|
||||
int ret;
|
||||
|
||||
*retval = -1;
|
||||
|
||||
if (!cur_streaming)
|
||||
return COMMAND_END;
|
||||
|
||||
ms = cmdarg->intval;
|
||||
|
||||
ret = source_seek(ms);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
playback_abort();
|
||||
|
||||
*retval = -1;
|
||||
return COMMAND_END;
|
||||
}
|
||||
|
||||
@ -2262,13 +2264,19 @@ playback_seek_bh(void *arg, int *retval)
|
||||
static enum command_state
|
||||
playback_pause_bh(void *arg, int *retval)
|
||||
{
|
||||
if (cur_streaming->data_kind == DATA_KIND_HTTP
|
||||
|| cur_streaming->data_kind == DATA_KIND_PIPE)
|
||||
*retval = -1;
|
||||
|
||||
// outputs_flush() in playback_pause() may have a caused a failure callback
|
||||
// from the output, which in streaming_cb() can cause playback_abort() ->
|
||||
// cur_streaming is NULL
|
||||
if (!cur_streaming)
|
||||
return COMMAND_END;
|
||||
|
||||
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");
|
||||
|
||||
playback_abort();
|
||||
*retval = -1;
|
||||
return COMMAND_END;
|
||||
}
|
||||
status_update(PLAY_PAUSED);
|
||||
|
Loading…
x
Reference in New Issue
Block a user