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@6354 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org
2014-06-06 18:40:44 +00:00
parent 42694c5937
commit 9512719569
12 changed files with 97 additions and 20 deletions

View File

@@ -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.

View File

@@ -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) {