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

Commit a2530aee authored by Byeongjo Park's avatar Byeongjo Park Committed by Lajos Molnar
Browse files

VT: Rotation parameter should be applied only for video call.



[Problem] Recorderd video that captured by native app is
rotated as 270 degrees.

[Cause]
Encoder rotation has been applied even it was normal video
recording scenario.

[Solution]
Rotation parameter should not be applied in normal video
recording scenario.

Merged-in: I83cd0c6bb78ee95ef2781ad7deeec393a3174aab
Change-Id: I83cd0c6bb78ee95ef2781ad7deeec393a3174aab
Signed-off-by: default avatarByeongjo Park <bjo.park@samsung.com>
parent 7cd1b2b3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1927,6 +1927,10 @@ status_t StagefrightRecorder::setupVideoEncoder(
        format->setInt32("stride", stride);
        format->setInt32("slice-height", sliceHeight);
        format->setInt32("color-format", colorFormat);
        if (mOutputFormat == OUTPUT_FORMAT_RTP_AVP) {
            // This indicates that a raw image provided to encoder needs to be rotated.
            format->setInt32("rotation-degrees", mRotationDegrees);
        }
    } else {
        format->setInt32("width", mVideoWidth);
        format->setInt32("height", mVideoHeight);
+23 −0
Original line number Diff line number Diff line
@@ -4171,6 +4171,29 @@ status_t ACodec::setupVideoEncoder(
        ALOGI("setupVideoEncoder succeeded");
    }

    // Video should be encoded as stand straight because RTP protocol
    // can provide rotation information only if CVO is supported.
    // This needs to be added to support non-CVO case for video streaming scenario.
    int32_t rotation = 0;
    if (msg->findInt32("rotation-degrees", &rotation)) {
        OMX_CONFIG_ROTATIONTYPE config;
        InitOMXParams(&config);
        config.nPortIndex = kPortIndexOutput;
        status_t err = mOMXNode->getConfig(
                (OMX_INDEXTYPE)OMX_IndexConfigCommonRotate, &config, sizeof(config));
        if (err != OK) {
            ALOGW("Failed to getConfig of OMX_IndexConfigCommonRotate(err %d)", err);
        }
        config.nRotation = rotation;
        err = mOMXNode->setConfig(
                (OMX_INDEXTYPE)OMX_IndexConfigCommonRotate, &config, sizeof(config));

        ALOGD("Applying encoder-rotation=[%d] to video encoder.", config.nRotation);
        if (err != OK) {
            ALOGW("Failed to setConfig of OMX_IndexConfigCommonRotate(err %d)", err);
        }
    }

    return err;
}