• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/av


Commit MetaInfo

修訂f1df044ad2a0443c3e58171207fe79b65d1a3904 (tree)
時間2015-12-22 13:09:54
作者Hua 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>

Change Summary

差異

--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -213,6 +213,7 @@ status_t StagefrightRecorder::setVideoFrameRate(int frames_per_second) {
213213
214214 // Additional check on the frame rate will be performed later
215215 mFrameRate = frames_per_second;
216+ mUserSetupFrameRate = true;
216217
217218 return OK;
218219 }
@@ -1427,7 +1428,7 @@ status_t StagefrightRecorder::setupCameraSource(
14271428
14281429 // When frame rate is not set, the actual frame rate will be set to
14291430 // the current frame rate being used.
1430- if (mFrameRate == -1) {
1431+ if (mFrameRate == -1 || !mUserSetupFrameRate) {
14311432 int32_t frameRate = 0;
14321433 CHECK ((*cameraSource)->getFormat()->findInt32(
14331434 kKeyFrameRate, &frameRate));
@@ -1780,6 +1781,7 @@ status_t StagefrightRecorder::reset() {
17801781 mCameraSourceTimeLapse = NULL;
17811782 mIsMetaDataStoredInVideoBuffers = false;
17821783 mEncoderProfiles = MediaProfiles::getInstance();
1784+ mUserSetupFrameRate = false;
17831785 mRotationDegrees = 0;
17841786 mLatitudex10000 = -3600000;
17851787 mLongitudex10000 = -3600000;
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -113,6 +113,7 @@ private:
113113 int64_t mTimeBetweenTimeLapseFrameCaptureUs;
114114 sp<CameraSourceTimeLapse> mCameraSourceTimeLapse;
115115
116+ bool mUserSetupFrameRate;
116117
117118 String8 mParams;
118119
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -514,6 +514,7 @@ status_t CameraSource::initWithCameraAccess(
514514 bool storeMetaDataInVideoBuffers) {
515515 ALOGV("initWithCameraAccess");
516516 status_t err = OK;
517+ char buffer[4];
517518
518519 if ((err = isCameraAvailable(camera, proxy, cameraId,
519520 clientName, clientUid)) != OK) {
@@ -524,6 +525,15 @@ status_t CameraSource::initWithCameraAccess(
524525 if ((err = isCameraColorFormatSupported(params)) != OK) {
525526 return err;
526527 }
528+ const char* supportedFrameRates =
529+ params.get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);
530+ CHECK(supportedFrameRates != NULL);
531+ snprintf(buffer, 4, "%d", frameRate);
532+ if (strstr(supportedFrameRates, buffer) == NULL) {
533+ frameRate = atoi(supportedFrameRates);
534+ } else {
535+ frameRate = params.getPreviewFrameRate();
536+ }
527537
528538 // Set the camera to use the requested video frame size
529539 // and/or frame rate.