1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/encode: remove usage of av_dup_packet()

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-09-26 00:24:29 -03:00
parent cf3d2d52b5
commit a22c6a4796

View File

@ -222,10 +222,12 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
}
avpkt->buf = user_pkt.buf;
avpkt->data = user_pkt.data;
} else {
if (av_dup_packet(avpkt) < 0) {
ret = AVERROR(ENOMEM);
}
} else if (!avpkt->buf) {
AVPacket tmp = { 0 };
ret = av_packet_ref(&tmp, avpkt);
if (ret < 0)
return ret;
*avpkt = tmp;
}
}
@ -318,10 +320,12 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
}
avpkt->buf = user_pkt.buf;
avpkt->data = user_pkt.data;
} else {
if (av_dup_packet(avpkt) < 0) {
ret = AVERROR(ENOMEM);
}
} else if (!avpkt->buf) {
AVPacket tmp = { 0 };
ret = av_packet_ref(&tmp, avpkt);
if (ret < 0)
return ret;
*avpkt = tmp;
}
}