diff options
Diffstat (limited to 'audio/2.0/default/StreamIn.cpp')
-rw-r--r-- | audio/2.0/default/StreamIn.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp index b81cbb924f..9c933a9201 100644 --- a/audio/2.0/default/StreamIn.cpp +++ b/audio/2.0/default/StreamIn.cpp @@ -347,14 +347,10 @@ Return<void> StreamIn::prepareForReading(uint32_t frameSize, sendError(Result::INVALID_ARGUMENTS); return Void(); } - // A message queue asserts if it can not handle the requested buffer, - // thus the client has to guess the maximum size it can handle - // Choose an arbitrary margin for the overhead of a message queue - size_t metadataOverhead = 100000; - if (frameSize > - (std::numeric_limits<size_t>::max() - metadataOverhead) / framesCount) { - ALOGE("Buffer too big: %u*%u bytes can not fit in a message queue", - frameSize, framesCount); + + if (frameSize > Stream::MAX_BUFFER_SIZE / framesCount) { + ALOGE("Buffer too big: %u*%u bytes > MAX_BUFFER_SIZE (%u)", frameSize, framesCount, + Stream::MAX_BUFFER_SIZE); sendError(Result::INVALID_ARGUMENTS); return Void(); } |