[vlc-devel] [PATCH 1/2] aout: wrap time_get in an helper function

Alexandre Janniaux ajanni at videolabs.io
Thu Jul 23 09:57:07 CEST 2020


Gather all use-case of time_get through a single function, allowing to
add debugging information in an easier way.
---
 include/vlc_aout.h     | 6 ++++++
 src/audio_output/dec.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 49527f30fb..d92caeb07c 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -530,6 +530,12 @@ VLC_API void     aout_FiltersChangeViewpoint(aout_filters_t *, const vlc_viewpoi
 
 VLC_API vout_thread_t *aout_filter_GetVout(filter_t *, const video_format_t *);
 
+static inline int aout_TimeGet(audio_output_t *aout, vlc_tick_t *delay)
+{
+    int ret = aout->time_get(aout, delay);
+    return ret;
+}
+
 /** @} */
 
 #endif /* VLC_AOUT_H */
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index faa65b4d79..7aba7ae8db 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -45,7 +45,7 @@ static void aout_Drain(audio_output_t *aout)
     else
     {
         vlc_tick_t delay;
-        if (aout->time_get(aout, &delay) == 0)
+        if (aout_TimeGet(aout, &delay) == 0)
             vlc_tick_sleep(delay);
     }
 }
@@ -283,7 +283,7 @@ static void aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,
     aout_owner_t *owner = aout_owner (aout);
     vlc_tick_t delay;
 
-    if (aout->time_get(aout, &delay) != 0)
+    if (aout_TimeGet(aout, &delay) != 0)
         return; /* nothing can be done if timing is unknown */
 
     if (owner->sync.discontinuity)
@@ -304,7 +304,7 @@ static void aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,
         if (jitter > 0)
         {
             aout_DecSilence (aout, jitter, dec_pts - delay);
-            if (aout->time_get(aout, &delay) != 0)
+            if (aout_TimeGet(aout, &delay) != 0)
                 return;
         }
     }
-- 
2.27.0



More information about the vlc-devel mailing list