Skip to content

Commit f567083

Browse files
committed
Main: refactor DEFAULT_BUFFER_SIZE to represent bytes
1 parent a2a677e commit f567083

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Main.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@
117117

118118
#include <limits.h>
119119

120-
static constexpr unsigned DEFAULT_BUFFER_SIZE = 4096;
120+
static constexpr size_t KILOBYTE = 1024;
121+
static constexpr size_t MEGABYTE = 1024 * KILOBYTE;
122+
123+
static constexpr size_t DEFAULT_BUFFER_SIZE = 4 * MEGABYTE;
121124
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
122125

123126
#ifdef ANDROID
@@ -306,12 +309,10 @@ initialize_decoder_and_player(const ReplayGainConfig &replay_gain_config)
306309
FormatFatalError("buffer size \"%s\" is not a "
307310
"positive integer, line %i",
308311
param->value.c_str(), param->line);
309-
buffer_size = tmp;
312+
buffer_size = tmp * KILOBYTE;
310313
} else
311314
buffer_size = DEFAULT_BUFFER_SIZE;
312315

313-
buffer_size *= 1024;
314-
315316
const unsigned buffered_chunks = buffer_size / CHUNK_SIZE;
316317

317318
if (buffered_chunks >= 1 << 15)

0 commit comments

Comments
 (0)