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

Commit f27af98f authored by Shalaj Jain's avatar Shalaj Jain Committed by Ricardo Cerqueira
Browse files

libstagefright: Crop the native window with the display resolution

We were providing the native window with the display width and height in
set_geometry.  On the surfaceflinger side, they assume that this is
aligned, which causes problems for HDMI.  Instead we'll now pass in the
aligned stride and slice in native_window_set_geometry, then specify the desired
display width and height by calling native_window_set_crop.

Change-Id: I9b9a910e951468bdeb30f3f8ea9df70f3c2ad00a
CRs-Fixed: 283063
parent a6605540
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -2298,11 +2298,13 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
#ifndef SAMSUNG_CODEC_SUPPORT
    err = native_window_set_buffers_geometry(
            mNativeWindow.get(),
            def.format.video.nFrameWidth,
            def.format.video.nFrameHeight,
#ifdef QCOM_HARDWARE
            def.format.video.nStride,
            def.format.video.nSliceHeight,
            format);
#else
            def.format.video.nFrameWidth,
            def.format.video.nFrameHeight,
            def.format.video.eColorFormat);
#endif
#else
@@ -2333,6 +2335,25 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
        return err;
    }

#ifdef QCOM_HARDWARE
    // Crop the native window to the proper display resolution
    int32_t left, top, right, bottom;
    CHECK(mOutputFormat->findRect(
                kKeyCropRect,
                &left, &top, &right, &bottom));

    android_native_rect_t crop;
    crop.left = left;
    crop.top = top;
    crop.right = right;
    crop.bottom = bottom;

    err = native_window_set_crop(mNativeWindow.get(), &crop);
    if (err != OK) {
        LOGE("native_window_set_crop failed: %s (%d)", strerror(-err), -err);
    }
#endif

    err = applyRotation();
    if (err != OK) {
        return err;