Loading media/libmediaplayerservice/StagefrightRecorder.cpp +20 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; } Loading Loading @@ -1371,7 +1388,7 @@ status_t StagefrightRecorder::reset() { mVideoHeight = 144; mAuxVideoWidth = 176; mAuxVideoHeight = 144; mFrameRate = 20; mFrameRate = -1; mVideoBitRate = 192000; mAuxVideoBitRate = 192000; mSampleRate = 8000; Loading media/libstagefright/CameraSource.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; } Loading Loading
media/libmediaplayerservice/StagefrightRecorder.cpp +20 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; } Loading Loading @@ -1371,7 +1388,7 @@ status_t StagefrightRecorder::reset() { mVideoHeight = 144; mAuxVideoWidth = 176; mAuxVideoHeight = 144; mFrameRate = 20; mFrameRate = -1; mVideoBitRate = 192000; mAuxVideoBitRate = 192000; mSampleRate = 8000; Loading
media/libstagefright/CameraSource.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; } Loading