Loading audio/aidl/default/Stream.cpp +26 −13 Original line number Diff line number Diff line Loading @@ -135,10 +135,16 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { mState = StreamDescriptor::State::ERROR; return Status::ABORT; } LOG(DEBUG) << __func__ << ": received command " << command.toString() << " in " << kThreadName; using Tag = StreamDescriptor::Command::Tag; using LogSeverity = ::android::base::LogSeverity; const LogSeverity severity = command.getTag() == Tag::burst || command.getTag() == Tag::getStatus ? LogSeverity::VERBOSE : LogSeverity::DEBUG; LOG(severity) << __func__ << ": received command " << command.toString() << " in " << kThreadName; StreamDescriptor::Reply reply{}; reply.status = STATUS_BAD_VALUE; using Tag = StreamDescriptor::Command::Tag; switch (command.getTag()) { case Tag::halReservedExit: if (const int32_t cookie = command.get<Tag::halReservedExit>(); Loading Loading @@ -166,7 +172,7 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { break; case Tag::burst: if (const int32_t fmqByteCount = command.get<Tag::burst>(); fmqByteCount >= 0) { LOG(DEBUG) << __func__ << ": '" << toString(command.getTag()) << "' command for " LOG(VERBOSE) << __func__ << ": '" << toString(command.getTag()) << "' command for " << fmqByteCount << " bytes"; if (mState == StreamDescriptor::State::IDLE || mState == StreamDescriptor::State::ACTIVE || Loading Loading @@ -253,7 +259,7 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { break; } reply.state = mState; LOG(DEBUG) << __func__ << ": writing reply " << reply.toString(); LOG(severity) << __func__ << ": writing reply " << reply.toString(); if (!mReplyMQ->writeBlocking(&reply, 1)) { LOG(ERROR) << __func__ << ": writing of reply " << reply.toString() << " to MQ failed"; mState = StreamDescriptor::State::ERROR; Loading Loading @@ -284,7 +290,7 @@ bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply if (bool success = actualByteCount > 0 ? mDataMQ->write(&mDataBuffer[0], actualByteCount) : true; success) { LOG(DEBUG) << __func__ << ": writing of " << actualByteCount << " bytes into data MQ" LOG(VERBOSE) << __func__ << ": writing of " << actualByteCount << " bytes into data MQ" << " succeeded; connected? " << isConnected; // Frames are provided and counted regardless of connection status. reply->fmqByteCount += actualByteCount; Loading Loading @@ -340,7 +346,14 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { mState = StreamDescriptor::State::ERROR; return Status::ABORT; } LOG(DEBUG) << __func__ << ": received command " << command.toString() << " in " << kThreadName; using Tag = StreamDescriptor::Command::Tag; using LogSeverity = ::android::base::LogSeverity; const LogSeverity severity = command.getTag() == Tag::burst || command.getTag() == Tag::getStatus ? LogSeverity::VERBOSE : LogSeverity::DEBUG; LOG(severity) << __func__ << ": received command " << command.toString() << " in " << kThreadName; StreamDescriptor::Reply reply{}; reply.status = STATUS_BAD_VALUE; using Tag = StreamDescriptor::Command::Tag; Loading Loading @@ -383,7 +396,7 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { } break; case Tag::burst: if (const int32_t fmqByteCount = command.get<Tag::burst>(); fmqByteCount >= 0) { LOG(DEBUG) << __func__ << ": '" << toString(command.getTag()) << "' command for " LOG(VERBOSE) << __func__ << ": '" << toString(command.getTag()) << "' command for " << fmqByteCount << " bytes"; if (mState != StreamDescriptor::State::ERROR && mState != StreamDescriptor::State::TRANSFERRING && Loading Loading @@ -499,7 +512,7 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { break; } reply.state = mState; LOG(DEBUG) << __func__ << ": writing reply " << reply.toString(); LOG(severity) << __func__ << ": writing reply " << reply.toString(); if (!mReplyMQ->writeBlocking(&reply, 1)) { LOG(ERROR) << __func__ << ": writing of reply " << reply.toString() << " to MQ failed"; mState = StreamDescriptor::State::ERROR; Loading @@ -514,7 +527,7 @@ bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* rep int32_t latency = Module::kLatencyMs; if (bool success = readByteCount > 0 ? mDataMQ->read(&mDataBuffer[0], readByteCount) : true) { const bool isConnected = mIsConnected; LOG(DEBUG) << __func__ << ": reading of " << readByteCount << " bytes from data MQ" LOG(VERBOSE) << __func__ << ": reading of " << readByteCount << " bytes from data MQ" << " succeeded; connected? " << isConnected; // Amount of data that the HAL module is going to actually use. size_t byteCount = std::min({clientSize, readByteCount, mDataBufferSize}); Loading audio/aidl/default/main.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ int main() { // This is a debug implementation, always enable debug logging. android::base::SetMinimumLogSeverity(::android::base::DEBUG); // For more logs, use VERBOSE, however this may hinder performance. // android::base::SetMinimumLogSeverity(::android::base::VERBOSE); ABinderProcess_setThreadPoolMaxThreadCount(16); // Make the default config service Loading Loading
audio/aidl/default/Stream.cpp +26 −13 Original line number Diff line number Diff line Loading @@ -135,10 +135,16 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { mState = StreamDescriptor::State::ERROR; return Status::ABORT; } LOG(DEBUG) << __func__ << ": received command " << command.toString() << " in " << kThreadName; using Tag = StreamDescriptor::Command::Tag; using LogSeverity = ::android::base::LogSeverity; const LogSeverity severity = command.getTag() == Tag::burst || command.getTag() == Tag::getStatus ? LogSeverity::VERBOSE : LogSeverity::DEBUG; LOG(severity) << __func__ << ": received command " << command.toString() << " in " << kThreadName; StreamDescriptor::Reply reply{}; reply.status = STATUS_BAD_VALUE; using Tag = StreamDescriptor::Command::Tag; switch (command.getTag()) { case Tag::halReservedExit: if (const int32_t cookie = command.get<Tag::halReservedExit>(); Loading Loading @@ -166,7 +172,7 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { break; case Tag::burst: if (const int32_t fmqByteCount = command.get<Tag::burst>(); fmqByteCount >= 0) { LOG(DEBUG) << __func__ << ": '" << toString(command.getTag()) << "' command for " LOG(VERBOSE) << __func__ << ": '" << toString(command.getTag()) << "' command for " << fmqByteCount << " bytes"; if (mState == StreamDescriptor::State::IDLE || mState == StreamDescriptor::State::ACTIVE || Loading Loading @@ -253,7 +259,7 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { break; } reply.state = mState; LOG(DEBUG) << __func__ << ": writing reply " << reply.toString(); LOG(severity) << __func__ << ": writing reply " << reply.toString(); if (!mReplyMQ->writeBlocking(&reply, 1)) { LOG(ERROR) << __func__ << ": writing of reply " << reply.toString() << " to MQ failed"; mState = StreamDescriptor::State::ERROR; Loading Loading @@ -284,7 +290,7 @@ bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply if (bool success = actualByteCount > 0 ? mDataMQ->write(&mDataBuffer[0], actualByteCount) : true; success) { LOG(DEBUG) << __func__ << ": writing of " << actualByteCount << " bytes into data MQ" LOG(VERBOSE) << __func__ << ": writing of " << actualByteCount << " bytes into data MQ" << " succeeded; connected? " << isConnected; // Frames are provided and counted regardless of connection status. reply->fmqByteCount += actualByteCount; Loading Loading @@ -340,7 +346,14 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { mState = StreamDescriptor::State::ERROR; return Status::ABORT; } LOG(DEBUG) << __func__ << ": received command " << command.toString() << " in " << kThreadName; using Tag = StreamDescriptor::Command::Tag; using LogSeverity = ::android::base::LogSeverity; const LogSeverity severity = command.getTag() == Tag::burst || command.getTag() == Tag::getStatus ? LogSeverity::VERBOSE : LogSeverity::DEBUG; LOG(severity) << __func__ << ": received command " << command.toString() << " in " << kThreadName; StreamDescriptor::Reply reply{}; reply.status = STATUS_BAD_VALUE; using Tag = StreamDescriptor::Command::Tag; Loading Loading @@ -383,7 +396,7 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { } break; case Tag::burst: if (const int32_t fmqByteCount = command.get<Tag::burst>(); fmqByteCount >= 0) { LOG(DEBUG) << __func__ << ": '" << toString(command.getTag()) << "' command for " LOG(VERBOSE) << __func__ << ": '" << toString(command.getTag()) << "' command for " << fmqByteCount << " bytes"; if (mState != StreamDescriptor::State::ERROR && mState != StreamDescriptor::State::TRANSFERRING && Loading Loading @@ -499,7 +512,7 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { break; } reply.state = mState; LOG(DEBUG) << __func__ << ": writing reply " << reply.toString(); LOG(severity) << __func__ << ": writing reply " << reply.toString(); if (!mReplyMQ->writeBlocking(&reply, 1)) { LOG(ERROR) << __func__ << ": writing of reply " << reply.toString() << " to MQ failed"; mState = StreamDescriptor::State::ERROR; Loading @@ -514,7 +527,7 @@ bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* rep int32_t latency = Module::kLatencyMs; if (bool success = readByteCount > 0 ? mDataMQ->read(&mDataBuffer[0], readByteCount) : true) { const bool isConnected = mIsConnected; LOG(DEBUG) << __func__ << ": reading of " << readByteCount << " bytes from data MQ" LOG(VERBOSE) << __func__ << ": reading of " << readByteCount << " bytes from data MQ" << " succeeded; connected? " << isConnected; // Amount of data that the HAL module is going to actually use. size_t byteCount = std::min({clientSize, readByteCount, mDataBufferSize}); Loading
audio/aidl/default/main.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ int main() { // This is a debug implementation, always enable debug logging. android::base::SetMinimumLogSeverity(::android::base::DEBUG); // For more logs, use VERBOSE, however this may hinder performance. // android::base::SetMinimumLogSeverity(::android::base::VERBOSE); ABinderProcess_setThreadPoolMaxThreadCount(16); // Make the default config service Loading