summaryrefslogtreecommitdiff
path: root/audio/2.0/default/StreamIn.cpp
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2017-11-14 12:08:38 -0800
committerXin Li <delphij@google.com>2017-11-14 12:08:38 -0800
commitbb9e38fef95b7bc932ebcad18508e03228f9f7d3 (patch)
tree29e859e08879c87f591507de0f370abd1ec66fe2 /audio/2.0/default/StreamIn.cpp
parentb86b2d2881d53219c59a5eb85a3d73cb45942661 (diff)
parent1a06284b24f5eb7bb9c1fea0817da8898b3b1bff (diff)
Merge commit '1a06284b24f5eb7bb9c1fea0817da8898b3b1bff' from
oc-mr1-dev-plus-aosp into stage-aosp-master Change-Id: I2a044eb8c9981d0a8198ffe2df55559afbd76341 Merged-In: I4fb9f18884f7ef21162015a0032c4431444f7025
Diffstat (limited to 'audio/2.0/default/StreamIn.cpp')
-rw-r--r--audio/2.0/default/StreamIn.cpp12
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();
}