Fix PatchTrack retry for ClientProxy::obtainBuffer
Restore buffer mFrameCount as error clears it.
Test: phone call with usb device, simulate underrun.
Bug: 79423841
Change-Id: Ia00d08b6753b5c65cf7f07bf1c889fd6d1eefd0a
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 49552a1..a7c4253 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -1571,9 +1571,11 @@
status_t status = NO_ERROR;
static const int32_t kMaxTries = 5;
int32_t tryCounter = kMaxTries;
+ const size_t originalFrameCount = buffer->mFrameCount;
do {
if (status == NOT_ENOUGH_DATA) {
restartIfDisabled();
+ buffer->mFrameCount = originalFrameCount; // cleared on error, must be restored.
}
status = mProxy->obtainBuffer(buffer, timeOut);
} while ((status == NOT_ENOUGH_DATA) && (tryCounter-- > 0));