audio: Update 'PauseSync' scenario in AudioStreamIoOutTest

According to the definition of the 'PAUSED' state
in StreamDescriptor.aidl, s/w (the client) stops
writing once the buffer is filled up. That means, it is
allowed for an output stream not to consume data
from the MQ while in the paused state, so allow that
in the test.

Also, update the state transition sequence in the test
to flush any data after making a burst while in the 'PAUSED'
state.

Bug: 328010709
Test: atest VtsHalAudioCoreTargetTest
(cherry picked from https://android-review.googlesource.com/q/commit:22e17d43bd9a56785b9c56a65500c6b6f1e56494)
Merged-In: Icb5fd02ca4ede63d7ae33613ab66cb96f3e6df29
Change-Id: Icb5fd02ca4ede63d7ae33613ab66cb96f3e6df29
This commit is contained in:
Mikhail Naganov
2024-04-18 14:17:47 -07:00
committed by Android Build Coastguard Worker
parent 90d580b735
commit 4f2111e7fa

View File

@@ -1040,7 +1040,9 @@ class StreamWriterLogic : public StreamCommonLogic {
<< ": received invalid byte count in the reply: " << reply.fmqByteCount;
return Status::ABORT;
}
if (getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) {
// It is OK for the implementation to leave data in the MQ when the stream is paused.
if (reply.state != StreamDescriptor::State::PAUSED &&
getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) {
LOG(ERROR) << __func__ << ": the HAL module did not consume all data from the data MQ: "
<< "available to write " << getDataMQ()->availableToWrite()
<< ", total size: " << getDataMQ()->getQuantumCount();
@@ -4550,9 +4552,8 @@ std::shared_ptr<StateSequence> makePauseCommands(bool isInput, bool isSync) {
std::make_pair(State::PAUSED, kStartCommand),
std::make_pair(State::ACTIVE, kPauseCommand),
std::make_pair(State::PAUSED, kBurstCommand),
std::make_pair(State::PAUSED, kStartCommand),
std::make_pair(State::ACTIVE, kPauseCommand)},
State::PAUSED);
std::make_pair(State::PAUSED, kFlushCommand)},
State::IDLE);
if (!isSync) {
idle.children().push_back(
d->makeNodes({std::make_pair(State::TRANSFERRING, kPauseCommand),