mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-15 00:35:55 -04: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 ms;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
*retval = -1;
|
||||||
|
|
||||||
|
if (!cur_streaming)
|
||||||
|
return COMMAND_END;
|
||||||
|
|
||||||
ms = cmdarg->intval;
|
ms = cmdarg->intval;
|
||||||
|
|
||||||
ret = source_seek(ms);
|
ret = source_seek(ms);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
playback_abort();
|
playback_abort();
|
||||||
|
|
||||||
*retval = -1;
|
|
||||||
return COMMAND_END;
|
return COMMAND_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2262,13 +2264,19 @@ playback_seek_bh(void *arg, int *retval)
|
|||||||
static enum command_state
|
static enum command_state
|
||||||
playback_pause_bh(void *arg, int *retval)
|
playback_pause_bh(void *arg, int *retval)
|
||||||
{
|
{
|
||||||
if (cur_streaming->data_kind == DATA_KIND_HTTP
|
*retval = -1;
|
||||||
|| cur_streaming->data_kind == DATA_KIND_PIPE)
|
|
||||||
|
// 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");
|
DPRINTF(E_DBG, L_PLAYER, "Source is not pausable, abort playback\n");
|
||||||
|
|
||||||
playback_abort();
|
playback_abort();
|
||||||
*retval = -1;
|
|
||||||
return COMMAND_END;
|
return COMMAND_END;
|
||||||
}
|
}
|
||||||
status_update(PLAY_PAUSED);
|
status_update(PLAY_PAUSED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user