You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/libopusenc: Remove redundant av_packet_unref()
The AVPacket given to an encoder's encode callback is unreferenced generically on error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -512,18 +512,14 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
|
|
||||||
discard_padding = opus->opts.packet_size - avpkt->duration;
|
discard_padding = opus->opts.packet_size - avpkt->duration;
|
||||||
// Check if subtraction resulted in an overflow
|
// Check if subtraction resulted in an overflow
|
||||||
if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) {
|
if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0))
|
||||||
av_packet_unref(avpkt);
|
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
|
||||||
if (discard_padding > 0) {
|
if (discard_padding > 0) {
|
||||||
uint8_t* side_data = av_packet_new_side_data(avpkt,
|
uint8_t* side_data = av_packet_new_side_data(avpkt,
|
||||||
AV_PKT_DATA_SKIP_SAMPLES,
|
AV_PKT_DATA_SKIP_SAMPLES,
|
||||||
10);
|
10);
|
||||||
if(!side_data) {
|
if (!side_data)
|
||||||
av_packet_unref(avpkt);
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
AV_WL32(side_data + 4, discard_padding);
|
AV_WL32(side_data + 4, discard_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user