[vlc-devel] [PATCH 7/8] transcode/audio: also drain the decoder

Thomas Guillem thomas at gllm.fr
Wed Feb 8 19:53:54 CET 2017


---
 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 cc07ceeba9..f2f75d7aa2 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;
 }
 
-- 
2.11.0



More information about the vlc-devel mailing list