mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-26 12:59:19 -05:00
[player] Fix incorrect calculation of timestamp due to integer overflow
This commit is contained in:
parent
daf7d755eb
commit
f7096890f6
@ -1205,10 +1205,12 @@ playback_cb(int fd, short what, void *arg)
|
||||
|
||||
if (nbytes < pb_session.bufsize)
|
||||
{
|
||||
DPRINTF(E_DBG, L_PLAYER, "Incomplete read, wanted %zu, got %d, deficit %zu\n", pb_session.bufsize, nbytes, pb_session.read_deficit);
|
||||
// How much the number of samples we got corresponds to in time (nanoseconds)
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 1000000000L * nsamples / quality.sample_rate;
|
||||
ts.tv_nsec = 1000000000UL * (uint64_t)nsamples / quality.sample_rate;
|
||||
|
||||
DPRINTF(E_DBG, L_PLAYER, "Incomplete read, wanted %zu, got %d (samples=%d/time=%lu), deficit %zu\n", pb_session.bufsize, nbytes, nsamples, ts.tv_nsec, pb_session.read_deficit);
|
||||
|
||||
pb_session.pts = timespec_add(pb_session.pts, ts);
|
||||
}
|
||||
else
|
||||
@ -1818,6 +1820,7 @@ playback_stop(void *arg, int *retval)
|
||||
// stop just yet; this saves time when restarting, which is nicer for the user
|
||||
*retval = outputs_flush(device_command_cb);
|
||||
|
||||
// Stops the input
|
||||
playback_session_stop();
|
||||
|
||||
status_update(PLAY_STOPPED);
|
||||
|
Loading…
x
Reference in New Issue
Block a user