libaudiohal@aidl: adjust pause and flush for a stream
pause: HAL pause can be achieved in one of the
playing/recording kind of states ACTIVE, TRANSFERRING,
or DRAINING. In other states, pause may be treated as success.
flush: HAL flush can be achieved in one of the flushable
states PAUSED, TRANSFER_PAUSED or DRAIN_PAUSED. In other
states, may be treated as success except for playing/recording
kind of states.
BUG: 356083752
Test: play compress offload playback
Change-Id: Ia7f3461d1c3aff87ab3398f35a431828d305543f
diff --git a/media/libaudiohal/impl/StreamHalAidl.h b/media/libaudiohal/impl/StreamHalAidl.h
index 62a1737..baf4ac0 100644
--- a/media/libaudiohal/impl/StreamHalAidl.h
+++ b/media/libaudiohal/impl/StreamHalAidl.h
@@ -230,6 +230,31 @@
return false;
}
+ bool isInPlayOrRecordState(
+ const ::aidl::android::hardware::audio::core::StreamDescriptor::State state) {
+ if (state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::ACTIVE ||
+ state ==
+ ::aidl::android::hardware::audio::core::StreamDescriptor::State::TRANSFERRING ||
+ state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::DRAINING) {
+ // play or record equivalent states
+ return true;
+ }
+ return false;
+ }
+
+ bool isInPausedState(
+ const ::aidl::android::hardware::audio::core::StreamDescriptor::State& state) {
+ if (state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::PAUSED ||
+ state ==
+ ::aidl::android::hardware::audio::core::StreamDescriptor::State::DRAIN_PAUSED ||
+ state == ::aidl::android::hardware::audio::core::StreamDescriptor::State::
+ TRANSFER_PAUSED) {
+ // pause equivalent states
+ return true;
+ }
+ return false;
+ }
+
status_t getLatency(uint32_t *latency);
// Always returns non-negative values.