[vlc-devel] [PATCH 05/10] aout: split aout_DecPlay

Thomas Guillem thomas at gllm.fr
Tue Mar 19 17:45:20 CET 2019


---
 src/audio_output/dec.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index cae2068805..854ed2271c 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -395,6 +395,25 @@ 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;
+    block->i_dts = block->i_pts;
+    aout->play(aout, block, play_date);
+
+    atomic_fetch_add_explicit(&owner->buffers_played, 1, memory_order_relaxed);
+}
+
 /*****************************************************************************
  * aout_DecPlay : filter & mix the decoded buffer
  *****************************************************************************/
@@ -454,19 +473,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;
-    block->i_dts = block->i_pts;
-    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