summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthik Periagaram <dekonvoluted@gmail.com>2019-01-31 20:51:30 -0800
committerErik de Castro Lopo <erikd@mega-nerd.com>2019-02-01 18:20:30 +1100
commitcc15b7427a9d4c94233dcad24cd8ed4c43f6c261 (patch)
treef3378dd984342d64c96e0b1e5b3a043d1fb89765
parent421961f00b505dcad41603305b47eda0b2ddfe92 (diff)
downloadflac-cc15b7427a9d4c94233dcad24cd8ed4c43f6c261.tar.gz
Suppress compression failure message if it is not an error
If the user specifies `--no-error-on-compression-fail`, there is no need to treat compression failure as an error. Hence, the failure message should be suppressed along with the non-zero exit code (which already is suppressed).
-rw-r--r--src/flac/encode.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/flac/encode.c b/src/flac/encode.c
index be3869f0..a106519e 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -1676,7 +1676,7 @@ int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_a
}
}
- if (e->compression_ratio >= 1.0) {
+ if (e->compression_ratio >= 1.0 && error_on_compression_fail) {
flac__utils_printf(stderr, 1,
"FAILURE: Compression failed (ratio %0.3f, should be < 1.0).\n"
"This happens for some files for one or more of the following reasons:\n"
@@ -1684,8 +1684,7 @@ int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_a
" * Insufficient input data (e.g. very short files, < 10000 frames).\n"
" * The audio data is not compressible (e.g. a full range white noise signal).\n"
, e->compression_ratio);
- if (error_on_compression_fail)
- ret = 1;
+ ret = 1;
}
EncoderSession_destroy(e);