Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java

Issue 3016443002: Android AppRTCMobile: Transition local render to new VideoSink interface (Closed)
Patch Set: Update tests Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 import org.webrtc.IceCandidate; 49 import org.webrtc.IceCandidate;
50 import org.webrtc.Logging; 50 import org.webrtc.Logging;
51 import org.webrtc.PeerConnectionFactory; 51 import org.webrtc.PeerConnectionFactory;
52 import org.webrtc.RendererCommon.ScalingType; 52 import org.webrtc.RendererCommon.ScalingType;
53 import org.webrtc.ScreenCapturerAndroid; 53 import org.webrtc.ScreenCapturerAndroid;
54 import org.webrtc.SessionDescription; 54 import org.webrtc.SessionDescription;
55 import org.webrtc.StatsReport; 55 import org.webrtc.StatsReport;
56 import org.webrtc.SurfaceViewRenderer; 56 import org.webrtc.SurfaceViewRenderer;
57 import org.webrtc.VideoCapturer; 57 import org.webrtc.VideoCapturer;
58 import org.webrtc.VideoFileRenderer; 58 import org.webrtc.VideoFileRenderer;
59 import org.webrtc.VideoFrame;
59 import org.webrtc.VideoRenderer; 60 import org.webrtc.VideoRenderer;
61 import org.webrtc.VideoSink;
60 62
61 /** 63 /**
62 * Activity for peer connection call setup, call waiting 64 * Activity for peer connection call setup, call waiting
63 * and call view. 65 * and call view.
64 */ 66 */
65 public class CallActivity extends Activity implements AppRTCClient.SignalingEven ts, 67 public class CallActivity extends Activity implements AppRTCClient.SignalingEven ts,
66 PeerConnectionClient.PeerC onnectionEvents, 68 PeerConnectionClient.PeerC onnectionEvents,
67 CallFragment.OnCallEvents { 69 CallFragment.OnCallEvents {
68 private static final String TAG = "CallRTCClient"; 70 private static final String TAG = "CallRTCClient";
69 71
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 132
131 private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1; 133 private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1;
132 134
133 // List of mandatory application permissions. 135 // List of mandatory application permissions.
134 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD IFY_AUDIO_SETTINGS", 136 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD IFY_AUDIO_SETTINGS",
135 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"}; 137 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"};
136 138
137 // Peer connection statistics callback period in ms. 139 // Peer connection statistics callback period in ms.
138 private static final int STAT_CALLBACK_PERIOD = 1000; 140 private static final int STAT_CALLBACK_PERIOD = 1000;
139 141
140 private class ProxyRenderer implements VideoRenderer.Callbacks { 142 private class ProxyRenderer<T extends VideoRenderer.Callbacks & VideoSink>
141 private VideoRenderer.Callbacks target; 143 implements VideoRenderer.Callbacks, VideoSink {
144 private T target;
142 145
146 @Override
143 synchronized public void renderFrame(VideoRenderer.I420Frame frame) { 147 synchronized public void renderFrame(VideoRenderer.I420Frame frame) {
144 if (target == null) { 148 if (target == null) {
145 Logging.d(TAG, "Dropping frame in proxy because target is null."); 149 Logging.d(TAG, "Dropping frame in proxy because target is null.");
146 VideoRenderer.renderFrameDone(frame); 150 VideoRenderer.renderFrameDone(frame);
147 return; 151 return;
148 } 152 }
149 153
150 target.renderFrame(frame); 154 target.renderFrame(frame);
151 } 155 }
152 156
153 synchronized public void setTarget(VideoRenderer.Callbacks target) { 157 @Override
158 synchronized public void onFrame(VideoFrame frame) {
159 if (target == null) {
160 Logging.d(TAG, "Dropping frame in proxy because target is null.");
161 return;
162 }
163
164 target.onFrame(frame);
165 }
166
167 synchronized public void setTarget(T target) {
154 this.target = target; 168 this.target = target;
155 } 169 }
156 } 170 }
157 171
158 private final ProxyRenderer remoteProxyRenderer = new ProxyRenderer(); 172 private final ProxyRenderer remoteProxyRenderer = new ProxyRenderer();
159 private final ProxyRenderer localProxyRenderer = new ProxyRenderer(); 173 private final ProxyRenderer localProxyRenderer = new ProxyRenderer();
160 private PeerConnectionClient peerConnectionClient = null; 174 private PeerConnectionClient peerConnectionClient = null;
161 private AppRTCClient appRtcClient; 175 private AppRTCClient appRtcClient;
162 private SignalingParameters signalingParameters; 176 private SignalingParameters signalingParameters;
163 private AppRTCAudioManager audioManager = null; 177 private AppRTCAudioManager audioManager = null;
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 948 }
935 } 949 }
936 }); 950 });
937 } 951 }
938 952
939 @Override 953 @Override
940 public void onPeerConnectionError(final String description) { 954 public void onPeerConnectionError(final String description) {
941 reportError(description); 955 reportError(description);
942 } 956 }
943 } 957 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698