[vlc-commits] avcodec: audio. use send_packet/receive_frame in decoding

Ilkka Ollakka git at videolan.org
Wed Sep 7 11:16:44 CEST 2016


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Sep  4 11:30:39 2016 +0300| [d150b4bce968ffb97f387d4634b1d1d579259447] | committer: Ilkka Ollakka

avcodec: audio. use send_packet/receive_frame in decoding

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

 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)",



More information about the vlc-commits mailing list