Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: Commit

frameworks/base


Commit MetaInfo

Revisión2dd940aca13887a54792a6f80f8c061281ae311f (tree)
Tiempo2013-06-23 22:38:07
AutorHua Wang <Hua.Wang@wind...>
CommiterChih-Wei Huang

Log Message

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>

Cambiar Resumen

Diferencia

--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -202,6 +202,7 @@ status_t StagefrightRecorder::setVideoFrameRate(int frames_per_second) {
202202
203203 // Additional check on the frame rate will be performed later
204204 mFrameRate = frames_per_second;
205+ mUserSetupFrameRate = true;
205206
206207 return OK;
207208 }
@@ -1315,7 +1316,7 @@ status_t StagefrightRecorder::setupCameraSource(
13151316
13161317 // When frame rate is not set, the actual frame rate will be set to
13171318 // the current frame rate being used.
1318- if (mFrameRate == -1) {
1319+ if (mFrameRate == -1 || !mUserSetupFrameRate) {
13191320 int32_t frameRate = 0;
13201321 CHECK ((*cameraSource)->getFormat()->findInt32(
13211322 kKeyFrameRate, &frameRate));
@@ -1654,6 +1655,7 @@ status_t StagefrightRecorder::reset() {
16541655 mCameraSourceTimeLapse = NULL;
16551656 mIsMetaDataStoredInVideoBuffers = false;
16561657 mEncoderProfiles = MediaProfiles::getInstance();
1658+ mUserSetupFrameRate = false;
16571659 mRotationDegrees = 0;
16581660 mLatitudex10000 = -3600000;
16591661 mLongitudex10000 = -3600000;
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -108,6 +108,7 @@ private:
108108 int64_t mTimeBetweenTimeLapseFrameCaptureUs;
109109 sp<CameraSourceTimeLapse> mCameraSourceTimeLapse;
110110
111+ bool mUserSetupFrameRate;
111112
112113 String8 mParams;
113114
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -487,6 +487,7 @@ status_t CameraSource::initWithCameraAccess(
487487 bool storeMetaDataInVideoBuffers) {
488488 LOGV("initWithCameraAccess");
489489 status_t err = OK;
490+ char buffer[4];
490491
491492 if ((err = isCameraAvailable(camera, proxy, cameraId)) != OK) {
492493 LOGE("Camera connection could not be established.");
@@ -496,6 +497,15 @@ status_t CameraSource::initWithCameraAccess(
496497 if ((err = isCameraColorFormatSupported(params)) != OK) {
497498 return err;
498499 }
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+ }
499509
500510 // Set the camera to use the requested video frame size
501511 // and/or frame rate.
Show on old repository browser