summaryrefslogtreecommitdiff
path: root/libavcodec/encode.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r--libavcodec/encode.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 62c47afb24..a569904f2c 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -30,7 +30,7 @@
#include "frame_thread_encoder.h"
#include "internal.h"
-int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
+int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
{
if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n",
@@ -40,18 +40,14 @@ int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64
av_assert0(!avpkt->data);
- if (avctx && 2*min_size < size) { // FIXME The factor needs to be finetuned
- av_fast_padded_malloc(&avctx->internal->byte_buffer, &avctx->internal->byte_buffer_size, size);
- avpkt->data = avctx->internal->byte_buffer;
- avpkt->size = size;
- }
-
+ av_fast_padded_malloc(&avctx->internal->byte_buffer,
+ &avctx->internal->byte_buffer_size, size);
+ avpkt->data = avctx->internal->byte_buffer;
if (!avpkt->data) {
- int ret = av_new_packet(avpkt, size);
- if (ret < 0)
- av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %"PRId64"\n", size);
- return ret;
+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %"PRId64"\n", size);
+ return AVERROR(ENOMEM);
}
+ avpkt->size = size;
return 0;
}