Loading audio/aidl/default/Stream.cpp +18 −12 Original line number Diff line number Diff line Loading @@ -180,17 +180,20 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { StreamDescriptor::Reply reply{}; reply.status = STATUS_BAD_VALUE; switch (command.getTag()) { case Tag::halReservedExit: if (const int32_t cookie = command.get<Tag::halReservedExit>(); cookie == (mContext->getInternalCommandCookie() ^ getTid())) { case Tag::halReservedExit: { const int32_t cookie = command.get<Tag::halReservedExit>(); if (cookie == (mContext->getInternalCommandCookie() ^ getTid())) { mDriver->shutdown(); setClosed(); // This is an internal command, no need to reply. return Status::EXIT; } else { LOG(WARNING) << __func__ << ": EXIT command has a bad cookie: " << cookie; } if (cookie != 0) { // This is an internal command, no need to reply. return Status::EXIT; } else { break; } } case Tag::getStatus: populateReply(&reply, mIsConnected); break; Loading Loading @@ -400,17 +403,20 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { 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>(); cookie == (mContext->getInternalCommandCookie() ^ getTid())) { case Tag::halReservedExit: { const int32_t cookie = command.get<Tag::halReservedExit>(); if (cookie == (mContext->getInternalCommandCookie() ^ getTid())) { mDriver->shutdown(); setClosed(); // This is an internal command, no need to reply. return Status::EXIT; } else { LOG(WARNING) << __func__ << ": EXIT command has a bad cookie: " << cookie; } if (cookie != 0) { // This is an internal command, no need to reply. return Status::EXIT; } else { break; } } case Tag::getStatus: populateReply(&reply, mIsConnected); break; Loading audio/aidl/default/include/core-impl/Stream.h +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ class StreamContext { std::weak_ptr<sounddose::StreamDataProcessorInterface> streamDataProcessor, DebugParameters debugParameters) : mCommandMQ(std::move(commandMQ)), mInternalCommandCookie(std::rand()), mInternalCommandCookie(std::rand() | 1 /* make sure it's not 0 */), mReplyMQ(std::move(replyMQ)), mFormat(format), mChannelLayout(channelLayout), Loading Loading
audio/aidl/default/Stream.cpp +18 −12 Original line number Diff line number Diff line Loading @@ -180,17 +180,20 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { StreamDescriptor::Reply reply{}; reply.status = STATUS_BAD_VALUE; switch (command.getTag()) { case Tag::halReservedExit: if (const int32_t cookie = command.get<Tag::halReservedExit>(); cookie == (mContext->getInternalCommandCookie() ^ getTid())) { case Tag::halReservedExit: { const int32_t cookie = command.get<Tag::halReservedExit>(); if (cookie == (mContext->getInternalCommandCookie() ^ getTid())) { mDriver->shutdown(); setClosed(); // This is an internal command, no need to reply. return Status::EXIT; } else { LOG(WARNING) << __func__ << ": EXIT command has a bad cookie: " << cookie; } if (cookie != 0) { // This is an internal command, no need to reply. return Status::EXIT; } else { break; } } case Tag::getStatus: populateReply(&reply, mIsConnected); break; Loading Loading @@ -400,17 +403,20 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { 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>(); cookie == (mContext->getInternalCommandCookie() ^ getTid())) { case Tag::halReservedExit: { const int32_t cookie = command.get<Tag::halReservedExit>(); if (cookie == (mContext->getInternalCommandCookie() ^ getTid())) { mDriver->shutdown(); setClosed(); // This is an internal command, no need to reply. return Status::EXIT; } else { LOG(WARNING) << __func__ << ": EXIT command has a bad cookie: " << cookie; } if (cookie != 0) { // This is an internal command, no need to reply. return Status::EXIT; } else { break; } } case Tag::getStatus: populateReply(&reply, mIsConnected); break; Loading
audio/aidl/default/include/core-impl/Stream.h +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ class StreamContext { std::weak_ptr<sounddose::StreamDataProcessorInterface> streamDataProcessor, DebugParameters debugParameters) : mCommandMQ(std::move(commandMQ)), mInternalCommandCookie(std::rand()), mInternalCommandCookie(std::rand() | 1 /* make sure it's not 0 */), mReplyMQ(std::move(replyMQ)), mFormat(format), mChannelLayout(channelLayout), Loading