mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[player] Quick fix for short track segfault (issue #733)
With short tracks reading ends before playback starts, so event_read_eof comes before event_play_start, which causes playing_now to point to a null reading_now. With this change it will point to a non-null reading_prev, but note that in the hopefully rare case of multiple short tracks, the playing_now pointer will still be incorrect.
This commit is contained in:
parent
d43e688dfd
commit
1948dcb959
@ -707,7 +707,13 @@ session_update_play_eof(void)
|
||||
static void
|
||||
session_update_play_start(void)
|
||||
{
|
||||
pb_session.playing_now = pb_session.reading_now;
|
||||
// If the track was really short, reading may have ended before we started
|
||||
// playing the track. Note that the below will fail if we have multiple very
|
||||
// short tracks in a row. A bit of an edge case, but still a FIXME.
|
||||
if (pb_session.reading_now)
|
||||
pb_session.playing_now = pb_session.reading_now;
|
||||
else
|
||||
pb_session.playing_now = pb_session.reading_prev;
|
||||
|
||||
// This is a stupid work-around to make sure pos_ms is non-zero, because a
|
||||
// zero value means that get_status() tells the clients that we are paused.
|
||||
|
Loading…
Reference in New Issue
Block a user