[vlc-commits] [Git][videolan/vlc][master] 19 commits: aout: remove time_get usage

Thomas Guillem (@tguillem) gitlab at videolan.org
Thu May 28 15:34:49 UTC 2026



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
46cda4d0 by Thomas Guillem at 2026-05-28T15:23:36+00:00
aout: remove time_get usage

All modules now use timing_report (natively or via
vlc_aout_legacy_time.h).

- - - - -
b95d54c1 by Thomas Guillem at 2026-05-28T15:23:36+00:00
aout: re-indent after previous commit

No functional changes.

- - - - -
140f39c0 by Thomas Guillem at 2026-05-28T15:23:36+00:00
android: device: remove time_get support

audiotrack doesn't need it anymore since it uses timing_report.

- - - - -
3a2dd198 by Thomas Guillem at 2026-05-28T15:23:36+00:00
decklink: remove time_get

Not a real implementation.

- - - - -
78581dff by Thomas Guillem at 2026-05-28T15:23:36+00:00
pulse: remove time_get

aout_TimingReport() is being used.

- - - - -
fc1a8aeb by Thomas Guillem at 2026-05-28T15:23:36+00:00
pipewire: remove time_get

aout_TimingReport() is being used.

- - - - -
964d9da2 by Thomas Guillem at 2026-05-28T15:23:36+00:00
kai: remove time_get

aout_TimingReport() is being used.

- - - - -
e80a2629 by Thomas Guillem at 2026-05-28T15:23:36+00:00
file: remove time_get

Not implemented, and aout_TimingReport() is not used.

- - - - -
b1bcca48 by Thomas Guillem at 2026-05-28T15:23:36+00:00
coreaudio: remove time_get

aout_TimingReport() is being used.

- - - - -
a2060bbf by Thomas Guillem at 2026-05-28T15:23:36+00:00
amem: remove time_get

Not implemented, aout_TimingReport() should be implemented (require
libVLC adaptations)

- - - - -
a3b41e16 by Thomas Guillem at 2026-05-28T15:23:36+00:00
alsa: remove time_get

aout_TimingReport() is being used.

- - - - -
0f886c17 by Thomas Guillem at 2026-05-28T15:23:36+00:00
sndio: remove time_get implementation

This was never a real implementation.

- - - - -
efadb43a by Thomas Guillem at 2026-05-28T15:23:36+00:00
jack: remove time_get implementation

aout_TimingReport() need to be ported.

- - - - -
d1a89c42 by Thomas Guillem at 2026-05-28T15:23:36+00:00
oss: remove time_get implementation

aout_TimingReport() need to be ported.

- - - - -
f6ae53c0 by Thomas Guillem at 2026-05-28T15:23:36+00:00
waveout: remove time_get implementation

aout_TimingReport() need to be ported.

- - - - -
5753cbcf by Thomas Guillem at 2026-05-28T15:23:36+00:00
opensles: remove time_get implementation

aout_TimingReport() need to be ported.

- - - - -
8fb02d30 by Thomas Guillem at 2026-05-28T15:23:36+00:00
core: remove time_get API

- - - - -
33b03f09 by Thomas Guillem at 2026-05-28T15:23:36+00:00
aout: dec: call stream_GetDelay() locked

It is now safe to call this function locked since it is not calling an
aout module anymore.

This remove one lock()/unlock()/lock() when audio is not driving the clock.

- - - - -
44246eed by Thomas Guillem at 2026-05-28T15:23:36+00:00
aout: dec: replace check with assert in stream_HandleDrift()

Without time_get, stream_HandleDrift() is always called after a first play.

- - - - -


18 changed files:

- include/vlc_aout.h
- modules/audio_output/alsa.c
- modules/audio_output/amem.c
- modules/audio_output/android/audiotrack.c
- modules/audio_output/android/device.c
- modules/audio_output/android/device.h
- modules/audio_output/android/opensles.c
- modules/audio_output/apple/coreaudio_common.c
- modules/audio_output/file.c
- modules/audio_output/jack.c
- modules/audio_output/kai.c
- modules/audio_output/oss.c
- modules/audio_output/pipewire.c
- modules/audio_output/pulse.c
- modules/audio_output/sndio.c
- modules/audio_output/waveout.c
- modules/video_output/decklink.cpp
- src/audio_output/dec.c


Changes:

