diff options
author | James Dong <jdong@google.com> | 2010-10-24 09:32:39 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-10-25 16:16:10 -0700 |
commit | 635730831e08c32a5fe7c59125e0919b7e7899cd (patch) | |
tree | 184de1c19477798888a2614d11c13004600fa8f4 /media/libstagefright/CameraSource.cpp | |
parent | e09591eff55fdff1868b32c3e046c62f800330fc (diff) | |
download | frameworks_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/libstagefright/CameraSource.cpp')
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 95afb1d..159d937 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -313,6 +313,20 @@ status_t CameraSource::configureCamera( } if (frameRate != -1) { + CHECK(frameRate > 0 && frameRate <= 120); + const char* supportedFrameRates = + params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES); + CHECK(supportedFrameRates != NULL); + LOGV("Supported frame rates: %s", supportedFrameRates); + char buf[4]; + snprintf(buf, 4, "%d", frameRate); + if (strstr(supportedFrameRates, buf) == NULL) { + LOGE("Requested frame rate (%d) is not supported: %s", + frameRate, supportedFrameRates); + return BAD_VALUE; + } + + // The frame rate is supported, set the camera to the requested value. params->setPreviewFrameRate(frameRate); isCameraParamChanged = true; } else { // frameRate == -1 @@ -517,6 +531,7 @@ status_t CameraSource::init( mMeta->setInt32(kKeyHeight, mVideoSize.height); mMeta->setInt32(kKeyStride, mVideoSize.width); mMeta->setInt32(kKeySliceHeight, mVideoSize.height); + mMeta->setInt32(kKeySampleRate, mVideoFrameRate); return OK; } |