1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

lavc/decode: deduplicate cleanup in ff_decode_receive_frame()

This commit is contained in:
Anton Khirnov
2023-01-05 10:31:09 +01:00
parent 5bf8f29135
commit a1eec66867

View File

@@ -685,10 +685,8 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
ret = apply_cropping(avctx, frame); ret = apply_cropping(avctx, frame);
if (ret < 0) { if (ret < 0)
av_frame_unref(frame); goto fail;
return ret;
}
} }
avctx->frame_number++; avctx->frame_number++;
@@ -706,10 +704,8 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
avci->initial_sample_rate = frame->sample_rate ? frame->sample_rate : avci->initial_sample_rate = frame->sample_rate ? frame->sample_rate :
avctx->sample_rate; avctx->sample_rate;
ret = av_channel_layout_copy(&avci->initial_ch_layout, &frame->ch_layout); ret = av_channel_layout_copy(&avci->initial_ch_layout, &frame->ch_layout);
if (ret < 0) { if (ret < 0)
av_frame_unref(frame); goto fail;
return ret;
}
break; break;
} }
} }
@@ -735,12 +731,15 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
" drop count: %d \n", " drop count: %d \n",
avctx->frame_number, frame->pts, avctx->frame_number, frame->pts,
avci->changed_frames_dropped); avci->changed_frames_dropped);
av_frame_unref(frame); ret = AVERROR_INPUT_CHANGED;
return AVERROR_INPUT_CHANGED; goto fail;
} }
} }
} }
return 0; return 0;
fail:
av_frame_unref(frame);
return ret;
} }
static void get_subtitle_defaults(AVSubtitle *sub) static void get_subtitle_defaults(AVSubtitle *sub)