[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:
ejurgensen 2019-02-23 21:26:04 +01:00
parent 16469f6fa3
commit 0f83b09ef7

View File

@ -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);