mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
flacenc: Clamp user-supplied min/max prediction orders
This mimics what the code does internally for default order values. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
parent
4bb1070c15
commit
79d89cf2f4
@ -330,9 +330,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
} else if (avctx->min_prediction_order >= 0) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
|
||||
if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
|
||||
avctx->min_prediction_order);
|
||||
return -1;
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"invalid min prediction order %d, clamped to %d\n",
|
||||
avctx->min_prediction_order, MAX_FIXED_ORDER);
|
||||
avctx->min_prediction_order = MAX_FIXED_ORDER;
|
||||
}
|
||||
} else if (avctx->min_prediction_order < MIN_LPC_ORDER ||
|
||||
avctx->min_prediction_order > MAX_LPC_ORDER) {
|
||||
@ -347,9 +348,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
||||
} else if (avctx->max_prediction_order >= 0) {
|
||||
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
|
||||
if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
|
||||
avctx->max_prediction_order);
|
||||
return -1;
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"invalid max prediction order %d, clamped to %d\n",
|
||||
avctx->max_prediction_order, MAX_FIXED_ORDER);
|
||||
avctx->max_prediction_order = MAX_FIXED_ORDER;
|
||||
}
|
||||
} else if (avctx->max_prediction_order < MIN_LPC_ORDER ||
|
||||
avctx->max_prediction_order > MAX_LPC_ORDER) {
|
||||
|
Loading…
Reference in New Issue
Block a user