=====================================
include/vlc_aout.h
=====================================
@@ -160,7 +160,7 @@ struct audio_output
     /**< Starts a new stream (mandatory, cannot be NULL).
       *
       * This callback changes the audio output from stopped to playing state
-      * (if successful). After the callback returns, time_get(), play(),
+      * (if successful). After the callback returns, play(),
       * pause(), flush() and eventually stop() callbacks may be called.
       *
       * \param fmt input stream sample format upon entry,
@@ -182,42 +182,12 @@ struct audio_output
       * \note This callback needs not be reentrant.
       */
 
-    int (*time_get)(audio_output_t *, vlc_tick_t * restrict delay);
-    /**< Estimates playback buffer latency (can be NULL).
-      *
-      * This callback computes an estimation of the delay until the current
-      * tail of the audio output buffer would be rendered. This is essential
-      * for (lip) synchronization and long term drift between the audio output
-      * clock and the media upstream clock (if any).
-      *
-      * If the audio output clock is exactly synchronized with the system
-      * monotonic clock (i.e. vlc_tick_now()), then this callback is not
-      * mandatory.  In that case, drain must be implemented (since the default
-      * implementation uses the delay to wait for the end of the stream).
-      *
-      * This callback is called before the first play() in order to get the
-      * initial delay (the hw latency). Most modules won't be able to know this
-      * latency before the first play. In that case, they should return -1 and
-      * handle the first play() date, cf. play() documentation.
-      *
-      * \warning It is recommended to report the audio delay via
-      * aout_TimingReport(). In that case, time_get should not be implemented.
-      *
-      * \param delay pointer to the delay until the next sample to be written
-      *              to the playback buffer is rendered [OUT]
-      * \return 0 on success, non-zero on failure or lack of data
-      *
-      * \note This callback cannot be called in stopped state.
-      */
-
     void (*play)(audio_output_t *, block_t *block, vlc_tick_t date);
     /**< Queues a block of samples for playback (mandatory, cannot be NULL).
       *
       * The first play() date (after a flush()/start()) will be most likely in
-      * the future. Modules that don't know the hw latency before a first play
-      * (when they return -1 from the first time_get()) will need to handle
-      * this. They can play a silence buffer with 'length = date - now()', or
-      * configure their render callback to start at the given date.
+      * the future. They can play a silence buffer with 'length = date - now()',
+      * or configure their render callback to start at the given date.
       *
       * \param block block of audio samples
       * \param date intended system time to render the first sample
@@ -257,8 +227,8 @@ struct audio_output
       *
       * Call aout_DrainedReport() to notify that the stream is drained.
       *
-      * If NULL, the caller will wait for the delay returned by time_get before
-      * calling stop().
+      * If NULL, the caller will wait for the delay reported by timing_report
+      * before calling stop().
       */
 
     int (*volume_set)(audio_output_t *, float volume);
@@ -270,7 +240,7 @@ struct audio_output
       *
       * \warning A stream may or may not have been started when called.
       * \warning This callback may be called concurrently with
-      * time_get(), play(), pause() or flush().
+      * play(), pause() or flush().
       * It will however be protected against concurrent calls to
       * start(), stop(), volume_set(), mute_set() or device_select().
       */


=====================================
modules/audio_output/alsa.c
=====================================
@@ -1233,7 +1233,6 @@ static int Open(vlc_object_t *obj)
     sys->frame_last = &sys->frame_chain;
     vlc_sem_init(&sys->init_sem, 0);
 
-    aout->time_get = NULL;
     aout->play = Play;
     aout->flush = Flush;
     aout->drain = Drain;


=====================================
modules/audio_output/amem.c
=====================================
@@ -372,7 +372,6 @@ static int Open (vlc_object_t *obj)
     aout->sys = sys;
     aout->start = Start;
     aout->stop = Stop;
-    aout->time_get = NULL;
     aout->play = Play;
     aout->pause = Pause;
     aout->flush = Flush;


=====================================
modules/audio_output/android/audiotrack.c
=====================================
@@ -1917,7 +1917,6 @@ Start( aout_stream_t *stream, audio_sample_format_t *restrict p_fmt,
     stream->play = Play;
     stream->pause = Pause;
     stream->flush = Flush;
-    stream->time_get = NULL;
     stream->volume_set = VolumeSet;
     stream->mute_set = MuteSet;
 


=====================================
modules/audio_output/android/device.c
=====================================
@@ -124,15 +124,6 @@ Drain(audio_output_t *aout)
     sys->stream->drain(sys->stream);
 }
 
