diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-06-11 00:22:53 +0200 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2020-06-11 00:27:15 +0200 |
commit | 8ce43f4fd6d030d77ca168591d6de0630bce9cc8 (patch) | |
tree | bc305219e3b0b39649e83f5022a54c29ea18eea7 /src/sources | |
parent | f3dcc8a141040ef357a58703bc12ce6ee23e7f03 (diff) |
Improve readability by skipping the remaining loop body
Diffstat (limited to 'src/sources')
-rw-r--r-- | src/sources/soundsourcem4a.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/sources/soundsourcem4a.cpp b/src/sources/soundsourcem4a.cpp index a8af06c11c..6f25143002 100644 --- a/src/sources/soundsourcem4a.cpp +++ b/src/sources/soundsourcem4a.cpp @@ -794,17 +794,21 @@ ReadableSampleFrames SoundSourceM4A::readSampleFramesClamped( numberOfSamplesRemaining -= numberOfSamplesRead; } DEBUG_ASSERT(isValidFrameIndex(m_curFrameIndex)); - if (!retryAfterReopeningDecoder) { - DEBUG_ASSERT(numberOfSamplesTotal >= numberOfSamplesRemaining); - const SINT numberOfSamples = numberOfSamplesTotal - numberOfSamplesRemaining; - return ReadableSampleFrames( - IndexRange::forward( - firstFrameIndex, - getSignalInfo().samples2frames(numberOfSamples)), - SampleBuffer::ReadableSlice( - writableSampleFrames.writableData(), - std::min(writableSampleFrames.writableLength(), numberOfSamples))); + if (retryAfterReopeningDecoder) { + // Continue by retrying to decode the current sample block again + // with a new decoder instance after errors occurred. + continue; } + // The current sample block has been decoded successfully + DEBUG_ASSERT(numberOfSamplesTotal >= numberOfSamplesRemaining); + const SINT numberOfSamples = numberOfSamplesTotal - numberOfSamplesRemaining; + return ReadableSampleFrames( + IndexRange::forward( + firstFrameIndex, + getSignalInfo().samples2frames(numberOfSamples)), + SampleBuffer::ReadableSlice( + writableSampleFrames.writableData(), + std::min(writableSampleFrames.writableLength(), numberOfSamples))); } while (retryAfterReopeningDecoder); DEBUG_ASSERT(!"unreachable"); return {}; |