[FFmpeg-cvslog] avcodec: for audio encoding, reset output packet when it is not valid

Justin Ruggles git at videolan.org
Tue May 8 22:07:19 CEST 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Mar 21 15:47:12 2012 -0400| [74e10b6204abcf6ad9625e1b9bdd9a7d998f5431] | committer: Justin Ruggles

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74e10b6204abcf6ad9625e1b9bdd9a7d998f5431
---

 libavcodec/utils.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index fdbdfd5..e8733c6 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



More information about the ffmpeg-cvslog mailing list