avcodec/ratecontrol: Don't call ff_rate_control_uninit() ourselves

It is currently done inconsistently: Only one error path
(namely the one from init_pass2()) made ff_rate_control_init()
call ff_rate_control_uninit(); in other error paths
cleanup was left to the caller.

Given that the only caller of this function already performs
the necessary cleanup this commit changes this to always
rely on the caller to perform cleanup on error.

Also return the error code from init_pass2().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-05-04 19:11:11 +02:00
parent 0c9e04b0e2
commit 68a06640b1
1 changed files with 3 additions and 4 deletions

View File

@ -622,10 +622,9 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
p = next;
}
if (init_pass2(s) < 0) {
ff_rate_control_uninit(rcc);
return -1;
}
res = init_pass2(s);
if (res < 0)
return res;
}
if (!(s->avctx->flags & AV_CODEC_FLAG_PASS2)) {