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

Commit d15f127a authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audiohal: Add diagnostic message to check the number of bytes written

Temporary change for investigating b/35813113. Need to test
the hypothesis that sometimes either legacy HAL, or the wrapper
reports more bytes written than being asked for.

Bug: 35813113
Change-Id: I6916d39e40d332b45a95aad05674009266e9cd96
Test: make
parent 881fc5c6
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -315,6 +315,10 @@ status_t StreamOutHalHidl::write(const void *buffer, size_t bytes, size_t *writt
            WriteCommand::WRITE, "write", static_cast<const uint8_t*>(buffer), bytes,
            [&] (const WriteStatus& writeStatus) {
                *written = writeStatus.reply.written;
                // Diagnostics of the cause of b/35813113.
                ALOGE_IF(*written > bytes,
                        "hal reports more bytes written than asked for: %lld > %lld",
                        (long long)*written, (long long)bytes);
            });
}

@@ -328,8 +332,8 @@ status_t StreamOutHalHidl::callWriterThread(
    if (data != nullptr) {
        size_t availableToWrite = mDataMQ->availableToWrite();
        if (dataSize > availableToWrite) {
            ALOGW("truncating write data from %d to %d due to insufficient data queue space",
                    (int32_t)dataSize, (int32_t)availableToWrite);
            ALOGW("truncating write data from %lld to %lld due to insufficient data queue space",
                    (long long)dataSize, (long long)availableToWrite);
            dataSize = availableToWrite;
        }
        if (!mDataMQ->write(data, dataSize)) {