From 2ca979425f882183b67adc143a3a4062104b4c5a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 08:25:17 +0200 Subject: [PATCH] MusicChunk: copy AudioFormat only when chunk is empty --- src/MusicChunk.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MusicChunk.cxx b/src/MusicChunk.cxx index 07ec1bc19..0caeec46f 100644 --- a/src/MusicChunk.cxx +++ b/src/MusicChunk.cxx @@ -52,6 +52,10 @@ MusicChunk::Write(const AudioFormat af, bit_rate = _bit_rate; time = data_time; + +#ifndef NDEBUG + audio_format = af; +#endif } const size_t frame_size = af.GetFrameSize(); @@ -59,10 +63,6 @@ MusicChunk::Write(const AudioFormat af, if (num_frames == 0) return WritableBuffer::Null(); -#ifndef NDEBUG - audio_format = af; -#endif - return { data + length, num_frames * frame_size }; }