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

Commit 02baf33f authored by Sharad Sangle's avatar Sharad Sangle Committed by Gerrit - the friendly Code Review server
Browse files

hal: In case of error in in_read don't return zero

When read fails HAL is returning bytes_read as zero, this
is causing recordThread forever looping in threadLoop, leading
ANR in cases like in-call record + SubSystemRestart.
Make sure HAL returns 'size', AudioFlinger is reading data of.

CRs-Fixed: 2021657
Change-Id: Ie4c07c6a888c1ec66ed032b0d2912633cf15368c
parent 977321c8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3815,7 +3815,10 @@ exit:
            pthread_mutex_unlock(&adev->lock);
            in->standby = true;
        }
        if (!audio_extn_cin_attached_usecase(in->usecase)) {
            bytes_read = bytes;
            memset(buffer, 0, bytes);
        }
        in_standby(&in->stream.common);
        ALOGV("%s: read failed status %d- sleeping for buffer duration", __func__, ret);
        usleep((uint64_t)bytes * 1000000 / audio_stream_in_frame_size(stream) /