Skip to content

Commit

Permalink
OboeTester: fix assert in FormatConverterBox (#2012)
Browse files Browse the repository at this point in the history
Fixed calculation of required buffer size for input format conversion.

Fixes #2011
  • Loading branch information
philburk authored Apr 30, 2024
1 parent d103042 commit b8f12a8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@

oboe::Result FullDuplexStreamWithConversion::start() {
// Determine maximum size that could possibly be called.
int32_t bufferSize = getOutputStream()->getBufferCapacityInFrames()
* getOutputStream()->getChannelCount();
mInputConverter = std::make_unique<FormatConverterBox>(bufferSize,
int32_t maxFrames = getOutputStream()->getBufferCapacityInFrames();
int32_t inputBufferSize = maxFrames * getInputStream()->getChannelCount();
int32_t outputBufferSize = maxFrames * getOutputStream()->getChannelCount();
mInputConverter = std::make_unique<FormatConverterBox>(inputBufferSize,
getInputStream()->getFormat(),
oboe::AudioFormat::Float);
mOutputConverter = std::make_unique<FormatConverterBox>(bufferSize,
mOutputConverter = std::make_unique<FormatConverterBox>(outputBufferSize,
oboe::AudioFormat::Float,
getOutputStream()->getFormat());
return FullDuplexStream::start();
Expand Down

0 comments on commit b8f12a8

Please sign in to comment.