Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoundSourceM4A: Reconfigure decoder after channel config errors #2850

Merged
merged 20 commits into from
Jun 13, 2020
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve readability by skipping the remaining loop body
  • Loading branch information
uklotzde committed Jun 10, 2020
commit 8ce43f4fd6d030d77ca168591d6de0630bce9cc8
24 changes: 14 additions & 10 deletions src/sources/soundsourcem4a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down