X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fencode.c;h=d9761515aa84e2ccdf5040fdabd6fb9af310bc4f;hb=4dd2c8b9ea46b4e008a8bfc2077834428cd5a17c;hp=71b1b14afc029dfb5ea61afc22a668bbc0b02e46;hpb=d2ad6f11920e972d0ef53121f74d9e25a3eb4304;p=ffmpeg diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 71b1b14afc0..d9761515aa8 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; } }