From fcf97c3b75f9f6719d3fb833a8fe95b33a444859 Mon Sep 17 00:00:00 2001 From: sakal Date: Tue, 18 Jul 2017 05:01:08 -0700 Subject: [PATCH] Fix fullscreen scaling in AppRTCMobile. The surface view renderer size was set to match parent so it couldn't adjust based on the frame size. The size is now set to wrap_content which allows the renderer to adjust. The root element of the call activity is changed to FrameLayout to allow the renderer to center. requestLayout is added to SurfaceView setScalingType so onMeasure gets called again. BUG=webrtc:7901 Review-Url: https://codereview.webrtc.org/2978173002 Cr-Commit-Position: refs/heads/master@{#19073} --- .../androidapp/res/layout/activity_call.xml | 16 ++++++++++++---- .../api/org/webrtc/SurfaceViewRenderer.java | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/webrtc/examples/androidapp/res/layout/activity_call.xml b/webrtc/examples/androidapp/res/layout/activity_call.xml index fdfe9b17e7..bf811426f3 100644 --- a/webrtc/examples/androidapp/res/layout/activity_call.xml +++ b/webrtc/examples/androidapp/res/layout/activity_call.xml @@ -1,11 +1,19 @@ - + + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" /> - + diff --git a/webrtc/sdk/android/api/org/webrtc/SurfaceViewRenderer.java b/webrtc/sdk/android/api/org/webrtc/SurfaceViewRenderer.java index 67b41fa9f9..06d72425a8 100644 --- a/webrtc/sdk/android/api/org/webrtc/SurfaceViewRenderer.java +++ b/webrtc/sdk/android/api/org/webrtc/SurfaceViewRenderer.java @@ -164,12 +164,14 @@ public class SurfaceViewRenderer public void setScalingType(RendererCommon.ScalingType scalingType) { ThreadUtils.checkIsOnMainThread(); videoLayoutMeasure.setScalingType(scalingType); + requestLayout(); } public void setScalingType(RendererCommon.ScalingType scalingTypeMatchOrientation, RendererCommon.ScalingType scalingTypeMismatchOrientation) { ThreadUtils.checkIsOnMainThread(); videoLayoutMeasure.setScalingType(scalingTypeMatchOrientation, scalingTypeMismatchOrientation); + requestLayout(); } /**