aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/wavpack_decoder_plugin.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c
index efed98851..601f05065 100644
--- a/src/decoder/wavpack_decoder_plugin.c
+++ b/src/decoder/wavpack_decoder_plugin.c
@@ -197,7 +197,7 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
decoder_initialized(decoder, &audio_format, can_seek, total_time);
- do {
+ while (true) {
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
if (can_seek) {
unsigned where = decoder_seek_where(decoder) *
@@ -220,22 +220,19 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
samples_got = WavpackUnpackSamples(
wpc, (int32_t *)chunk, samples_requested
);
- if (samples_got > 0) {
- int bitrate = (int)(WavpackGetInstantBitrate(wpc) /
- 1000 + 0.5);
-
- format_samples(
- bytes_per_sample, chunk,
- samples_got * audio_format.channels
- );
-
- decoder_data(
- decoder, NULL, chunk,
- samples_got * output_sample_size,
- bitrate
- );
- }
- } while (samples_got > 0);
+
+ if (samples_got == 0)
+ break;
+
+ int bitrate = (int)(WavpackGetInstantBitrate(wpc) / 1000 +
+ 0.5);
+ format_samples(bytes_per_sample, chunk,
+ samples_got * audio_format.channels);
+
+ decoder_data(decoder, NULL, chunk,
+ samples_got * output_sample_size,
+ bitrate);
+ }
}
/**