aout: move first_pts init in stream_Synchronize

And share the same lock instance.

timing.first_pts is now only valid when using timing_report
(stream->timing struct should not be used when using time_get)
This commit is contained in:
Thomas Guillem 2024-04-05 14:38:27 +02:00 committed by Steve Lhomme
parent 71eec7349f
commit 0587956a91
1 changed files with 4 additions and 7 deletions

View File

@ -628,6 +628,10 @@ static void stream_Synchronize(vlc_aout_stream *stream, vlc_tick_t system_now,
stream->timing.rate_audio_ts = dec_pts;
stream->timing.rate = stream->sync.rate;
}
if (stream->timing.first_pts == VLC_TICK_INVALID)
stream->timing.first_pts = dec_pts;
bool is_drifting = stream->timing.last_drift != VLC_TICK_INVALID;
vlc_mutex_unlock(&stream->timing.lock);
@ -784,13 +788,6 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block)
vlc_audio_meter_Process(&owner->meter, block, play_date);
if (stream->timing.first_pts == VLC_TICK_INVALID)
{
vlc_mutex_lock(&stream->timing.lock);
stream->timing.first_pts = block->i_pts;
vlc_mutex_unlock(&stream->timing.lock);
}
/* Output */
stream->sync.discontinuity = false;
stream->timing.played_samples += block->i_nb_samples;