aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-03-21 15:47:12 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-05-07 12:14:05 -0400
commit74e10b6204abcf6ad9625e1b9bdd9a7d998f5431 (patch)
treeca7f4104f774d733c1c35245fe6388c4006b2e09 /libavcodec/utils.c
parentfa0319b4fdb569f9f7a5a5ea94fc5245fb252af8 (diff)
downloadffmpeg-74e10b6204abcf6ad9625e1b9bdd9a7d998f5431.tar.gz
avcodec: for audio encoding, reset output packet when it is not valid
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index fdbdfd54a2..e8733c6299 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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