mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
avcodec/encode: use av_packet_make_refcounted to ensure packets are ref counted
Simplifies code. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
de0526070e
commit
e61d8b82a2
@ -223,12 +223,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
|||||||
avpkt->buf = user_pkt.buf;
|
avpkt->buf = user_pkt.buf;
|
||||||
avpkt->data = user_pkt.data;
|
avpkt->data = user_pkt.data;
|
||||||
} else if (!avpkt->buf) {
|
} else if (!avpkt->buf) {
|
||||||
AVPacket tmp = { 0 };
|
ret = av_packet_make_refcounted(avpkt);
|
||||||
ret = av_packet_ref(&tmp, avpkt);
|
|
||||||
av_packet_unref(avpkt);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto end;
|
goto end;
|
||||||
*avpkt = tmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,12 +315,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
|
|||||||
avpkt->buf = user_pkt.buf;
|
avpkt->buf = user_pkt.buf;
|
||||||
avpkt->data = user_pkt.data;
|
avpkt->data = user_pkt.data;
|
||||||
} else if (!avpkt->buf) {
|
} else if (!avpkt->buf) {
|
||||||
AVPacket tmp = { 0 };
|
ret = av_packet_make_refcounted(avpkt);
|
||||||
ret = av_packet_ref(&tmp, avpkt);
|
|
||||||
av_packet_unref(avpkt);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
*avpkt = tmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user