aaudio: fix return code from getTimestamp()
Should be AAUDIO_ERROR_INVALID_STATE if no timestamp available.
Bug: 65447871
Test: test_timestamps.cpp should only print AAUDIO_ERROR_INVALID_STATE
Change-Id: Id9e211ef8fce078514f4348a434e0c003372369c
diff --git a/media/libaaudio/src/legacy/AudioStreamLegacy.cpp b/media/libaaudio/src/legacy/AudioStreamLegacy.cpp
index ee29177..a59fc6f 100644
--- a/media/libaaudio/src/legacy/AudioStreamLegacy.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamLegacy.cpp
@@ -163,7 +163,11 @@
// (long long) extendedTimestamp->mPosition[ExtendedTimestamp::Location::LOCATION_SERVER],
// (long long) extendedTimestamp->mPosition[ExtendedTimestamp::Location::LOCATION_KERNEL],
// (int)location);
- return AAudioConvert_androidToAAudioResult(status);
+ if (status == WOULD_BLOCK) {
+ return AAUDIO_ERROR_INVALID_STATE;
+ } else {
+ return AAudioConvert_androidToAAudioResult(status);
+ }
}
void AudioStreamLegacy::onAudioDeviceUpdate(audio_port_handle_t deviceId)