summaryrefslogtreecommitdiff
path: root/examples/android
diff options
context:
space:
mode:
authorfischman@webrtc.org <fischman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-06-06 18:40:44 +0000
committerfischman@webrtc.org <fischman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-06-06 18:40:44 +0000
commiteb70c0e0b16f4ae98621cd6fe830a5921e8d0cdb (patch)
tree796eb0011900cd09a4ec14e0efc7c828b68dba9a /examples/android
parentcef4b39b7ec2035a69d46360d8101a785fd154d3 (diff)
downloadtalk-eb70c0e0b16f4ae98621cd6fe830a5921e8d0cdb.tar.gz
AppRTCDemo(android): support app (UI) & capture rotation.
Now app UI rotates as the device orientation changes, and the captured stream tries to maintain real-world-up, matching Chrome/Android and Hangouts/Android behavior. BUG=2432 R=glaznev@webrtc.org, henrike@webrtc.org, wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/15689005 git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@6354 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'examples/android')
-rw-r--r--examples/android/AndroidManifest.xml3
-rw-r--r--examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java8
-rw-r--r--examples/android/src/org/appspot/apprtc/VideoStreamsView.java6
3 files changed, 15 insertions, 2 deletions
diff --git a/examples/android/AndroidManifest.xml b/examples/android/AndroidManifest.xml
index 1fb60ad..f898641 100644
--- a/examples/android/AndroidManifest.xml
+++ b/examples/android/AndroidManifest.xml
@@ -21,7 +21,8 @@
android:allowBackup="false">
<activity android:name="AppRTCDemoActivity"
android:label="@string/app_name"
- android:screenOrientation="landscape"
+ android:screenOrientation="fullUser"
+ android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java b/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
index dea251a..9a3d72e 100644
--- a/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
+++ b/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
@@ -31,6 +31,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Point;
import android.media.AudioManager;
@@ -226,6 +227,13 @@ public class AppRTCDemoActivity extends Activity
}
}
+ @Override
+ public void onConfigurationChanged (Configuration newConfig) {
+ Point displaySize = new Point();
+ getWindowManager().getDefaultDisplay().getSize(displaySize);
+ vsv.updateDisplaySize(displaySize);
+ super.onConfigurationChanged(newConfig);
+ }
// Just for fun (and to regression-test bug 2302) make sure that DataChannels
// can be created, queried, and disposed.
diff --git a/examples/android/src/org/appspot/apprtc/VideoStreamsView.java b/examples/android/src/org/appspot/apprtc/VideoStreamsView.java
index ca9cd4e..f069f0a 100644
--- a/examples/android/src/org/appspot/apprtc/VideoStreamsView.java
+++ b/examples/android/src/org/appspot/apprtc/VideoStreamsView.java
@@ -84,11 +84,15 @@ public class VideoStreamsView
setRenderMode(RENDERMODE_WHEN_DIRTY);
}
+ public void updateDisplaySize(Point screenDimensions) {
+ this.screenDimensions = screenDimensions;
+ }
+
/** Queue |frame| to be uploaded. */
public void queueFrame(final Endpoint stream, I420Frame frame) {
// Paying for the copy of the YUV data here allows CSC and painting time
// to get spent on the render thread instead of the UI thread.
- abortUnless(framePool.validateDimensions(frame), "Frame too large!");
+ abortUnless(FramePool.validateDimensions(frame), "Frame too large!");
final I420Frame frameCopy = framePool.takeFrame(frame).copyFrom(frame);
boolean needToScheduleRender;
synchronized (framesToRender) {