mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-19 10:43:17 -05:00
[player] Fix for resuming playback after long pause (issue #766)
After a long pause the input would close the source (due to INPUT_OPEN_TIMEOUT). This change makes the player restart the input when resuming.
This commit is contained in:
parent
e608b763ef
commit
3928ab6f82
29
src/player.c
29
src/player.c
@ -832,7 +832,7 @@ session_update_read_quality(struct media_quality *quality)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
session_resume(void)
|
session_restart(void)
|
||||||
{
|
{
|
||||||
pb_session.start_ts.tv_sec = 0;
|
pb_session.start_ts.tv_sec = 0;
|
||||||
pb_session.start_ts.tv_nsec = 0;
|
pb_session.start_ts.tv_nsec = 0;
|
||||||
@ -1658,11 +1658,23 @@ pb_abort(void)
|
|||||||
db_queue_clear(0);
|
db_queue_clear(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets session start timestamp and deficits, which is necessary after pb_suspend
|
// Restarts the input (in case it was closed during the pause), resets session
|
||||||
static void
|
// start timestamp and deficits, which is necessary after pb_suspend
|
||||||
pb_resume()
|
static int
|
||||||
|
pb_resume(void)
|
||||||
{
|
{
|
||||||
session_resume();
|
int ret;
|
||||||
|
|
||||||
|
ret = source_restart(pb_session.playing_now);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
pb_abort();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
session_restart();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporarily suspends/resets playback, used when input buffer underruns or in
|
// Temporarily suspends/resets playback, used when input buffer underruns or in
|
||||||
@ -1865,7 +1877,12 @@ playback_start_item(void *arg, int *retval)
|
|||||||
|
|
||||||
DPRINTF(E_DBG, L_PLAYER, "Resume playback of '%s' (id=%d, item-id=%d)\n", ps->path, ps->id, ps->item_id);
|
DPRINTF(E_DBG, L_PLAYER, "Resume playback of '%s' (id=%d, item-id=%d)\n", ps->path, ps->id, ps->item_id);
|
||||||
|
|
||||||
pb_resume();
|
ret = pb_resume();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
*retval = -1;
|
||||||
|
return COMMAND_END;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user