avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as a drop in replacement. Deprecate `av_free_packet`.
This commit is contained in:
@@ -1200,7 +1200,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
*got_packet_ptr = 0;
|
||||
|
||||
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
|
||||
av_free_packet(avpkt);
|
||||
av_packet_unref(avpkt);
|
||||
av_init_packet(avpkt);
|
||||
return 0;
|
||||
}
|
||||
@@ -1276,7 +1276,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if (ret < 0 || !*got_packet_ptr) {
|
||||
av_free_packet(avpkt);
|
||||
av_packet_unref(avpkt);
|
||||
av_init_packet(avpkt);
|
||||
goto end;
|
||||
}
|
||||
@@ -1307,7 +1307,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
|
||||
*got_packet_ptr = 0;
|
||||
|
||||
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
|
||||
av_free_packet(avpkt);
|
||||
av_packet_unref(avpkt);
|
||||
av_init_packet(avpkt);
|
||||
avpkt->size = 0;
|
||||
return 0;
|
||||
@@ -1335,7 +1335,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if (ret < 0 || !*got_packet_ptr)
|
||||
av_free_packet(avpkt);
|
||||
av_packet_unref(avpkt);
|
||||
|
||||
emms_c();
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user