aaudio: use new flowgraph to simplify processing
Construct a flowgraph based on the source and destination
format and channelCount. This is groundwork for supporting 24-bit
PCM formats.
Also cleaned up handling of device related format.
This CL removes more code than it adds.
Bug: 65067568
Test: write_sine_callback.cpp -pl
Test: write_sine_callback.cpp -pl -x
Test: input_monitor -pl
Test: input_monitor -pl -x
Change-Id: Ia155bff0164912011d09b61b54f983ccf4490bd1
diff --git a/services/oboeservice/AAudioServiceStreamShared.cpp b/services/oboeservice/AAudioServiceStreamShared.cpp
index b645c69..dbc2c2e 100644
--- a/services/oboeservice/AAudioServiceStreamShared.cpp
+++ b/services/oboeservice/AAudioServiceStreamShared.cpp
@@ -142,10 +142,10 @@
// Is the request compatible with the shared endpoint?
setFormat(configurationInput.getFormat());
- if (getFormat() == AAUDIO_FORMAT_UNSPECIFIED) {
- setFormat(AAUDIO_FORMAT_PCM_FLOAT);
- } else if (getFormat() != AAUDIO_FORMAT_PCM_FLOAT) {
- ALOGD("%s() mAudioFormat = %d, need FLOAT", __func__, getFormat());
+ if (getFormat() == AUDIO_FORMAT_DEFAULT) {
+ setFormat(AUDIO_FORMAT_PCM_FLOAT);
+ } else if (getFormat() != AUDIO_FORMAT_PCM_FLOAT) {
+ ALOGE("%s() audio_format_t mAudioFormat = %d, need FLOAT", __func__, getFormat());
result = AAUDIO_ERROR_INVALID_FORMAT;
goto error;
}
@@ -154,7 +154,7 @@
if (getSampleRate() == AAUDIO_UNSPECIFIED) {
setSampleRate(endpoint->getSampleRate());
} else if (getSampleRate() != endpoint->getSampleRate()) {
- ALOGD("%s() mSampleRate = %d, need %d",
+ ALOGE("%s() mSampleRate = %d, need %d",
__func__, getSampleRate(), endpoint->getSampleRate());
result = AAUDIO_ERROR_INVALID_RATE;
goto error;
@@ -164,7 +164,7 @@
if (getSamplesPerFrame() == AAUDIO_UNSPECIFIED) {
setSamplesPerFrame(endpoint->getSamplesPerFrame());
} else if (getSamplesPerFrame() != endpoint->getSamplesPerFrame()) {
- ALOGD("%s() mSamplesPerFrame = %d, need %d",
+ ALOGE("%s() mSamplesPerFrame = %d, need %d",
__func__, getSamplesPerFrame(), endpoint->getSamplesPerFrame());
result = AAUDIO_ERROR_OUT_OF_RANGE;
goto error;
@@ -191,8 +191,8 @@
}
}
- ALOGD("AAudioServiceStreamShared::open() actual rate = %d, channels = %d, deviceId = %d",
- getSampleRate(), getSamplesPerFrame(), endpoint->getDeviceId());
+ ALOGD("%s() actual rate = %d, channels = %d, deviceId = %d",
+ __func__, getSampleRate(), getSamplesPerFrame(), endpoint->getDeviceId());
result = endpoint->registerStream(keep);
if (result != AAUDIO_OK) {