vlc | branch: master | Thomas Guillem <[email protected]> | Wed Sep 7 13:27:10 2016 +0200| [9861e90ebe644c6afe45c0e610db67bd45c62415] | committer: Thomas Guillem
avcodec: audio: fix new API usage > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9861e90ebe644c6afe45c0e610db67bd45c62415 --- modules/codec/avcodec/audio.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c index 7f2412f..8417988 100644 --- a/modules/codec/avcodec/audio.c +++ b/modules/codec/avcodec/audio.c @@ -323,24 +323,26 @@ 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_send_packet( ctx, &pkt ); - if( used < 0 ) + int ret = avcodec_send_packet( ctx, &pkt ); + if( ret != 0 && ret != AVERROR(EAGAIN) ) { 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 ) + int used = ret != AVERROR(EAGAIN) ? pkt.size : 0; + + ret = avcodec_receive_frame( ctx, frame ); + if( ret != 0 && ret != AVERROR(EAGAIN) ) { msg_Warn( p_dec, "cannot decode one frame (%zu bytes)", p_block->i_buffer ); goto end; } + got_frame = ret == 0; - p_block->p_buffer += p_block->i_buffer; - p_block->i_buffer = 0; + p_block->p_buffer += used; + p_block->i_buffer -= used; } if( ctx->channels <= 0 || ctx->channels > 8 || ctx->sample_rate <= 0 ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
