diff options
author | Mikhail Naganov <mnaganov@google.com> | 2024-04-18 18:15:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-18 18:15:22 +0000 |
commit | d9ae2399d2b9dc7e41b6e4a60897e33a5facde7b (patch) | |
tree | ef2526734de19c54f8bd86809668d9e9baeccbd6 | |
parent | bd98dc515dcf63b0f65f1a7fc7510208944589a7 (diff) | |
parent | b27cb9babb7f0a5b8d579ca92e59e56f2e11dcd7 (diff) | |
download | av-d9ae2399d2b9dc7e41b6e4a60897e33a5facde7b.tar.gz |
Merge "libaudiohal@aidl: Handle stream resume uniformly" into main
-rw-r--r-- | media/libaudiohal/impl/StreamHalAidl.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/media/libaudiohal/impl/StreamHalAidl.cpp b/media/libaudiohal/impl/StreamHalAidl.cpp index 0af164f0a7..97c9659a36 100644 --- a/media/libaudiohal/impl/StreamHalAidl.cpp +++ b/media/libaudiohal/impl/StreamHalAidl.cpp @@ -366,24 +366,26 @@ status_t StreamHalAidl::resume(StreamDescriptor::Reply* reply) { if (mIsInput) { return sendCommand(makeHalCommand<HalCommand::Tag::burst>(0), reply); } else { - if (mContext.isAsynchronous()) { + if (const auto state = getState(); state == StreamDescriptor::State::IDLE) { // Handle pause-flush-resume sequence. 'flush' from PAUSED goes to // IDLE. We move here from IDLE to ACTIVE (same as 'start' from PAUSED). - const auto state = getState(); - if (state == StreamDescriptor::State::IDLE) { - StreamDescriptor::Reply localReply{}; - StreamDescriptor::Reply* innerReply = reply ?: &localReply; - RETURN_STATUS_IF_ERROR( - sendCommand(makeHalCommand<HalCommand::Tag::burst>(0), innerReply)); - if (innerReply->state != StreamDescriptor::State::ACTIVE) { - ALOGE("%s: unexpected stream state: %s (expected ACTIVE)", - __func__, toString(innerReply->state).c_str()); - return INVALID_OPERATION; - } - return OK; + StreamDescriptor::Reply localReply{}; + StreamDescriptor::Reply* innerReply = reply ?: &localReply; + RETURN_STATUS_IF_ERROR( + sendCommand(makeHalCommand<HalCommand::Tag::burst>(0), innerReply)); + if (innerReply->state != StreamDescriptor::State::ACTIVE) { + ALOGE("%s: unexpected stream state: %s (expected ACTIVE)", + __func__, toString(innerReply->state).c_str()); + return INVALID_OPERATION; } + return OK; + } else if (state == StreamDescriptor::State::PAUSED) { + return sendCommand(makeHalCommand<HalCommand::Tag::start>(), reply); + } else { + ALOGE("%s: unexpected stream state: %s (expected IDLE or PAUSED)", + __func__, toString(state).c_str()); + return INVALID_OPERATION; } - return sendCommand(makeHalCommand<HalCommand::Tag::start>(), reply); } } |