AAudio: Use one SRC per shared stream.
In ag/23541584, SRC was added to AAudio.
This caused issues with timestamps in shared streams.
We should use the default sample rate for the shared MMAP endpoint.
This way, each shared stream can use its own SRC.
Bug: 378766408
Test: atest AAudioTests
Test: OboeTester Test Output with shared stream and SRC
Flag: EXEMPT bugfix
Change-Id: I15c31630e770fb9ba75bfb30d41af568d386041f
diff --git a/services/oboeservice/AAudioServiceStreamShared.cpp b/services/oboeservice/AAudioServiceStreamShared.cpp
index 04fcd6d..bd58fa2 100644
--- a/services/oboeservice/AAudioServiceStreamShared.cpp
+++ b/services/oboeservice/AAudioServiceStreamShared.cpp
@@ -144,6 +144,9 @@
goto error;
}
+ // Use the sample rate of the endpoint as each shared stream should use its own SRC.
+ setSampleRate(endpoint->getSampleRate());
+
// Is the request compatible with the shared endpoint?
setFormat(configurationInput.getFormat());
if (getFormat() == AUDIO_FORMAT_DEFAULT) {
@@ -154,16 +157,6 @@
goto error;
}
- setSampleRate(configurationInput.getSampleRate());
- if (getSampleRate() == AAUDIO_UNSPECIFIED) {
- setSampleRate(endpoint->getSampleRate());
- } else if (getSampleRate() != endpoint->getSampleRate()) {
- ALOGD("%s() mSampleRate = %d, need %d",
- __func__, getSampleRate(), endpoint->getSampleRate());
- result = AAUDIO_ERROR_INVALID_RATE;
- goto error;
- }
-
setChannelMask(configurationInput.getChannelMask());
if (getChannelMask() == AAUDIO_UNSPECIFIED) {
setChannelMask(endpoint->getChannelMask());