frameworks/base
Revision | 2dd940aca13887a54792a6f80f8c061281ae311f (tree) |
---|---|
Zeit | 2013-06-23 22:38:07 |
Autor | Hua Wang <Hua.Wang@wind...> |
Commiter | Chih-Wei Huang |
CameraSource: set up right frame rate
If camera recorder uses HW codec, the capabilities of the codec
are from media_profile.xml; If using SW codec, it is invisible
to the applications, In other words, the applications won't be
able to use the codec or query the capabilities of the codec
at all, it only gives some ranges. StagefrightRecorder will
use default parameters to configure camera, as for framerate,
it should be from camera HAL feedback.
Issue:AXIA-1446
Change-Id: I77bf41239a19d26e2da1c28258288fdaa1c98297
Signed-off-by: Hua Wang <Hua.Wang@windriver.com>
@@ -202,6 +202,7 @@ status_t StagefrightRecorder::setVideoFrameRate(int frames_per_second) { | ||
202 | 202 | |
203 | 203 | // Additional check on the frame rate will be performed later |
204 | 204 | mFrameRate = frames_per_second; |
205 | + mUserSetupFrameRate = true; | |
205 | 206 | |
206 | 207 | return OK; |
207 | 208 | } |
@@ -1315,7 +1316,7 @@ status_t StagefrightRecorder::setupCameraSource( | ||
1315 | 1316 | |
1316 | 1317 | // When frame rate is not set, the actual frame rate will be set to |
1317 | 1318 | // the current frame rate being used. |
1318 | - if (mFrameRate == -1) { | |
1319 | + if (mFrameRate == -1 || !mUserSetupFrameRate) { | |
1319 | 1320 | int32_t frameRate = 0; |
1320 | 1321 | CHECK ((*cameraSource)->getFormat()->findInt32( |
1321 | 1322 | kKeyFrameRate, &frameRate)); |
@@ -1654,6 +1655,7 @@ status_t StagefrightRecorder::reset() { | ||
1654 | 1655 | mCameraSourceTimeLapse = NULL; |
1655 | 1656 | mIsMetaDataStoredInVideoBuffers = false; |
1656 | 1657 | mEncoderProfiles = MediaProfiles::getInstance(); |
1658 | + mUserSetupFrameRate = false; | |
1657 | 1659 | mRotationDegrees = 0; |
1658 | 1660 | mLatitudex10000 = -3600000; |
1659 | 1661 | mLongitudex10000 = -3600000; |
@@ -108,6 +108,7 @@ private: | ||
108 | 108 | int64_t mTimeBetweenTimeLapseFrameCaptureUs; |
109 | 109 | sp<CameraSourceTimeLapse> mCameraSourceTimeLapse; |
110 | 110 | |
111 | + bool mUserSetupFrameRate; | |
111 | 112 | |
112 | 113 | String8 mParams; |
113 | 114 |
@@ -487,6 +487,7 @@ status_t CameraSource::initWithCameraAccess( | ||
487 | 487 | bool storeMetaDataInVideoBuffers) { |
488 | 488 | LOGV("initWithCameraAccess"); |
489 | 489 | status_t err = OK; |
490 | + char buffer[4]; | |
490 | 491 | |
491 | 492 | if ((err = isCameraAvailable(camera, proxy, cameraId)) != OK) { |
492 | 493 | LOGE("Camera connection could not be established."); |
@@ -496,6 +497,15 @@ status_t CameraSource::initWithCameraAccess( | ||
496 | 497 | if ((err = isCameraColorFormatSupported(params)) != OK) { |
497 | 498 | return err; |
498 | 499 | } |
500 | + const char* supportedFrameRates = | |
501 | + params.get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES); | |
502 | + CHECK(supportedFrameRates != NULL); | |
503 | + snprintf(buffer, 4, "%d", frameRate); | |
504 | + if (strstr(supportedFrameRates, buffer) == NULL) { | |
505 | + frameRate = atoi(supportedFrameRates); | |
506 | + } else { | |
507 | + frameRate = params.getPreviewFrameRate(); | |
508 | + } | |
499 | 509 | |
500 | 510 | // Set the camera to use the requested video frame size |
501 | 511 | // and/or frame rate. |