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

Commit d9bad584 authored by Muhammed Siju's avatar Muhammed Siju Committed by Gerrit - the friendly Code Review server
Browse files

IMS-VT: Fix preview size issue during VT call

Make sure preview image is in portrait resoultion when
device is in portrait mode.

Change-Id: I52fb1e3a62f004ba702fab9dc58308b6eb88ae52
CRs-Fixed: 1072518
parent 5051b2c2
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1123,22 +1123,29 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
     * @param aspectRatio The aspect ratio of the camera (width / height).
     */
    private void setPreviewSize(int orientation, float aspectRatio) {
        Log.d(this, "setPreviewSize: orientation = " + orientation +
                " aspectRatio = " + aspectRatio);
        VideoCallUi ui = getUi();
        if (ui == null) {
            return;
        }

        final int adjustedDimension = (aspectRatio > 1.0) ?
                (int) (mMinimumVideoDimension * aspectRatio):
                (int) (mMinimumVideoDimension / aspectRatio);

        int height;
        int width;

        // For landscape resolution, make sure width is larger than height.
        if (orientation == InCallOrientationEventListener.SCREEN_ORIENTATION_90 ||
                orientation == InCallOrientationEventListener.SCREEN_ORIENTATION_270) {
            width = (int) (mMinimumVideoDimension * aspectRatio);
            width = (int) adjustedDimension;
            height = (int) mMinimumVideoDimension;
        } else {
            // Portrait or reverse portrait orientation.
            width = (int) mMinimumVideoDimension;
            height = (int) (mMinimumVideoDimension * aspectRatio);
            height = (int) adjustedDimension;
        }
        ui.setPreviewSize(width, height);
    }