Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2debdc96 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "audio: reply correct transferred bytes"

parents 702417d7 ad99fb01
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -286,12 +286,13 @@ status_t StreamHalAidl::transfer(void *buffer, size_t bytes, size_t *transferred
    if (status_t status = sendCommand(burst, &reply); status != OK) {
        return status;
    }
    if (mIsInput) {
    *transferred = reply.fmqByteCount;
    if (mIsInput) {
        LOG_ALWAYS_FATAL_IF(*transferred > bytes,
                "%s: HAL module read %zu bytes, which exceeds requested count %zu",
                __func__, *transferred, bytes);
        if (!mContext.getDataMQ()->read(static_cast<int8_t*>(buffer), *transferred)) {
        if (!mContext.getDataMQ()->read(static_cast<int8_t*>(buffer),
                                        mContext.getDataMQ()->availableToRead())) {
            ALOGE("%s: failed to read %zu bytes to data MQ", __func__, *transferred);
            return NOT_ENOUGH_DATA;
        }