Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
9e560b69 by Thomas Guillem at 2024-04-09T06:17:59+00:00
aout: remove early clock update on rate change

This partially reverts commit 08cd94d4845e5c4607e5c1d56875ec3da662d09c

The noticeable change is hard to detect and it makes the code way more
complex (and can mess the clock).

- - - - -
71eec734 by Thomas Guillem at 2024-04-09T06:17:59+00:00
aout: move timing rate fixup in stream_Synchronize

And share the same lock instance.

- - - - -
0587956a by Thomas Guillem at 2024-04-09T06:17:59+00:00
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)

- - - - -


1 changed file:

- src/audio_output/dec.c


Changes:

=====================================
src/audio_output/dec.c
=====================================
@@ -621,6 +621,17 @@ static void stream_Synchronize(vlc_aout_stream *stream, 
vlc_tick_t system_now,
     if (aout->time_get == NULL)
     {
         vlc_mutex_lock(&stream->timing.lock);
+        if (stream->sync.rate != stream->timing.rate)
+        {
+            /* Save the first timing point seeing a rate change */
+            stream->timing.rate_system_ts = play_date;
+            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);
 
@@ -777,32 +788,6 @@ int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t 
*block)
 
     vlc_audio_meter_Process(&owner->meter, block, play_date);
 
-    if (aout->time_get == NULL
-     && stream->sync.rate != stream->timing.rate)
-    {
-        vlc_mutex_lock(&stream->timing.lock);
-        /* Save the first timing point seeing a rate change */
-        stream->timing.rate_system_ts = play_date;
-        stream->timing.rate_audio_ts = block->i_pts;
-        stream->timing.rate = stream->sync.rate;
-
-        /* Update the clock immediately with the new rate, instead of waiting
-         * for a timing update that could come too late (after 1second). */
-        vlc_clock_Lock(stream->sync.clock);
-        stream->timing.last_drift =
-            vlc_clock_Update(stream->sync.clock, play_date, block->i_pts,
-                             stream->sync.rate);
-        vlc_clock_Unlock(stream->sync.clock);
-        vlc_mutex_unlock(&stream->timing.lock);
-    }
-
-    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;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/29dfd85dcffc08ba885be2b61d04bcbf94813097...0587956a91a017bc739f9f930375bc664a6c10e9

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/29dfd85dcffc08ba885be2b61d04bcbf94813097...0587956a91a017bc739f9f930375bc664a6c10e9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to