aaudio: write if there is room
Go ahead and write the data to the buffer if there is room,
even if it exceeds the setBufferSizeInFrames().
There is no point of holding it in the application buffer.
By making the data available to the DSP we can reduce glitches
or reduce latency.
Because this offers better glitch protection, we can allow
setBufferSizeInFrames() to accept a buffer size of zero.
This will provide the lowest possible latency.
Test: OboeTester glitch test
Change-Id: Ie706867c5dd57c29b4393c806cd51ae09198873e
diff --git a/media/libaaudio/src/client/AudioStreamInternal.h b/media/libaaudio/src/client/AudioStreamInternal.h
index 9395416..596d37f 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.h
+++ b/media/libaaudio/src/client/AudioStreamInternal.h
@@ -204,6 +204,9 @@
// Sometimes the hardware is operating with a different channel count from the app.
// Then we require conversion in AAudio.
int32_t mDeviceChannelCount = 0;
+
+ int32_t mBufferSizeInFrames = 0; // local threshold to control latency
+
};
} /* namespace aaudio */