[vlc-devel] [PATCH 6/9] avcodec: audio. use send_packet/receive_frame in decoding

ileoo at videolan.org ileoo at videolan.org
Sun Sep 4 14:34:06 CEST 2016


From: Ilkka Ollakka <ileoo at videolan.org>

---
 modules/codec/avcodec/audio.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 159dbf1..05d22cf 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -323,7 +323,15 @@ static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         pkt.data = p_block->p_buffer;
         pkt.size = p_block->i_buffer;
 
-        int used = avcodec_decode_audio4( ctx, frame, &got_frame, &pkt );
+        int used = avcodec_send_packet( ctx, &pkt );
+        if( used < 0 )
+        {
+            msg_Warn( p_dec, "cannot decode one frame (%zu bytes)",
+                      p_block->i_buffer );
+            goto end;
+        }
+        used = avcodec_receive_frame( ctx, frame );
+        got_frame = used == 0;
         if( used < 0 )
         {
             msg_Warn( p_dec, "cannot decode one frame (%zu bytes)",
-- 
2.6.6



More information about the vlc-devel mailing list