[vlc-commits] transcode/audio: also drain the decoder

Thomas Guillem git at videolan.org
Thu Feb 9 15:57:28 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  8 13:57:27 2017 +0100| [23af9317fb1105d1ee0ce91837fb6df7911cde9d] | committer: Thomas Guillem

transcode/audio: also drain the decoder

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=23af9317fb1105d1ee0ce91837fb6df7911cde9d
---

 modules/stream_out/transcode/audio.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index cc07cee..f2f75d7 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -233,23 +233,13 @@ int transcode_audio_process( sout_stream_t *p_stream,
     *out = NULL;
     bool b_error = false;
 
-    if( unlikely( in == NULL ) )
-    {
-        block_t *p_block;
-        do {
-           p_block = id->p_encoder->pf_encode_audio(id->p_encoder, NULL );
-           block_ChainAppend( out, p_block );
-        } while( p_block );
-        return VLC_SUCCESS;
-    }
-
     int ret = id->p_decoder->pf_decode( id->p_decoder, in );
     if( ret != VLCDEC_SUCCESS )
         return VLC_EGENERIC;
 
     block_t *p_audio_bufs = transcode_dequeue_all_audios( id );
     if( p_audio_bufs == NULL )
-        return VLC_SUCCESS;
+        goto end;
 
     do
     {
@@ -362,6 +352,17 @@ error:
         b_error = true;
     } while( p_audio_bufs );
 
+end:
+    /* Drain encoder */
+    if( unlikely( !b_error && in == NULL ) )
+    {
+        block_t *p_block;
+        do {
+           p_block = id->p_encoder->pf_encode_audio(id->p_encoder, NULL );
+           block_ChainAppend( out, p_block );
+        } while( p_block );
+    }
+
     return b_error ? VLC_EGENERIC : VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list