Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cd1b2b3 authored by Kim Sungyeon's avatar Kim Sungyeon Committed by Lajos Molnar
Browse files

VT: Add OMX_Video_ControlRateConstant feature



The OMX_Video_ControlRateConstant is a sutiable OMX option
to stablize encoder bandwidth.

This helps encoder to make more regular bps.

Merged-in: I67a08be8b8a19b573c873e96d317e16c7105084e
Change-Id: I67a08be8b8a19b573c873e96d317e16c7105084e
Signed-off-by: default avatarKim Sungyeon <sy85.kim@samsung.com>
parent d3dba698
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -589,6 +589,16 @@ status_t StagefrightRecorder::setParamVideoEncodingBitRate(int32_t bitRate) {
    return OK;
}

status_t StagefrightRecorder::setParamVideoBitRateMode(int32_t bitRateMode) {
    ALOGV("setParamVideoBitRateMode: %d", bitRateMode);
    if (bitRateMode < -1) {
        ALOGE("Unsupported video bitrate mode: %d", bitRateMode);
        return BAD_VALUE;
    }
    mVideoBitRateMode = bitRateMode;
    return OK;
}

// Always rotate clockwise, and only support 0, 90, 180 and 270 for now.
status_t StagefrightRecorder::setParamVideoRotation(int32_t degrees) {
    ALOGV("setParamVideoRotation: %d", degrees);
@@ -945,6 +955,11 @@ status_t StagefrightRecorder::setParameter(
        if (safe_strtoi32(value.string(), &video_bitrate)) {
            return setParamVideoEncodingBitRate(video_bitrate);
        }
    } else if (key == "video-param-bitrate-mode") {
        int32_t video_bitrate_mode;
        if (safe_strtoi32(value.string(), &video_bitrate_mode)) {
            return setParamVideoBitRateMode(video_bitrate_mode);
        }
    } else if (key == "video-param-rotation-angle-degrees") {
        int32_t degrees;
        if (safe_strtoi32(value.string(), &degrees)) {
@@ -1930,6 +1945,8 @@ status_t StagefrightRecorder::setupVideoEncoder(
    }

    format->setInt32("bitrate", mVideoBitRate);
    // OMX encoder option how to control bitrate
    format->setInt32("bitrate-mode", mVideoBitRateMode);
    format->setInt32("frame-rate", mFrameRate);
    format->setInt32("i-frame-interval", mIFramesIntervalSec);

@@ -2352,6 +2369,8 @@ status_t StagefrightRecorder::reset() {
    mVideoHeight   = 144;
    mFrameRate     = -1;
    mVideoBitRate  = 192000;
    // Following ACodec's default
    mVideoBitRateMode = OMX_Video_ControlRateVariable;
    mSampleRate    = 8000;
    mAudioChannels = 1;
    mAudioBitRate  = 12200;
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ private:
    int32_t mVideoWidth, mVideoHeight;
    int32_t mFrameRate;
    int32_t mVideoBitRate;
    int32_t mVideoBitRateMode;
    int32_t mAudioBitRate;
    int32_t mAudioChannels;
    int32_t mSampleRate;
@@ -215,6 +216,7 @@ private:
    status_t setParamCaptureFpsEnable(int32_t timeLapseEnable);
    status_t setParamCaptureFps(double fps);
    status_t setParamVideoEncodingBitRate(int32_t bitRate);
    status_t setParamVideoBitRateMode(int32_t bitRateMode);
    status_t setParamVideoIFramesInterval(int32_t seconds);
    status_t setParamVideoEncoderProfile(int32_t profile);
    status_t setParamVideoEncoderLevel(int32_t level);