aaudio: cache framesPerBurst and capacity
These do not change after opening the stream so we can
simply return a stored value and avoid querying the device.
Test: atest AAudioTests
Change-Id: I7a66c12bd695fd732194ff0a14ac9c8d9cacf923
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.h b/media/libaaudio/src/legacy/AudioStreamTrack.h
index 6334f66..5a8fb39 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.h
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.h
@@ -69,8 +69,6 @@
aaudio_result_t setBufferSize(int32_t requestedFrames) override;
int32_t getBufferSize() const override;
- int32_t getBufferCapacity() const override;
- int32_t getFramesPerBurst()const override;
int32_t getXRunCount() const override;
int64_t getFramesRead() override;
@@ -96,6 +94,11 @@
const android::media::VolumeShaper::Operation& operation) override;
#endif
+protected:
+
+ int32_t getFramesPerBurstFromDevice() const override;
+ int32_t getBufferCapacityFromDevice() const override;
+
private:
android::sp<android::AudioTrack> mAudioTrack;
@@ -105,10 +108,6 @@
// TODO add 64-bit position reporting to AudioTrack and use it.
aaudio_wrapping_frames_t mPositionWhenPausing = 0;
-
- // initial AudioTrack frame count and notification period
- int32_t mInitialBufferCapacity = 0;
- int32_t mInitialFramesPerBurst = 0;
};
} /* namespace aaudio */