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

Commit 63703876 authored by James Dong's avatar James Dong
Browse files

Release a recording frame only if mCamera exists and is not cleared.

and also call mCamera->stopRecording() only after CameraSource releases all the
outstanding video frames sent from CameraSource to its clients (such as video encoder).

Change-Id: I7eeed4e2f388e77c28668d52c24b5330d3d9ebde
parent acaab2d7
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -576,13 +576,13 @@ status_t CameraSource::stop() {
    mFrameAvailableCondition.signal();

    int64_t token = IPCThreadState::self()->clearCallingIdentity();
    stopCameraRecording();
    releaseQueuedFrames();
    while (!mFramesBeingEncoded.empty()) {
        LOGI("Waiting for outstanding frames being encoded: %d",
                mFramesBeingEncoded.size());
        mFrameCompleteCondition.wait(mLock);
    }
    stopCameraRecording();
    releaseCamera();
    IPCThreadState::self()->restoreCallingIdentity(token);

@@ -602,8 +602,10 @@ status_t CameraSource::stop() {
}

void CameraSource::releaseRecordingFrame(const sp<IMemory>& frame) {
    if (mCamera != NULL) {
        mCamera->releaseRecordingFrame(frame);
    }
}

void CameraSource::releaseQueuedFrames() {
    List<sp<IMemory> >::iterator it;