Cleaning up Android AppRTCDemo.
- Move signaling code from Activity to a separate class and add interface for AppRTC signaling. For now only pure GAE signaling implements this interface. - Move peer connection, video source and peer connection and SDP observer code from Activity to a separate class. - Main Activity class will do only high level calls and event handling for peer connection and signaling classes. - Also add video renderer position update and use full screen for local preview until the connection is established. BUG= R=braveyao@webrtc.org, pthatcher@webrtc.org Review URL: https://webrtc-codereview.appspot.com/24019004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7469 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -490,6 +490,15 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
updateTextureProperties = true;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y, int width, int height,
|
||||
ScalingType scalingType) {
|
||||
texLeft = (x - 50) / 50.0f;
|
||||
texTop = (50 - y) / 50.0f;
|
||||
texRight = Math.min(1.0f, (x + width - 50) / 50.0f);
|
||||
texBottom = Math.max(-1.0f, (50 - y - height) / 50.0f);
|
||||
updateTextureProperties = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(final int width, final int height) {
|
||||
Log.d(TAG, "ID: " + id + ". YuvImageRenderer.setSize: " +
|
||||
@ -636,6 +645,23 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
|
||||
return yuvImageRenderer;
|
||||
}
|
||||
|
||||
public static void update(
|
||||
VideoRenderer.Callbacks renderer,
|
||||
int x, int y, int width, int height, ScalingType scalingType) {
|
||||
Log.d(TAG, "VideoRendererGui.update");
|
||||
if (instance == null) {
|
||||
throw new RuntimeException(
|
||||
"Attempt to update yuv renderer before setting GLSurfaceView");
|
||||
}
|
||||
synchronized (instance.yuvImageRenderers) {
|
||||
for (YuvImageRenderer yuvImageRenderer : instance.yuvImageRenderers) {
|
||||
if (yuvImageRenderer == renderer) {
|
||||
yuvImageRenderer.setPosition(x, y, width, height, scalingType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
|
||||
Log.d(TAG, "VideoRendererGui.onSurfaceCreated");
|
||||
|
||||
Reference in New Issue
Block a user