Merge "audio: Fix HAL reply handling in CompressedOffloadOutputStreamTest" am: 9cce6228ac
am: c514b58a86
am: 4c05c74940
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2279888 Change-Id: Ia1b0ea860d11d1a05c84e5b5042c825960c6b322 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
42b6d74027
1 changed files with 7 additions and 3 deletions
|
@ -1014,9 +1014,8 @@ class StreamWriter : public StreamWorker<StreamWriter> {
|
||||||
if (mDataPosition == 0) mOnDataStart();
|
if (mDataPosition == 0) mOnDataStart();
|
||||||
const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite());
|
const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite());
|
||||||
bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize);
|
bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize);
|
||||||
|
bool wrapped = false;
|
||||||
ALOGE_IF(!success, "data message queue write failed");
|
ALOGE_IF(!success, "data message queue write failed");
|
||||||
mDataPosition += dataSize;
|
|
||||||
if (mDataPosition >= mData.size()) mDataPosition = 0;
|
|
||||||
mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY));
|
mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY));
|
||||||
|
|
||||||
uint32_t efState = 0;
|
uint32_t efState = 0;
|
||||||
|
@ -1034,6 +1033,11 @@ class StreamWriter : public StreamWorker<StreamWriter> {
|
||||||
ALOGE("bad write status: %d", writeStatus.retval);
|
ALOGE("bad write status: %d", writeStatus.retval);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
mDataPosition += writeStatus.reply.written;
|
||||||
|
if (mDataPosition >= mData.size()) {
|
||||||
|
mDataPosition = 0;
|
||||||
|
wrapped = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ret == -EAGAIN || ret == -EINTR) {
|
if (ret == -EAGAIN || ret == -EINTR) {
|
||||||
// Spurious wakeup. This normally retries no more than once.
|
// Spurious wakeup. This normally retries no more than once.
|
||||||
|
@ -1042,7 +1046,7 @@ class StreamWriter : public StreamWorker<StreamWriter> {
|
||||||
ALOGE("bad wait status: %d", ret);
|
ALOGE("bad wait status: %d", ret);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if (success && mDataPosition == 0) {
|
if (wrapped) {
|
||||||
success = mOnDataWrap();
|
success = mOnDataWrap();
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
|
Loading…
Reference in a new issue