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

Commit 0e2fab25 authored by Santhosh Behara's avatar Santhosh Behara Committed by Linux Build Service Account
Browse files

ACodec: update native window crop rectangle

In setupNativeWindowSizeFormatAndUsage, set the crop rectangle
with the output port's crop value.

Conflicts:
	media/libstagefright/ACodec.cpp

Change-Id: I415be069d02d88dcd6b7c2460dda6df191ee7434
parent 04925a40
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -990,7 +990,7 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(
    mLastNativeWindowDataSpace = HAL_DATASPACE_UNKNOWN;

    ALOGV("gralloc usage: %#x(OMX) => %#x(ACodec)", omxUsage, usage);
    return setNativeWindowSizeFormatAndUsage(
    err = setNativeWindowSizeFormatAndUsage(
            nativeWindow,
            def.format.video.nFrameWidth,
            def.format.video.nFrameHeight,
@@ -998,6 +998,24 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(
            mRotationDegrees,
            usage,
            reconnect);
    if (err == OK) {
        OMX_CONFIG_RECTTYPE rect;
        InitOMXParams(&rect);
        rect.nPortIndex = kPortIndexOutput;
        err = mOMX->getConfig(
                mNode, OMX_IndexConfigCommonOutputCrop, &rect, sizeof(rect));
        if (err == OK) {
            ALOGV("rect size = %d, %d, %d, %d", rect.nLeft, rect.nTop, rect.nWidth, rect.nHeight);
            android_native_rect_t crop;
            crop.left = rect.nLeft;
            crop.top = rect.nTop;
            crop.right = rect.nLeft + rect.nWidth - 1;
            crop.bottom = rect.nTop + rect.nHeight - 1;
            ALOGV("crop update (%d, %d), (%d, %d)", crop.left, crop.top, crop.right, crop.bottom);
            err = native_window_set_crop(nativeWindow, &crop);
        }
    }
    return err;
}

status_t ACodec::configureOutputBuffersFromNativeWindow(