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

Commit 8da4cd7d authored by James Dong's avatar James Dong
Browse files

Fix a deadlock in commandSetVideoBufferCountL()

o The lock to be acquired in recordingEnabled() has aleady been acquired in sendCommand()
  before the call to commandSetVideoBufferCountL().

Change-Id: I664d51ef449c9eb3576d5d56f73f29c98444ff3f
parent d9f02533
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -792,8 +792,15 @@ void Camera2Client::stopRecording() {
bool Camera2Client::recordingEnabled() {
    ATRACE_CALL();
    Mutex::Autolock icl(mICameraLock);

    if ( checkPid(__FUNCTION__) != OK) return false;

    return recordingEnabledL();
}

bool Camera2Client::recordingEnabledL() {
    ATRACE_CALL();

    return (mState == RECORD || mState == VIDEO_SNAPSHOT);
}

@@ -1632,7 +1639,7 @@ status_t Camera2Client::commandPingL() {
}

status_t Camera2Client::commandSetVideoBufferCountL(size_t count) {
    if (recordingEnabled()) {
    if (recordingEnabledL()) {
        ALOGE("%s: Camera %d: Error setting video buffer count after "
                "recording was started", __FUNCTION__, mCameraId);
        return INVALID_OPERATION;
+2 −0
Original line number Diff line number Diff line
@@ -108,6 +108,8 @@ private:
    void stopPreviewL();
    status_t startPreviewL();

    bool recordingEnabledL();

    // Individual commands for sendCommand()
    status_t commandStartSmoothZoomL();
    status_t commandStopSmoothZoomL();