[vlc-devel] [PATCH v2 1/7] aout: split aout_DecPlay

Thomas Guillem thomas at gllm.fr
Wed Mar 20 18:09:08 CET 2019


---
 src/audio_output/dec.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 91f9ccf2fe..0c68472747 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -393,6 +393,24 @@ void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
     }
 }
 
+static void aout_Play(audio_output_t *aout, block_t *block,
+                      vlc_tick_t system_now, vlc_tick_t original_pts)
+{
+    aout_owner_t *owner = aout_owner (aout);
+
+    /* Drift correction */
+    aout_DecSynchronize(aout, system_now, original_pts);
+
+    const vlc_tick_t play_date =
+        vlc_clock_ConvertToSystem(owner->sync.clock, system_now, original_pts,
+                                  owner->sync.rate);
+    /* Output */
+    owner->sync.discontinuity = false;
+    aout->play(aout, block, play_date);
+
+    atomic_fetch_add_explicit(&owner->buffers_played, 1, memory_order_relaxed);
+}
+
 /*****************************************************************************
  * aout_DecPlay : filter & mix the decoded buffer
  *****************************************************************************/
@@ -452,18 +470,8 @@ int aout_DecPlay(audio_output_t *aout, block_t *block)
             aout_DecSilence (aout, delta, block->i_pts);
     }
 
-    /* Drift correction */
     vlc_tick_t system_now = vlc_tick_now();
-    aout_DecSynchronize(aout, system_now, original_pts);
-
-    const vlc_tick_t play_date =
-        vlc_clock_ConvertToSystem(owner->sync.clock, system_now, original_pts,
-                                  owner->sync.rate);
-    /* Output */
-    owner->sync.discontinuity = false;
-    aout->play(aout, block, play_date);
-
-    atomic_fetch_add_explicit(&owner->buffers_played, 1, memory_order_relaxed);
+    aout_Play(aout, block, system_now, original_pts);
     return ret;
 drop:
     owner->sync.discontinuity = true;
-- 
2.20.1



More information about the vlc-devel mailing list