aaudio: modify endpoint sharing logic
A new Client stream in shared mode can share an existing endpoint
if it has no preferences or compatible device, sample rate and channel
count requests.
Bug: 62961537
Test: play and capture with AAudio in mmap mode
Change-Id: I38536fb486dfc06f4399f7d02248384583fd3a17
diff --git a/services/oboeservice/AAudioServiceEndpoint.h b/services/oboeservice/AAudioServiceEndpoint.h
index 090b1dd..72015b1 100644
--- a/services/oboeservice/AAudioServiceEndpoint.h
+++ b/services/oboeservice/AAudioServiceEndpoint.h
@@ -36,7 +36,7 @@
public:
virtual ~AAudioServiceEndpoint() = default;
- virtual aaudio_result_t open(int32_t deviceId);
+ virtual aaudio_result_t open(const AAudioStreamConfiguration& configuration);
int32_t getSampleRate() const { return mStreamInternal->getSampleRate(); }
int32_t getSamplesPerFrame() const { return mStreamInternal->getSamplesPerFrame(); }
@@ -67,6 +67,8 @@
mReferenceCount = count;
}
+ bool matches(const AAudioStreamConfiguration& configuration);
+
virtual AudioStreamInternal *getStreamInternal() = 0;
std::atomic<bool> mCallbackEnabled;