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
This commit is contained in:
@@ -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,7 +602,9 @@ status_t CameraSource::stop() {
|
||||
}
|
||||
|
||||
void CameraSource::releaseRecordingFrame(const sp<IMemory>& frame) {
|
||||
mCamera->releaseRecordingFrame(frame);
|
||||
if (mCamera != NULL) {
|
||||
mCamera->releaseRecordingFrame(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraSource::releaseQueuedFrames() {
|
||||
|
||||
Reference in New Issue
Block a user