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

Commit ad99fb01 authored by Jasmine Cha's avatar Jasmine Cha
Browse files

audio: reply correct transferred bytes



Bug: 206738075
Test: enable Hal AIDL and playback

Change-Id: Ia712b93190b61bd92fc11a1dd0e53b5520fd78c0
Signed-off-by: default avatarJasmine Cha <chajasmine@google.com>
parent 5da5ef82
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;
        }