summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-02-27 19:22:37 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-01 01:34:26 +0100
commit85fc5a0c3f39a00d18af2fb9e2d25a3471052684 (patch)
tree7fd0b3292f4f3d6a4f488e96d3fa614fefd27219
parent4e14a8e6be99c90fabd62b61a5959fb187ddb3a6 (diff)
avcodec/libxevd: Avoid cloning AVPacket
Cloning a packet whose source is going to be unreferenced immediately afterwards is wasteful. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/libxevd.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavcodec/libxevd.c b/libavcodec/libxevd.c
index 6ea77077f2..c6b87d5488 100644
--- a/libavcodec/libxevd.c
+++ b/libavcodec/libxevd.c
@@ -286,17 +286,14 @@ static int libxevd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
XEVD_STAT stat;
XEVD_BITB bitb;
int nalu_size;
- AVPacket* pkt_au;
+ AVPacket *pkt_au = av_packet_alloc();
imgb = NULL;
- pkt_au = av_packet_clone(pkt);
if (!pkt_au) {
- av_log(avctx, AV_LOG_ERROR, "Cannot clone AVPacket\n");
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
-
- av_packet_unref(pkt);
+ FFSWAP(AVPacket*, pkt_au, xectx->pkt);
// get all nal units from AU
while(pkt_au->size > (bs_read_pos + XEVD_NAL_UNIT_LENGTH_BYTE)) {