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/AAudioServiceEndpointMMAP.cpp b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
index 01caee4..18fcd35 100644
--- a/services/oboeservice/AAudioServiceEndpointMMAP.cpp
+++ b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
@@ -111,11 +111,11 @@
mRequestedDeviceId = deviceId = getDeviceId();
// Fill in config
- aaudio_format_t aaudioFormat = getFormat();
- if (aaudioFormat == AAUDIO_UNSPECIFIED || aaudioFormat == AAUDIO_FORMAT_PCM_FLOAT) {
- aaudioFormat = AAUDIO_FORMAT_PCM_I16;
+ audio_format_t audioFormat = getFormat();
+ if (audioFormat == AUDIO_FORMAT_DEFAULT || audioFormat == AUDIO_FORMAT_PCM_FLOAT) {
+ audioFormat = AUDIO_FORMAT_PCM_16_BIT;
}
- config.format = AAudioConvert_aaudioToAndroidDataFormat(aaudioFormat);
+ config.format = audioFormat;
int32_t aaudioSampleRate = getSampleRate();
if (aaudioSampleRate == AAUDIO_UNSPECIFIED) {
@@ -230,7 +230,7 @@
goto error;
}
mFramesPerBurst = mMmapBufferinfo.burst_size_frames;
- setFormat(AAudioConvert_androidToAAudioDataFormat(config.format));
+ setFormat(config.format);
setSampleRate(config.sample_rate);
// Scale up the burst size to meet the minimum equivalent in microseconds.
@@ -250,6 +250,9 @@
", deviceId = %d, capacity = %d\n",
__func__, getSampleRate(), getSamplesPerFrame(), deviceId, getBufferCapacity());
+ ALOGD("%s() format = =x%08x, frame size = %d",
+ __func__, getFormat(), calculateBytesPerFrame());
+
return result;
error: