summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-12-09 15:04:33 -0800
committerJames Dong <jdong@google.com>2010-12-09 15:37:04 -0800
commitba29002c7aee13c068049037cd14bba6a244da6b (patch)
treeae5e61b21c24dbc6fa7fc592c17cbedbc70ed14f /media
parent151827eba283d97771aaa4494e5a1a6573dafcfb (diff)
downloadframeworks_av-ba29002c7aee13c068049037cd14bba6a244da6b.zip
frameworks_av-ba29002c7aee13c068049037cd14bba6a244da6b.tar.gz
frameworks_av-ba29002c7aee13c068049037cd14bba6a244da6b.tar.bz2
First step towards renabling Timelapse video recording
Change-Id: I93836b066fb69d5152d3774546a9935057a1f12f
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp2
-rw-r--r--media/libstagefright/CameraSource.cpp7
-rw-r--r--media/libstagefright/CameraSourceTimeLapse.cpp19
3 files changed, 20 insertions, 8 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index f72d919..576b009 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -1164,7 +1164,7 @@ status_t StagefrightRecorder::setupVideoEncoder(
// set appropriate level for the software AVCEncoder.
if ((width * height >= 921600) // 720p
|| (videoBitRate >= 20000000)) {
- enc_meta->setInt32(kKeyVideoLevel, 50);
+ enc_meta->setInt32(kKeyVideoLevel, OMX_VIDEO_AVCLevel5);
}
}
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index ed9e865..371c21f 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -592,6 +592,11 @@ status_t CameraSource::stop() {
mLastFrameTimestampUs - mFirstFrameTimeUs);
}
+ if (mNumGlitches > 0) {
+ LOGW("%d long delays between neighboring video frames during",
+ mNumGlitches);
+ }
+
CHECK_EQ(mNumFramesReceived, mNumFramesEncoded + mNumFramesDropped);
return OK;
}
@@ -712,7 +717,7 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs,
if (mNumFramesReceived > 0 &&
timestampUs - mLastFrameTimestampUs > mGlitchDurationThresholdUs) {
if (mNumGlitches % 10 == 0) { // Don't spam the log
- LOGW("Long delay detected in video recording");
+ LOGV("Long delay detected in video recording");
}
++mNumGlitches;
}
diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp
index 6fd1825..0b158be 100644
--- a/media/libstagefright/CameraSourceTimeLapse.cpp
+++ b/media/libstagefright/CameraSourceTimeLapse.cpp
@@ -72,7 +72,7 @@ CameraSourceTimeLapse::CameraSourceTimeLapse(
mLastTimeLapseFrameRealTimestampUs(0),
mSkipCurrentFrame(false) {
- LOGV("starting time lapse mode");
+ LOGD("starting time lapse mode: %lld us", mTimeBetweenTimeLapseFrameCaptureUs);
mVideoWidth = videoSize.width;
mVideoHeight = videoSize.height;
@@ -116,9 +116,9 @@ void CameraSourceTimeLapse::startQuickReadReturns() {
}
bool CameraSourceTimeLapse::trySettingPreviewSize(int32_t width, int32_t height) {
+ LOGV("trySettingPreviewSize: %dx%d", width, height);
int64_t token = IPCThreadState::self()->clearCallingIdentity();
String8 s = mCamera->getParameters();
- IPCThreadState::self()->restoreCallingIdentity(token);
CameraParameters params(s);
Vector<Size> supportedSizes;
@@ -134,17 +134,24 @@ bool CameraSourceTimeLapse::trySettingPreviewSize(int32_t width, int32_t height)
}
}
+ bool isSuccessful = false;
if (previewSizeSupported) {
LOGV("Video size (%d, %d) is a supported preview size", width, height);
params.setPreviewSize(width, height);
- CHECK(mCamera->setParameters(params.flatten()));
- return true;
+ if (mCamera->setParameters(params.flatten()) == OK) {
+ isSuccessful = true;
+ } else {
+ LOGE("Failed to set preview size to %dx%d", width, height);
+ isSuccessful = false;
+ }
}
- return false;
+ IPCThreadState::self()->restoreCallingIdentity(token);
+ return isSuccessful;
}
bool CameraSourceTimeLapse::setPictureSizeToClosestSupported(int32_t width, int32_t height) {
+ LOGV("setPictureSizeToClosestSupported: %dx%d", width, height);
int64_t token = IPCThreadState::self()->clearCallingIdentity();
String8 s = mCamera->getParameters();
IPCThreadState::self()->restoreCallingIdentity(token);
@@ -277,7 +284,6 @@ void CameraSourceTimeLapse::startCameraRecording() {
int64_t token = IPCThreadState::self()->clearCallingIdentity();
String8 s = mCamera->getParameters();
- IPCThreadState::self()->restoreCallingIdentity(token);
CameraParameters params(s);
params.setPictureSize(mPictureWidth, mPictureHeight);
@@ -288,6 +294,7 @@ void CameraSourceTimeLapse::startCameraRecording() {
// disable shutter sound and play the recording sound.
mCamera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, 0, 0);
mCamera->sendCommand(CAMERA_CMD_PLAY_RECORDING_SOUND, 0, 0);
+ IPCThreadState::self()->restoreCallingIdentity(token);
// create a thread which takes pictures in a loop
pthread_attr_t attr;