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

Commit 2222e7d5 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Gerrit Code Review
Browse files

Merge "audio: Abort on data FMQ pointer corruption" into main

parents 94b3cbce 7b6951ee
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -315,7 +315,11 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() {
bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) {
    ATRACE_CALL();
    StreamContext::DataMQ* const dataMQ = mContext->getDataMQ();
    const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize});
    StreamContext::DataMQ::Error fmqError = StreamContext::DataMQ::Error::NONE;
    std::string fmqErrorMsg;
    const size_t byteCount = std::min(
            {clientSize, dataMQ->availableToWrite(&fmqError, &fmqErrorMsg), mDataBufferSize});
    CHECK(fmqError == StreamContext::DataMQ::Error::NONE) << fmqErrorMsg;
    const bool isConnected = mIsConnected;
    const size_t frameSize = mContext->getFrameSize();
    size_t actualFrameCount = 0;
@@ -587,7 +591,10 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() {
bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) {
    ATRACE_CALL();
    StreamContext::DataMQ* const dataMQ = mContext->getDataMQ();
    const size_t readByteCount = dataMQ->availableToRead();
    StreamContext::DataMQ::Error fmqError = StreamContext::DataMQ::Error::NONE;
    std::string fmqErrorMsg;
    const size_t readByteCount = dataMQ->availableToRead(&fmqError, &fmqErrorMsg);
    CHECK(fmqError == StreamContext::DataMQ::Error::NONE) << fmqErrorMsg;
    const size_t frameSize = mContext->getFrameSize();
    bool fatal = false;
    int32_t latency = mContext->getNominalLatencyMs();