aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-03-18 06:58:05 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-03 20:56:12 +0200
commit4e6e14f49606b07896a8c512d9ea72d2c2656387 (patch)
treebc7990a49fe873964eb96aa9004dd563fbe36325
parentc2bb05497911a0900b745eaa4a7f05d72b3610ef (diff)
downloadffmpeg-4e6e14f49606b07896a8c512d9ea72d2c2656387.tar.gz
avformat/amvenc: Avoid allocating packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavformat/amvenc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/amvenc.c b/libavformat/amvenc.c
index cb03f00ed7..fece2f49b1 100644
--- a/libavformat/amvenc.c
+++ b/libavformat/amvenc.c
@@ -62,7 +62,7 @@ typedef struct AMVContext
int32_t aframe_size; /* Expected audio frame size. */
int32_t ablock_align; /* Expected audio block align. */
- AVPacket *apad; /* Dummy audio packet for padding. */
+ AVPacket *apad; /* Dummy audio packet for padding; not owned by us. */
AVPacket *vpad; /* Most recent video frame, for padding. */
/*
@@ -183,9 +183,7 @@ static av_cold int amv_init(AVFormatContext *s)
}
/* Allocate and fill dummy packet so we can pad the audio. */
- amv->apad = av_packet_alloc();
- if (!amv->apad)
- return AVERROR(ENOMEM);
+ amv->apad = ffformatcontext(s)->pkt;
if ((ret = av_new_packet(amv->apad, amv->ablock_align)) < 0) {
return ret;
}
@@ -207,7 +205,6 @@ static void amv_deinit(AVFormatContext *s)
{
AMVContext *amv = s->priv_data;
- av_packet_free(&amv->apad);
av_packet_free(&amv->vpad);
}