[vlc-devel] [RFC PATCH 2/9] aout: split aout_RequestRetiming()

Thomas Guillem thomas at gllm.fr
Thu Dec 10 18:10:08 CET 2020


aout_RequestRetiming() is replaced by aout_DecAdjustDrift().

aout_RequestRetiming() is now only expected to be called by event callbacks.
---
 src/audio_output/dec.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index f95ec3c299..3f88b6c6f9 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -267,13 +267,11 @@ static void aout_DecSilence (audio_output_t *aout, vlc_tick_t length, vlc_tick_t
     aout->play(aout, block, system_pts);
 }
 
-void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
-                          vlc_tick_t audio_ts)
+static void aout_DecAdjustDrift(audio_output_t *aout, vlc_tick_t drift,
+                                vlc_tick_t audio_ts)
 {
     aout_owner_t *owner = aout_owner (aout);
-    float rate = owner->sync.rate;
-    vlc_tick_t drift =
-        vlc_clock_Update(owner->sync.clock, system_ts, audio_ts, rate);
+    const float rate = owner->sync.rate;
 
     if (unlikely(drift == INT64_MAX) || owner->bitexact)
         return; /* cf. INT64_MAX comment in aout_DecPlay() */
@@ -370,6 +368,17 @@ void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
     }
 }
 
+void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
+                          vlc_tick_t audio_ts)
+{
+    aout_owner_t *owner = aout_owner (aout);
+    const float rate = owner->sync.rate;
+    vlc_tick_t drift =
+        vlc_clock_Update(owner->sync.clock, system_ts, audio_ts, rate);
+
+    aout_DecAdjustDrift(aout, drift, audio_ts);
+}
+
 static void aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,
                                 vlc_tick_t dec_pts)
 {
@@ -418,7 +427,11 @@ static void aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,
         }
     }
 
-    aout_RequestRetiming(aout, system_now + delay, dec_pts);
+    const float rate = owner->sync.rate;
+    vlc_tick_t drift =
+        vlc_clock_Update(owner->sync.clock, system_now + delay, dec_pts, rate);
+
+    aout_DecAdjustDrift(aout, drift, dec_pts);
 }
 
 /*****************************************************************************
-- 
2.29.2



More information about the vlc-devel mailing list