aaudio: fix returned performanceMode for Legacy
AAudio was setting the stream to PERFORMANCE_MODE_NONE
if we got the FAST mixer but did not get the RAW flag.
We now consider FAST flag by itself to be LOW_LATENCY.
Bug: 63004643
Test: see bug for repro case using NativeOboe app
Change-Id: Id4643d20926a8e983cd28408f70e176976c02195
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.cpp b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
index 51440d6..155362c 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
@@ -171,14 +171,13 @@
setDeviceId(mAudioTrack->getRoutedDeviceId());
mAudioTrack->addAudioDeviceCallback(mDeviceCallback);
- // Update performance mode based on the actual stream.
+ // Update performance mode based on the actual stream flags.
// For example, if the sample rate is not allowed then you won't get a FAST track.
audio_output_flags_t actualFlags = mAudioTrack->getFlags();
aaudio_performance_mode_t actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
- if ((actualFlags & (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW))
- == (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW)) {
+ // We may not get the RAW flag. But as long as we get the FAST flag we can call it LOW_LATENCY.
+ if ((actualFlags & AUDIO_OUTPUT_FLAG_FAST) != 0) {
actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;
-
} else if ((actualFlags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) != 0) {
actualPerformanceMode = AAUDIO_PERFORMANCE_MODE_POWER_SAVING;
}