-static int
-TimeGet(audio_output_t *aout, vlc_tick_t *restrict delay)
-{
-    struct sys *sys = aout->sys;
-    assert(sys->stream != NULL);
-
-    return sys->stream->time_get(sys->stream, delay);
-}
-
 static int
 Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 {
@@ -171,7 +162,6 @@ Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
                    s->pause != NULL && s->flush != NULL);
 
             aout->drain = s->drain != NULL ? Drain : NULL;
-            aout->time_get = s->time_get != NULL ? TimeGet : NULL;
 
             if (s->volume_set != NULL)
                 s->volume_set(s, sys->volume);


=====================================
modules/audio_output/android/device.h
=====================================
@@ -77,7 +77,6 @@ struct aout_stream
     void *sys;
 
     void (*stop)(aout_stream_t *);
-    int (*time_get)(aout_stream_t *, vlc_tick_t *);
     void (*play)(aout_stream_t *, block_t *, vlc_tick_t);
     void (*pause)(aout_stream_t *, bool, vlc_tick_t);
     void (*flush)(aout_stream_t *);


=====================================
modules/audio_output/android/opensles.c
=====================================
@@ -120,6 +120,8 @@ static inline int bytesPerSample(void)
     return 2 /* S16 */ * 2 /* stereo */;
 }
 
+#if 0
+// FIXME: port to aout_TimingReport()
 static int TimeGet(audio_output_t* aout, vlc_tick_t* restrict drift)
 {
     aout_sys_t *sys = aout->sys;
@@ -146,6 +148,7 @@ static int TimeGet(audio_output_t* aout, vlc_tick_t* restrict drift)
 
     return 0;
 }
+#endif
 
 static void Flush(audio_output_t *aout)
 {
@@ -390,7 +393,6 @@ static int Open (vlc_object_t *obj)
 
     aout->start      = Start;
     aout->stop       = Stop;
-    aout->time_get   = TimeGet;
     aout->play       = Play;
     aout->pause      = Pause;
     aout->flush      = Flush;


=====================================
modules/audio_output/apple/coreaudio_common.c
=====================================
@@ -132,7 +132,6 @@ ca_Open(audio_output_t *p_aout)
     p_aout->play = ca_Play;
     p_aout->pause = ca_Pause;
     p_aout->flush = ca_Flush;
-    p_aout->time_get = NULL;
 
     return VLC_SUCCESS;
 }


=====================================
modules/audio_output/file.c
=====================================
@@ -163,7 +163,6 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
         return VLC_EGENERIC;
     }
 
-    p_aout->time_get = NULL;
     p_aout->play = Play;
     p_aout->pause = Pause;
     p_aout->flush = Flush;


=====================================
modules/audio_output/jack.c
=====================================
@@ -75,7 +75,6 @@ static void Close        ( vlc_object_t * );
 static void Play         ( audio_output_t * p_aout, block_t *, vlc_tick_t );
 static void Pause        ( audio_output_t *aout, bool paused, vlc_tick_t date );
 static void Flush        ( audio_output_t *p_aout );
-static int  TimeGet      ( audio_output_t *, vlc_tick_t * );
 static int  Process      ( jack_nframes_t i_frames, void *p_arg );
 static int  Buffer_ch    ( jack_nframes_t nframes, void *p_arg );
 static int  GraphChange  ( void *p_arg );
@@ -161,7 +160,6 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
     p_aout->play = Play;
     p_aout->pause = Pause;
     p_aout->flush = Flush;
-    p_aout->time_get = TimeGet;
 
     p_sys->i_channels = aout_FormatNbChannels( fmt );
     aout_FormatPrepare(fmt);
@@ -373,6 +371,8 @@ static int MuteSet(audio_output_t *p_aout, bool mute)
     return 0;
 }
 
+#if 0
+// FIXME: port to aout_TimingReport()
 static int TimeGet(audio_output_t *p_aout, vlc_tick_t *delay)
 {
     aout_sys_t * p_sys = p_aout->sys;
@@ -385,6 +385,7 @@ static int TimeGet(audio_output_t *p_aout, vlc_tick_t *delay)
 
     return 0;
 }
+#endif
 
 /*****************************************************************************
  * Process: callback for JACK


=====================================
modules/audio_output/kai.c
=====================================
@@ -216,7 +216,6 @@ static int Start ( audio_output_t *p_aout, audio_sample_format_t *fmt )
     format.channel_type = AUDIO_CHANNEL_TYPE_BITMAP;
     p_sys->format = *fmt = format;
 
-    p_aout->time_get = NULL;
     p_aout->play     = Play;
     p_aout->pause    = Pause;
     p_aout->flush    = Flush;


=====================================
modules/audio_output/oss.c
=====================================
@@ -84,7 +84,6 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
 vlc_module_end ()
 
-static int TimeGet (audio_output_t *, vlc_tick_t *);
 static void Play(audio_output_t *, block_t *, vlc_tick_t);
 static void Pause (audio_output_t *, bool, vlc_tick_t);
 static void Flush (audio_output_t *);
@@ -203,7 +202,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     }
 
     /* Setup audio_output_t */
-    aout->time_get = TimeGet;
     aout->play = Play;
     aout->pause = Pause;
     aout->flush = Flush;
@@ -247,6 +245,8 @@ error:
     return VLC_EGENERIC;
 }
 
+#if 0
+// FIXME: port to aout_TimingReport()
 static int TimeGet (audio_output_t *aout, vlc_tick_t *restrict pts)
 {
     aout_sys_t *sys = aout->sys;
@@ -262,6 +262,7 @@ static int TimeGet (audio_output_t *aout, vlc_tick_t *restrict pts)
                         sys->format.i_rate * sys->format.i_bytes_per_frame);
     return 0;
 }
