AAudio: Add sample rate conversion to MMAP

This CL adds sample rate conversion to the MMAP path in AAudio.
AAudio no longer needs to use AudioFlinger's sample rate converter for
MMAP streams. This effectively reduces the latency from 100ms to 30ms
on speaker, 3.5mm, and USB if MMAP is enabled and sample rate conversion
is needed.

A sample rate converter is added to the AAudio flowgraph. Since input
and output sample rates are different for the flowgraph, a variable
number of frames must be used. 8 frames are passed through the flowgraph
at any given point of times and the output of the flowgraph pulls as
much data as there exists in the flowgraph.

Burst sizes, capacity, latency, frames read, and frames written are all
changed reflect the sample rate of the app.

Flowgraph was also added to input MMAP streams.

Bug: 219533889
Test: OboeTester Test Input/Output with a variety of sample rates and formats
Test: atest AAudioTests
Change-Id: I9b6a2694921ea558fb91a231f956f638d3342837
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.cpp b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
index 67ee42e..723b419 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
@@ -202,6 +202,9 @@
     setSampleRate(mAudioTrack->getSampleRate());
     setBufferCapacity(getBufferCapacityFromDevice());
     setFramesPerBurst(getFramesPerBurstFromDevice());
+    setDeviceSampleRate(mAudioTrack->getSampleRate());
+    setDeviceBufferCapacity(getBufferCapacityFromDevice());
+    setDeviceFramesPerBurst(getFramesPerBurstFromDevice());
 
     setHardwareSamplesPerFrame(mAudioTrack->getHalChannelCount());
     setHardwareSampleRate(mAudioTrack->getHalSampleRate());