audio: Enable more compile time checks in the default impl

Enable "-Wall, Wextra, Werror, Wthread-safety",
fix discovered issues.

Bug: 205884982
Test: m
Change-Id: I0a8d3095dd24dbb3bc7cf6569c1f71945cd55168
This commit is contained in:
Mikhail Naganov
2023-05-15 14:35:24 -07:00
parent 492dc40711
commit b511b8aa21
4 changed files with 19 additions and 17 deletions

View File

@@ -187,7 +187,7 @@ ndk::ScopedAStatus Module::createStreamContext(
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
LOG(DEBUG) << __func__ << ": frame size " << frameSize << " bytes";
if (frameSize > kMaximumStreamBufferSizeBytes / in_bufferSizeFrames) {
if (frameSize > static_cast<size_t>(kMaximumStreamBufferSizeBytes / in_bufferSizeFrames)) {
LOG(ERROR) << __func__ << ": buffer size " << in_bufferSizeFrames
<< " frames is too large, maximum size is "
<< kMaximumStreamBufferSizeBytes / frameSize;
@@ -281,7 +281,7 @@ ndk::ScopedAStatus Module::findPortIdForNewStream(int32_t in_portConfigId, Audio
<< " does not correspond to a mix port";
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
const int32_t maxOpenStreamCount = portIt->ext.get<AudioPortExt::Tag::mix>().maxOpenStreamCount;
const size_t maxOpenStreamCount = portIt->ext.get<AudioPortExt::Tag::mix>().maxOpenStreamCount;
if (maxOpenStreamCount != 0 && mStreams.count(portId) >= maxOpenStreamCount) {
LOG(ERROR) << __func__ << ": port id " << portId
<< " has already reached maximum allowed opened stream count: "