summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/CameraSource.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-12-09 11:24:22 -0800
committerJames Dong <jdong@google.com>2010-12-10 07:34:08 -0800
commitd69c7f654cc772b03717999c1b24402d5c40e69f (patch)
treec8d8c3b66854867bd5ba08ef03c9ede0481065c4 /media/libstagefright/CameraSource.cpp
parent986ef2ad4c96952711d87af481f3afb40aa10775 (diff)
downloadframeworks_av-d69c7f654cc772b03717999c1b24402d5c40e69f.zip
frameworks_av-d69c7f654cc772b03717999c1b24402d5c40e69f.tar.gz
frameworks_av-d69c7f654cc772b03717999c1b24402d5c40e69f.tar.bz2
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
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r--media/libstagefright/CameraSource.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 371c21f..8c686b9 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -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() {