summaryrefslogtreecommitdiff
path: root/libavcodec/encode.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-24 21:58:56 -0300
committerJames Almer <jamrial@gmail.com>2018-04-01 23:40:42 -0300
commite61d8b82a2ca866582454c6c90ffad664e2bb5e1 (patch)
treeea73d71b4907ca87b4c7842434bbbc35384eb02d /libavcodec/encode.c
parentde0526070eb173b86e85c87b5d45b042a7590202 (diff)
avcodec/encode: use av_packet_make_refcounted to ensure packets are ref counted
Simplifies code. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r--libavcodec/encode.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 71b1b14afc..d9761515aa 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -223,12 +223,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
avpkt->buf = user_pkt.buf;
avpkt->data = user_pkt.data;
} else if (!avpkt->buf) {
- AVPacket tmp = { 0 };
- ret = av_packet_ref(&tmp, avpkt);
- av_packet_unref(avpkt);
+ ret = av_packet_make_refcounted(avpkt);
if (ret < 0)
goto end;
- *avpkt = tmp;
}
}
@@ -318,12 +315,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
avpkt->buf = user_pkt.buf;
avpkt->data = user_pkt.data;
} else if (!avpkt->buf) {
- AVPacket tmp = { 0 };
- ret = av_packet_ref(&tmp, avpkt);
- av_packet_unref(avpkt);
+ ret = av_packet_make_refcounted(avpkt);
if (ret < 0)
return ret;
- *avpkt = tmp;
}
}