+#endif
 
 /**
  * Queues one audio buffer to the hardware.


=====================================
modules/audio_output/pipewire.c
=====================================
@@ -914,7 +914,6 @@ static int Open(vlc_object_t *obj)
     aout->sys = sys;
     aout->start = Start;
     aout->stop = Stop;
-    aout->time_get = NULL;
     aout->play = Play;
     aout->pause = Pause;
     aout->flush = Flush;


=====================================
modules/audio_output/pulse.c
=====================================
@@ -1235,7 +1235,6 @@ static int Open(vlc_object_t *obj)
     aout->sys = sys;
     aout->start = Start;
     aout->stop = Stop;
-    aout->time_get = NULL;
     aout->play = Play;
     aout->pause = Pause;
     aout->flush = Flush;


=====================================
modules/audio_output/sndio.c
=====================================
@@ -42,7 +42,6 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
 vlc_module_end ()
 
-static int TimeGet (audio_output_t *, vlc_tick_t *);
 static void Play(audio_output_t *, block_t *, vlc_tick_t);
 static void Flush (audio_output_t *);
 static int VolumeSet (audio_output_t *, float);
@@ -177,7 +176,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     fmt->i_physical_channels = chans;
     aout_FormatPrepare (fmt);
 
-    aout->time_get = TimeGet;
     aout->play = Play;
     aout->pause = NULL;
     aout->flush = Flush;
@@ -221,16 +219,6 @@ static void PositionChanged (void *arg, int delta)
     sys->started = 1;
 }
 
-static int TimeGet (audio_output_t *aout, vlc_tick_t *restrict delay)
-{
-    aout_sys_t *sys = aout->sys;
-
-    if (!sys->started)
-        return -1;
-    *delay = vlc_tick_from_samples(sys->delay, sys->rate);
-    return 0;
-}
-
 static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;


=====================================
modules/audio_output/waveout.c
=====================================
@@ -78,7 +78,6 @@ static void WaveOutClean( aout_sys_t * p_sys );
 static void WaveOutClearBuffer( HWAVEOUT, WAVEHDR *);
 
 static uint32_t findDeviceID(char *);
-static int WaveOutTimeGet(audio_output_t * , vlc_tick_t *);
 static void WaveOutFlush( audio_output_t *);
 static void WaveOutDrain( audio_output_t *);
 static void WaveOutDrainAsync( audio_output_t *);
@@ -175,7 +174,6 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
     if( aout_FormatNbChannels( fmt ) == 0 )
         return VLC_EGENERIC;
 
-    p_aout->time_get = WaveOutTimeGet;
     p_aout->play = Play;
     p_aout->pause = WaveOutPause;
     p_aout->flush = WaveOutFlush;
@@ -837,6 +835,8 @@ static void Close(vlc_object_t *obj)
     free(sys);
 }
 
+#if 0
+// FIXME: port to aout_TimingReport()
 static int WaveOutTimeGet(audio_output_t * p_aout, vlc_tick_t *delay)
 {
     MMTIME mmtime;
@@ -857,6 +857,7 @@ static int WaveOutTimeGet(audio_output_t * p_aout, vlc_tick_t *delay)
     *delay = sys->i_played_length - i_pos;
     return 0;
 }
+#endif
 
 static void WaveOutFlush( audio_output_t *p_aout)
 {


=====================================
modules/video_output/decklink.cpp
=====================================
@@ -886,12 +886,6 @@ static void Drain(audio_output_t *aout)
 }
 
 
-static int TimeGet(audio_output_t *, vlc_tick_t* restrict)
-{
-    /* synchronization is handled by the card */
-    return -1;
-}
-
 static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 {
     decklink_sys_t *sys = (decklink_sys_t *) aout->sys;
@@ -956,7 +950,6 @@ static int OpenAudio(vlc_object_t *p_this)
     aout->start     = Start;
     aout->flush     = Flush;
     aout->drain     = Drain;
-    aout->time_get  = TimeGet;
 
     aout->pause     = NULL;
     aout->stop      = Flush;


=====================================
src/audio_output/dec.c
=====================================
@@ -130,20 +130,11 @@ static inline struct vlc_tracer *aout_stream_tracer(vlc_aout_stream *stream)
 
 static int stream_GetDelay(vlc_aout_stream *stream, vlc_tick_t *delay)
 {
-    audio_output_t *aout = aout_stream_aout(stream);
-
-    if (aout->time_get != NULL)
-        return aout->time_get(aout, delay);
-
-    vlc_mutex_lock(&stream->timing.lock);
+    vlc_mutex_assert(&stream->timing.lock);
     vlc_tick_t system_ts = stream->timing.system_ts;
     vlc_tick_t audio_ts = stream->timing.audio_ts;
     if (system_ts == VLC_TICK_INVALID)
-    {
-        vlc_mutex_unlock(&stream->timing.lock);
         return -1;
-    }
-    vlc_mutex_unlock(&stream->timing.lock);
 
     /* Interpolate the last updated point. */
     vlc_tick_t system_now = vlc_tick_now();
@@ -605,6 +596,7 @@ static void stream_HandleDrift(vlc_aout_stream *stream, vlc_tick_t drift,
 {
     aout_owner_t *owner = aout_stream_owner(stream);
     audio_output_t *aout = aout_stream_aout(stream);
+    assert(stream->sync.played);
 
     float rate = stream->sync.rate;
 
@@ -630,18 +622,14 @@ static void stream_HandleDrift(vlc_aout_stream *stream, vlc_tick_t drift,
      * is not portable, not supported by some hardware and often unsafe/buggy
      * where supported. The other alternative is to flush the buffers
      * completely. */
-    if (drift > (stream->sync.played ?
-                 lroundf(+3 * AOUT_MAX_PTS_DELAY / rate) : 0))
+    if (drift > lroundf(+3 * AOUT_MAX_PTS_DELAY / rate))
     {
         if (tracer != NULL)
             vlc_tracer_TraceEvent(tracer, "RENDER", stream->str_id, "late_flush");
 
-        if (stream->sync.played)
-            msg_Warn (aout, "playback way too late (%"PRId64"): "
-                      "flushing buffers", drift);
-        else
-            msg_Dbg (aout, "playback too late (%"PRId64"): "
-                     "flushing buffers", drift);
+        msg_Warn (aout, "playback way too late (%"PRId64"): "
+                    "flushing buffers", drift);
+
         vlc_aout_stream_Flush(stream);
         stream_StopResampling(stream);
 
@@ -650,17 +638,13 @@ static void stream_HandleDrift(vlc_aout_stream *stream, vlc_tick_t drift,
 
     /* Early audio output.
      * This is rare except at startup when the buffers are still empty. */
-    if (drift < (stream->sync.played ?
-                 lroundf(-3 * AOUT_MAX_PTS_ADVANCE / rate) : 0))
+    if (drift < lroundf(-3 * AOUT_MAX_PTS_ADVANCE / rate))
     {
-        if (stream->sync.played)
-        {
-            if (tracer != NULL)
-                vlc_tracer_TraceEvent(tracer, "RENDER", stream->str_id, "early_silence");
+        if (tracer != NULL)
+            vlc_tracer_TraceEvent(tracer, "RENDER", stream->str_id, "early_silence");
 
-            msg_Warn (aout, "playback way too early (%"PRId64"): "
-                      "playing silence", drift);
-        }
+        msg_Warn (aout, "playback way too early (%"PRId64"): "
+                 "playing silence", drift);
         stream_Silence(stream, -drift, audio_ts);
 
         stream_StopResampling(stream);
@@ -748,67 +732,35 @@ static void stream_Synchronize(vlc_aout_stream *stream, vlc_tick_t system_now,
      */
     vlc_tick_t delay;
     vlc_tick_t drift;
-    audio_output_t *aout = aout_stream_aout(stream);
+    assert(system_now != VLC_TICK_INVALID);
 
-    if (aout->time_get == NULL)
+    vlc_mutex_lock(&stream->timing.lock);
+    if (stream->sync.rate != stream->timing.rate)
     {
-        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;
+        /* 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;
+    }
 
-        bool is_drifting = stream->timing.last_drift != VLC_TICK_INVALID;
-        vlc_mutex_unlock(&stream->timing.lock);
+    if (stream->timing.first_pts == VLC_TICK_INVALID)
+        stream->timing.first_pts = dec_pts;
 
-        if (!is_drifting)
-        {
-            /* module is using aout_TimingReport() and stream is master:
-             * nothing to do */
-            return;
-        }
-        if (stream_GetDelay(stream, &delay) != 0)
-            return; /* nothing can be done if timing is unknown */
+    bool is_drifting = stream->timing.last_drift != VLC_TICK_INVALID;
 
-        drift = play_date - system_now - delay;
-    }
-    else
+    if (!is_drifting)
     {
-        if (stream_GetDelay(stream, &delay) != 0)
-            return; /* nothing can be done if timing is unknown */
+        /* stream is master: nothing to do */
+        vlc_mutex_unlock(&stream->timing.lock);
+        return;
+    }
+    int ret = stream_GetDelay(stream, &delay);
+    vlc_mutex_unlock(&stream->timing.lock);
 
-        if (!stream->sync.played)
-        {
-            /* Chicken-egg situation for some aout modules that can't be
-             * started deferred (like alsa). These modules will start to play
-             * data immediately and ignore the given play_date (that take the
-             * clock jitter into account). We don't want to let
-             * stream_HandleDrift() handle the first silence (from the "Early
-             * audio output" case) since this function will first update the
-             * clock without taking the jitter into account. Therefore, we
-             * manually insert silence that correspond to the clock jitter
-             * value before updating the clock. */
-
-            vlc_tick_t jitter = play_date - system_now;
-            if (jitter > 0)
-            {
-                stream_Silence(stream, jitter, dec_pts - delay);
-                if (stream_GetDelay(stream, &delay) != 0)
-                    return;
-            }
-        }
+    if (ret != 0)
+        return; /* nothing can be done if timing is unknown */
 
-        vlc_clock_Lock(stream->sync.clock);
-        drift = vlc_clock_Update(stream->sync.clock, system_now + delay,
-                                 dec_pts, stream->sync.rate);
-        vlc_clock_Unlock(stream->sync.clock);
-    }
+    drift = play_date - system_now - delay;
 
     stream_HandleDrift(stream, drift, dec_pts);
 }
@@ -1009,8 +961,7 @@ void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool paused, vlc_tick_
             vlc_aout_stream_Flush(stream);
 
         /* Update the rate point after the pause */
-        if (aout->time_get == NULL && !paused
-         && stream->timing.rate_audio_ts != VLC_TICK_INVALID)
+        if (!paused && stream->timing.rate_audio_ts != VLC_TICK_INVALID)
         {
             vlc_clock_Lock(stream->sync.clock);
             vlc_tick_t play_date =
@@ -1117,8 +1068,11 @@ void vlc_aout_stream_Drain(vlc_aout_stream *stream)
         vlc_tick_t drain_deadline = vlc_tick_now();
 
         vlc_tick_t delay;
+        vlc_mutex_lock(&stream->timing.lock);
         if (stream_GetDelay(stream, &delay) == 0)
             drain_deadline += delay;
+        vlc_mutex_unlock(&stream->timing.lock);
+
         /* else the deadline is now, and vlc_aout_stream_IsDrained() will
          * return true on the first call. */
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dd296d71e301429c24ed84d5ee221ec08b2ac956...44246eed7bed3bbad1a35edfdf208f7050736e2a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dd296d71e301429c24ed84d5ee221ec08b2ac956...44246eed7bed3bbad1a35edfdf208f7050736e2a
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list