audio: Add pause, resume, and standby stream operations
Clarify and verify in VTS that the data FMQ of StreamDescriptor
is a transient buffer. The consumer must always read its entire
contents. This is the same behavior as in the HIDL HAL.
Define the state machine for streams and the set of commands for
transferring between states.
Clarify and verify in VTS that the frame counter of the
observable position must never be reset.
Implement commands for the synchronous I/O case.
Refactor stream test logic to simplify testing of state
transitions.
Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ibed7f4c3e77852863714f1910112f664b32d5897
diff --git a/audio/aidl/common/include/StreamWorker.h b/audio/aidl/common/include/StreamWorker.h
index 88235c2..ab2ec26 100644
--- a/audio/aidl/common/include/StreamWorker.h
+++ b/audio/aidl/common/include/StreamWorker.h
@@ -39,6 +39,9 @@
~ThreadController() { stop(); }
bool start(const std::string& name, int priority);
+ // Note: 'pause' and 'resume' methods should only be used on the "driving" side.
+ // In the case of audio HAL I/O, the driving side is the client, because the HAL
+ // implementation always blocks on getting a command.
void pause() { switchWorkerStateSync(WorkerState::RUNNING, WorkerState::PAUSE_REQUESTED); }
void resume() { switchWorkerStateSync(WorkerState::PAUSED, WorkerState::RESUME_REQUESTED); }
bool hasError() {