Commit 00e8513d authored by Josh Coalson's avatar Josh Coalson
Browse files

fix bug in ratio calculation in print_stats()

parent e4240db0
...@@ -1933,10 +1933,10 @@ void print_stats(const EncoderSession *encoder_session) ...@@ -1933,10 +1933,10 @@ void print_stats(const EncoderSession *encoder_session)
#if defined _MSC_VER || defined __MINGW32__ #if defined _MSC_VER || defined __MINGW32__
/* with VC++ you have to spoon feed it the casting */ /* with VC++ you have to spoon feed it the casting */
const double progress = (double)(FLAC__int64)samples_written / (double)(FLAC__int64)encoder_session->total_samples_to_encode; const double progress = (double)(FLAC__int64)samples_written / (double)(FLAC__int64)encoder_session->total_samples_to_encode;
const double ratio = (double)(FLAC__int64)encoder_session->bytes_written / ((double)(FLAC__int64)encoder_session->unencoded_size * progress); const double ratio = (double)(FLAC__int64)encoder_session->bytes_written / ((double)(FLAC__int64)encoder_session->unencoded_size * min(1.0, progress));
#else #else
const double progress = (double)samples_written / (double)encoder_session->total_samples_to_encode; const double progress = (double)samples_written / (double)encoder_session->total_samples_to_encode;
const double ratio = (double)encoder_session->bytes_written / ((double)encoder_session->unencoded_size * max(1.0, progress)); const double ratio = (double)encoder_session->bytes_written / ((double)encoder_session->unencoded_size * min(1.0, progress));
#endif #endif
if(encoder_session->silent) if(encoder_session->silent)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment