[vlc-commits] aout: split aout_DecFlush into flush and drain
Thomas Guillem
git at videolan.org
Tue Mar 19 16:03:14 CET 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 12 14:14:32 2019 +0100| [9bfddfd1eba1d2010ff5c54a2fbbc8f31b8ff680] | committer: Thomas Guillem
aout: split aout_DecFlush into flush and drain
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bfddfd1eba1d2010ff5c54a2fbbc8f31b8ff680
---
src/audio_output/aout_internal.h | 3 ++-
src/audio_output/dec.c | 36 ++++++++++++++++++++++++------------
src/input/decoder.c | 6 +++---
3 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 9073988ae6..12fa4dfad9 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -142,7 +142,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 52de2e2e7c..39f87f1c9a 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -122,7 +122,7 @@ void aout_DecDelete (audio_output_t *aout)
if (owner->mixer_format.i_format)
{
- aout_DecFlush(aout, false);
+ aout_DecFlush(aout);
aout_FiltersDelete (aout, owner->filters);
aout_OutputDelete (aout);
}
@@ -310,7 +310,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 */
@@ -499,22 +499,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);
@@ -535,3 +528,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 bc9d9b5234..4b2d5cbd9f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1137,7 +1137,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 );
}
/* */
@@ -1464,7 +1464,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 )
{
@@ -1687,7 +1687,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 );
More information about the vlc-commits
mailing list