[vlc-devel] [PATCH] decoder: drop audio block and picture during flushing
Zhao Zhili
quinkblack at foxmail.com
Tue Jan 2 10:43:04 CET 2018
If input_DecoderStartWait() is executed before DecoderThread() do flushing,
an old picture can be treated as the first picture.
---
src/input/decoder.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index b94d6da..7a0106a 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -987,8 +987,18 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
vout_thread_t *p_vout = p_owner->p_vout;
+ bool flushing;
bool prerolled;
+ vlc_fifo_Lock( p_owner->p_fifo );
+ flushing = p_owner->flushing;
+ vlc_fifo_Unlock( p_owner->p_fifo );
+ if( flushing )
+ {
+ picture_Release( p_picture );
+ return -1;
+ }
+
vlc_mutex_lock( &p_owner->lock );
if( p_owner->i_preroll_end > p_picture->date )
{
@@ -1127,10 +1137,20 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
unsigned *restrict pi_lost_sum )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
+ bool flushing;
bool prerolled;
assert( p_audio != NULL );
+ vlc_fifo_Lock( p_owner->p_fifo );
+ flushing = p_owner->flushing;
+ vlc_fifo_Unlock( p_owner->p_fifo );
+ if( flushing )
+ {
+ block_Release( p_audio );
+ return -1;
+ }
+
vlc_mutex_lock( &p_owner->lock );
if( p_owner->i_preroll_end > p_audio->i_pts )
{
--
2.7.4
More information about the vlc-devel
mailing list