avcodec: for audio encoding, reset output packet when it is not valid

This commit is contained in:
Justin Ruggles 2012-03-21 15:47:12 -04:00
parent fa0319b4fd
commit 74e10b6204

View File

@ -909,8 +909,11 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
avctx->frame_number++;
}
if (ret < 0 || !*got_packet_ptr)
if (ret < 0 || !*got_packet_ptr) {
av_free_packet(avpkt);
av_init_packet(avpkt);
return ret;
}
/* NOTE: if we add any audio encoders which output non-keyframe packets,
this needs to be moved to the encoders, but for now we can do it