summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-10-24 09:32:39 -0700
committerJames Dong <jdong@google.com>2010-10-25 16:16:10 -0700
commit635730831e08c32a5fe7c59125e0919b7e7899cd (patch)
tree184de1c19477798888a2614d11c13004600fa8f4 /media/libmediaplayerservice
parente09591eff55fdff1868b32c3e046c62f800330fc (diff)
downloadframeworks_av-635730831e08c32a5fe7c59125e0919b7e7899cd.zip
frameworks_av-635730831e08c32a5fe7c59125e0919b7e7899cd.tar.gz
frameworks_av-635730831e08c32a5fe7c59125e0919b7e7899cd.tar.bz2
Don't change the video recording frame rate if it is not requested.
o set the default video frame rate to the current frame rate being used o add check on whether the requested frame rate is supported o fix an issue where the hardware video encoder setting was bypassed o increases the max frame rate from 30 t0 120 frames per second the actual frame rate will be clipped if the requested frame rate is too high when recording starts by checking the hardware encoder capabilities Change-Id: I1b47671d74da0ebcb9601bdca390d430cc048fbc
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index ec2449d..913d953 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -165,7 +165,8 @@ status_t StagefrightRecorder::setVideoSize(int width, int height) {
status_t StagefrightRecorder::setVideoFrameRate(int frames_per_second) {
LOGV("setVideoFrameRate: %d", frames_per_second);
- if (frames_per_second <= 0 || frames_per_second > 30) {
+ if ((frames_per_second <= 0 && frames_per_second != -1) ||
+ frames_per_second > 120) {
LOGE("Invalid video frame rate: %d", frames_per_second);
return BAD_VALUE;
}
@@ -960,7 +961,7 @@ void StagefrightRecorder::clipVideoFrameRate() {
"enc.vid.fps.min", mVideoEncoder);
int maxFrameRate = mEncoderProfiles->getVideoEncoderParamByName(
"enc.vid.fps.max", mVideoEncoder);
- if (mFrameRate < minFrameRate) {
+ if (mFrameRate < minFrameRate && mFrameRate != -1) {
LOGW("Intended video encoding frame rate (%d fps) is too small"
" and will be set to (%d fps)", mFrameRate, minFrameRate);
mFrameRate = minFrameRate;
@@ -1035,6 +1036,10 @@ void StagefrightRecorder::clipVideoFrameHeight() {
}
status_t StagefrightRecorder::setupCameraSource(sp<CameraSource> *cameraSource) {
+ status_t err = OK;
+ if ((err = checkVideoEncoderCapabilities()) != OK) {
+ return err;
+ }
Size videoSize;
videoSize.width = mVideoWidth;
videoSize.height = mVideoHeight;
@@ -1050,6 +1055,18 @@ status_t StagefrightRecorder::setupCameraSource(sp<CameraSource> *cameraSource)
}
CHECK(*cameraSource != NULL);
+ // When frame rate is not set, the actual frame rate will be set to
+ // the current frame rate being used.
+ if (mFrameRate == -1) {
+ int32_t frameRate = 0;
+ CHECK ((*cameraSource)->getFormat()->findInt32(
+ kKeySampleRate, &frameRate));
+ LOGI("Frame rate is not explicitly set. Use the current frame "
+ "rate (%d fps)", frameRate);
+ mFrameRate = frameRate;
+ }
+
+ CHECK(mFrameRate != -1);
return OK;
}
@@ -1371,7 +1388,7 @@ status_t StagefrightRecorder::reset() {
mVideoHeight = 144;
mAuxVideoWidth = 176;
mAuxVideoHeight = 144;
- mFrameRate = 20;
+ mFrameRate = -1;
mVideoBitRate = 192000;
mAuxVideoBitRate = 192000;
mSampleRate = 8000;