mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-13 16:03:23 -05:00
[player] Fix incorrect setting of start timestamp
The time stamp was getting set too late, because if pos was zero the first reads then it would be overwritten, but it shouldn't because the loop will catch up even if the initial reads have zero samples.
This commit is contained in:
parent
16469f6fa3
commit
0f83b09ef7
@ -852,7 +852,7 @@ static inline void
|
||||
session_update_read(int nsamples)
|
||||
{
|
||||
// Did we just complete our first read? Then set the start timestamp
|
||||
if (pb_session.pos == 0)
|
||||
if (pb_session.start_ts.tv_sec == 0)
|
||||
{
|
||||
clock_gettime_with_res(CLOCK_MONOTONIC, &pb_session.start_ts, &player_timer_res);
|
||||
pb_session.pts = pb_session.start_ts;
|
||||
@ -1089,7 +1089,10 @@ source_read(int *nbytes, int *nsamples, struct media_quality *quality, uint8_t *
|
||||
}
|
||||
|
||||
if (*nbytes == 0 || quality->channels == 0)
|
||||
return 0;
|
||||
{
|
||||
event_read(0); // This will set start_ts even if source isn't open yet
|
||||
return 0;
|
||||
}
|
||||
|
||||
*nsamples = BTOS(*nbytes, quality->bits_per_sample, quality->channels);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user