lavc: unify similar code merged from both branches.
authorNicolas George <nicolas.george@normalesup.org>
Sat, 3 Mar 2012 09:35:36 +0000 (10:35 +0100)
committerNicolas George <nicolas.george@normalesup.org>
Sat, 3 Mar 2012 14:56:45 +0000 (15:56 +0100)
libavcodec/utils.c

index 2b6e30e..f462bd1 100644 (file)
@@ -1219,15 +1219,10 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
             avpkt->size = 0;
         else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
             avpkt->pts = avpkt->dts = frame->pts;
-        if (avpkt->data && avpkt->destruct == av_destruct_packet) {
-            new_data = av_realloc(avpkt->data,
-                                  avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (new_data)
-                avpkt->data = new_data;
-        }
 
-        if (!user_packet && avpkt->data) {
-            uint8_t *new_data = av_realloc(avpkt->data, avpkt->size);
+        if (!user_packet && avpkt->data &&
+            avpkt->destruct == av_destruct_packet) {
+            uint8_t *new_data = av_realloc(avpkt->data, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
             if (new_data)
                 avpkt->data = new_data;
         }