aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-11-16 16:05:54 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-11-16 16:56:42 +0100
commit79d89cf2f4b62eeb653fd8139041c87e75f7ca65 (patch)
tree3797057ba0ed73509353a75169871aaab3626c59
parent4bb1070c154e49d35805fbcdac9c9e92f702ef96 (diff)
downloadffmpeg-79d89cf2f4b62eeb653fd8139041c87e75f7ca65.tar.gz
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>
-rw-r--r--libavcodec/flacenc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 58961b8dfa..7349f44489 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -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) {