[vlc-devel] [PATCH v2 3/7] aout: split aout_DecFlush into flush and drain

Rémi Denis-Courmont remi at remlab.net
Wed Mar 13 14:33:00 CET 2019


Seems ok

Le 13 mars 2019 16:55:51 GMT+08:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>---
> src/audio_output/aout_internal.h |  3 ++-
> src/audio_output/dec.c           | 34 +++++++++++++++++++++-----------
> src/input/decoder.c              |  8 ++++----
> 3 files changed, 29 insertions(+), 16 deletions(-)
>
>diff --git a/src/audio_output/aout_internal.h
>b/src/audio_output/aout_internal.h
>index 1dd92e96aa..a1bc4cfe65 100644
>--- a/src/audio_output/aout_internal.h
>+++ b/src/audio_output/aout_internal.h
>@@ -140,7 +140,8 @@ void aout_DecGetResetStats(audio_output_t *,
>unsigned *, unsigned *);
>void aout_DecChangePause(audio_output_t *, bool b_paused, vlc_tick_t
>i_date);
> void aout_DecChangeRate(audio_output_t *aout, float rate);
> void aout_DecChangeDelay(audio_output_t *aout, vlc_tick_t delay);
>-void aout_DecFlush(audio_output_t *, bool wait);
>+void aout_DecFlush(audio_output_t *);
>+void aout_DecDrain(audio_output_t *);
> void aout_RequestRestart (audio_output_t *, unsigned);
> void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,
>                           vlc_tick_t audio_ts);
>diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
>index 5295644891..638ff78e48 100644
>--- a/src/audio_output/dec.c
>+++ b/src/audio_output/dec.c
>@@ -309,7 +309,7 @@ void aout_RequestRetiming(audio_output_t *aout,
>vlc_tick_t system_ts,
>         else
>             msg_Dbg (aout, "playback too late (%"PRId64"): "
>                      "flushing buffers", drift);
>-        aout_DecFlush(aout, false);
>+        aout_DecFlush(aout);
>         aout_StopResampling (aout);
> 
>         return; /* nothing can be done if timing is unknown */
>@@ -498,22 +498,15 @@ void aout_DecChangeDelay(audio_output_t *aout,
>vlc_tick_t delay)
>     owner->sync.request_delay = delay;
> }
> 
>-void aout_DecFlush (audio_output_t *aout, bool wait)
>+void aout_DecFlush(audio_output_t *aout)
> {
>     aout_owner_t *owner = aout_owner (aout);
> 
>     if (owner->mixer_format.i_format)
>     {
>-        if (wait)
>-        {
>-            block_t *block = aout_FiltersDrain (owner->filters);
>-            if (block)
>-                aout->play(aout, block, vlc_tick_now());
>-        }
>-        else
>-            aout_FiltersFlush (owner->filters);
>+        aout_FiltersFlush (owner->filters);
> 
>-        aout->flush(aout, wait);
>+        aout->flush(aout, false);
>         vlc_clock_Reset(owner->sync.clock);
>         aout_FiltersResetClock(owner->filters);
> 
>@@ -534,3 +527,22 @@ void aout_DecFlush (audio_output_t *aout, bool
>wait)
>     owner->sync.discontinuity = true;
>     owner->original_pts = VLC_TICK_INVALID;
> }
>+
>+void aout_DecDrain(audio_output_t *aout)
>+{
>+    aout_owner_t *owner = aout_owner (aout);
>+
>+    if (!owner->mixer_format.i_format)
>+        return;
>+
>+    block_t *block = aout_FiltersDrain (owner->filters);
>+    if (block)
>+        aout->play(aout, block, vlc_tick_now());
>+    aout->flush(aout, true);
>+
>+    vlc_clock_Reset(owner->sync.clock);
>+    aout_FiltersResetClock(owner->filters);
>+
>+    owner->sync.discontinuity = true;
>+    owner->original_pts = VLC_TICK_INVALID;
>+}
>diff --git a/src/input/decoder.c b/src/input/decoder.c
>index cf7fd43995..b698b4e90f 100644
>--- a/src/input/decoder.c
>+++ b/src/input/decoder.c
>@@ -1138,7 +1138,7 @@ static void DecoderPlayAudio( decoder_t *p_dec,
>block_t *p_audio,
>         msg_Dbg( p_dec, "end of audio preroll" );
> 
>         if( p_owner->p_aout )
>-            aout_DecFlush( p_owner->p_aout, false );
>+            aout_DecFlush( p_owner->p_aout );
>     }
> 
>     /* */
>@@ -1465,7 +1465,7 @@ static void DecoderProcessFlush( decoder_t *p_dec
>)
>     if( p_dec->fmt_out.i_cat == AUDIO_ES )
>     {
>         if( p_owner->p_aout )
>-            aout_DecFlush( p_owner->p_aout, false );
>+            aout_DecFlush( p_owner->p_aout );
>     }
>     else if( p_dec->fmt_out.i_cat == VIDEO_ES )
>     {
>@@ -1688,7 +1688,7 @@ static void *DecoderThread( void *p_data )
>    {   /* Draining: the decoder is drained and all decoded buffers are
>         * queued to the output at this point. Now drain the output. */
>             if( p_owner->p_aout != NULL )
>-                aout_DecFlush( p_owner->p_aout, true );
>+                aout_DecDrain( p_owner->p_aout );
>         }
>         vlc_restorecancel( canc );
> 
>@@ -1933,7 +1933,7 @@ static void DeleteDecoder( decoder_t * p_dec )
>             if( p_owner->p_aout )
>             {
>                 /* TODO: REVISIT gap-less audio */
>-                aout_DecFlush( p_owner->p_aout, false );
>+                aout_DecFlush( p_owner->p_aout );
>                 aout_DecDelete( p_owner->p_aout );
>        input_resource_PutAout( p_owner->p_resource, p_owner->p_aout );
>             }
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190313/204e78c6/attachment.html>


More information about the vlc-devel mailing list