summaryrefslogtreecommitdiff
path: root/libavcodec/encode.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-26 20:47:03 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-27 00:20:53 +0200
commitad184c8e363018044715cbe9ebc0b576e54a6438 (patch)
tree149f60128cc0741d5184d51505f1f0849444dbbe /libavcodec/encode.c
parent2a623bacc8457c51477f02f06ff9eff16afb615a (diff)
avcodec/encode: Zero padding in ff_get_encode_buffer()
The documentation of the get_encode_buffer() callback does not require to zero the padding; therefore we do it in ff_get_encode_buffer(). This also constitutes an implicit check for whether the buffer is actually allocated with padding. The memset in avcodec_default_get_encode_buffer() is now redundant and has been removed. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r--libavcodec/encode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 9a4140f91a..75129c8646 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -74,7 +74,6 @@ int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, in
return ret;
}
avpkt->data = avpkt->buf->data;
- memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
return 0;
}
@@ -98,6 +97,7 @@ int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, i
ret = AVERROR(EINVAL);
goto fail;
}
+ memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
ret = 0;
fail: