OLD | NEW |
---|---|
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 11 matching lines...) Loading... | |
22 import android.content.pm.PackageManager; | 22 import android.content.pm.PackageManager; |
23 import android.net.Uri; | 23 import android.net.Uri; |
24 import android.os.Bundle; | 24 import android.os.Bundle; |
25 import android.os.Handler; | 25 import android.os.Handler; |
26 import android.util.Log; | 26 import android.util.Log; |
27 import android.view.View; | 27 import android.view.View; |
28 import android.view.Window; | 28 import android.view.Window; |
29 import android.view.WindowManager.LayoutParams; | 29 import android.view.WindowManager.LayoutParams; |
30 import android.widget.Toast; | 30 import android.widget.Toast; |
31 | 31 |
32 import java.util.ArrayList; | |
33 import java.util.List; | |
34 | |
32 import org.webrtc.Camera2Enumerator; | 35 import org.webrtc.Camera2Enumerator; |
33 import org.webrtc.EglBase; | 36 import org.webrtc.EglBase; |
37 import org.webrtc.GlVideoFileRenderer; | |
38 import org.webrtc.GlRectDrawer; | |
magjed_webrtc
2016/09/16 13:46:25
This import is unused.
mandermo
2016/09/23 15:12:03
Done.
| |
34 import org.webrtc.IceCandidate; | 39 import org.webrtc.IceCandidate; |
35 import org.webrtc.PeerConnectionFactory; | 40 import org.webrtc.PeerConnectionFactory; |
36 import org.webrtc.RendererCommon.ScalingType; | 41 import org.webrtc.RendererCommon.ScalingType; |
37 import org.webrtc.SessionDescription; | 42 import org.webrtc.SessionDescription; |
38 import org.webrtc.StatsReport; | 43 import org.webrtc.StatsReport; |
39 import org.webrtc.SurfaceViewRenderer; | 44 import org.webrtc.SurfaceViewRenderer; |
45 import org.webrtc.VideoRenderer; | |
40 | 46 |
41 /** | 47 /** |
42 * Activity for peer connection call setup, call waiting | 48 * Activity for peer connection call setup, call waiting |
43 * and call view. | 49 * and call view. |
44 */ | 50 */ |
45 public class CallActivity extends Activity | 51 public class CallActivity extends Activity |
46 implements AppRTCClient.SignalingEvents, | 52 implements AppRTCClient.SignalingEvents, |
47 PeerConnectionClient.PeerConnectionEvents, | 53 PeerConnectionClient.PeerConnectionEvents, |
48 CallFragment.OnCallEvents { | 54 CallFragment.OnCallEvents { |
49 | 55 |
(...skipping 39 matching lines...) Loading... | |
89 "org.appspot.apprtc.DISABLE_BUILT_IN_NS"; | 95 "org.appspot.apprtc.DISABLE_BUILT_IN_NS"; |
90 public static final String EXTRA_ENABLE_LEVEL_CONTROL = | 96 public static final String EXTRA_ENABLE_LEVEL_CONTROL = |
91 "org.appspot.apprtc.ENABLE_LEVEL_CONTROL"; | 97 "org.appspot.apprtc.ENABLE_LEVEL_CONTROL"; |
92 public static final String EXTRA_DISPLAY_HUD = | 98 public static final String EXTRA_DISPLAY_HUD = |
93 "org.appspot.apprtc.DISPLAY_HUD"; | 99 "org.appspot.apprtc.DISPLAY_HUD"; |
94 public static final String EXTRA_TRACING = "org.appspot.apprtc.TRACING"; | 100 public static final String EXTRA_TRACING = "org.appspot.apprtc.TRACING"; |
95 public static final String EXTRA_CMDLINE = | 101 public static final String EXTRA_CMDLINE = |
96 "org.appspot.apprtc.CMDLINE"; | 102 "org.appspot.apprtc.CMDLINE"; |
97 public static final String EXTRA_RUNTIME = | 103 public static final String EXTRA_RUNTIME = |
98 "org.appspot.apprtc.RUNTIME"; | 104 "org.appspot.apprtc.RUNTIME"; |
105 public static final String EXTRA_VIDEO_FILE_AS_CAMERA = | |
106 "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA"; | |
107 public static final String EXTRA_VIDEO_FILE_AS_CAMERA_WIDTH = | |
108 "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_WIDTH"; | |
109 public static final String EXTRA_VIDEO_FILE_AS_CAMERA_HEIGHT = | |
110 "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_HEIGHT"; | |
111 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE = | |
112 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; | |
113 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = | |
114 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; | |
115 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = | |
116 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; | |
99 private static final String TAG = "CallRTCClient"; | 117 private static final String TAG = "CallRTCClient"; |
100 | 118 |
101 // List of mandatory application permissions. | 119 // List of mandatory application permissions. |
102 private static final String[] MANDATORY_PERMISSIONS = { | 120 private static final String[] MANDATORY_PERMISSIONS = { |
103 "android.permission.MODIFY_AUDIO_SETTINGS", | 121 "android.permission.MODIFY_AUDIO_SETTINGS", |
104 "android.permission.RECORD_AUDIO", | 122 "android.permission.RECORD_AUDIO", |
105 "android.permission.INTERNET" | 123 "android.permission.INTERNET" |
106 }; | 124 }; |
107 | 125 |
108 // Peer connection statistics callback period in ms. | 126 // Peer connection statistics callback period in ms. |
(...skipping 12 matching lines...) Loading... | |
121 private static final int REMOTE_X = 0; | 139 private static final int REMOTE_X = 0; |
122 private static final int REMOTE_Y = 0; | 140 private static final int REMOTE_Y = 0; |
123 private static final int REMOTE_WIDTH = 100; | 141 private static final int REMOTE_WIDTH = 100; |
124 private static final int REMOTE_HEIGHT = 100; | 142 private static final int REMOTE_HEIGHT = 100; |
125 private PeerConnectionClient peerConnectionClient = null; | 143 private PeerConnectionClient peerConnectionClient = null; |
126 private AppRTCClient appRtcClient; | 144 private AppRTCClient appRtcClient; |
127 private SignalingParameters signalingParameters; | 145 private SignalingParameters signalingParameters; |
128 private AppRTCAudioManager audioManager = null; | 146 private AppRTCAudioManager audioManager = null; |
129 private EglBase rootEglBase; | 147 private EglBase rootEglBase; |
130 private SurfaceViewRenderer localRender; | 148 private SurfaceViewRenderer localRender; |
131 private SurfaceViewRenderer remoteRender; | 149 private SurfaceViewRenderer remoteRenderScreen; |
150 private GlVideoFileRenderer videoFileRenderer; | |
151 private List<VideoRenderer.Callbacks> remoteRenders = new ArrayList<VideoRende rer.Callbacks>(); | |
132 private PercentFrameLayout localRenderLayout; | 152 private PercentFrameLayout localRenderLayout; |
133 private PercentFrameLayout remoteRenderLayout; | 153 private PercentFrameLayout remoteRenderLayout; |
134 private ScalingType scalingType; | 154 private ScalingType scalingType; |
135 private Toast logToast; | 155 private Toast logToast; |
136 private boolean commandLineRun; | 156 private boolean commandLineRun; |
137 private int runTimeMs; | 157 private int runTimeMs; |
138 private boolean activityRunning; | 158 private boolean activityRunning; |
139 private RoomConnectionParameters roomConnectionParameters; | 159 private RoomConnectionParameters roomConnectionParameters; |
140 private PeerConnectionParameters peerConnectionParameters; | 160 private PeerConnectionParameters peerConnectionParameters; |
141 private boolean iceConnected; | 161 private boolean iceConnected; |
(...skipping 27 matching lines...) Loading... | |
169 | View.SYSTEM_UI_FLAG_FULLSCREEN | 189 | View.SYSTEM_UI_FLAG_FULLSCREEN |
170 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | 190 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); |
171 setContentView(R.layout.activity_call); | 191 setContentView(R.layout.activity_call); |
172 | 192 |
173 iceConnected = false; | 193 iceConnected = false; |
174 signalingParameters = null; | 194 signalingParameters = null; |
175 scalingType = ScalingType.SCALE_ASPECT_FILL; | 195 scalingType = ScalingType.SCALE_ASPECT_FILL; |
176 | 196 |
177 // Create UI controls. | 197 // Create UI controls. |
178 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view); | 198 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view); |
179 remoteRender = (SurfaceViewRenderer) findViewById(R.id.remote_video_view); | 199 remoteRenderScreen = (SurfaceViewRenderer) findViewById(R.id.remote_video_vi ew); |
180 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou t); | 200 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou t); |
181 remoteRenderLayout = (PercentFrameLayout) findViewById(R.id.remote_video_lay out); | 201 remoteRenderLayout = (PercentFrameLayout) findViewById(R.id.remote_video_lay out); |
182 callFragment = new CallFragment(); | 202 callFragment = new CallFragment(); |
183 hudFragment = new HudFragment(); | 203 hudFragment = new HudFragment(); |
184 | 204 |
185 // Show/hide call control fragment on view click. | 205 // Show/hide call control fragment on view click. |
186 View.OnClickListener listener = new View.OnClickListener() { | 206 View.OnClickListener listener = new View.OnClickListener() { |
187 @Override | 207 @Override |
188 public void onClick(View view) { | 208 public void onClick(View view) { |
189 toggleCallControlFragmentVisibility(); | 209 toggleCallControlFragmentVisibility(); |
190 } | 210 } |
191 }; | 211 }; |
192 | 212 |
193 localRender.setOnClickListener(listener); | 213 localRender.setOnClickListener(listener); |
194 remoteRender.setOnClickListener(listener); | 214 remoteRenderScreen.setOnClickListener(listener); |
215 remoteRenders.add(remoteRenderScreen); | |
216 | |
217 final Intent intent = getIntent(); | |
195 | 218 |
196 // Create video renderers. | 219 // Create video renderers. |
197 rootEglBase = EglBase.create(); | 220 rootEglBase = EglBase.create(); |
198 localRender.init(rootEglBase.getEglBaseContext(), null); | 221 localRender.init(rootEglBase.getEglBaseContext(), null); |
199 remoteRender.init(rootEglBase.getEglBaseContext(), null); | 222 String saveRemoteVideoToFile = intent.getStringExtra(EXTRA_SAVE_REMOTE_VIDEO _TO_FILE); |
223 | |
224 // When saveRemoveToFile is set we save the video from the remote to a file. | |
225 if (saveRemoteVideoToFile != null) { | |
226 int videoOutWidth = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WID TH, 0); | |
227 int videoOutHeight = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HE IGHT, 0); | |
228 videoFileRenderer = new GlVideoFileRenderer( | |
229 saveRemoteVideoToFile, videoOutWidth, videoOutHeight, | |
230 rootEglBase.getEglBaseContext()); | |
231 remoteRenders.add(videoFileRenderer); | |
232 } | |
233 remoteRenderScreen.init(rootEglBase.getEglBaseContext(), null); | |
234 | |
200 localRender.setZOrderMediaOverlay(true); | 235 localRender.setZOrderMediaOverlay(true); |
201 updateVideoView(); | 236 updateVideoView(); |
202 | 237 |
203 // Check for mandatory permissions. | 238 // Check for mandatory permissions. |
204 for (String permission : MANDATORY_PERMISSIONS) { | 239 for (String permission : MANDATORY_PERMISSIONS) { |
205 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_ GRANTED) { | 240 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_ GRANTED) { |
206 logAndToast("Permission " + permission + " is not granted"); | 241 logAndToast("Permission " + permission + " is not granted"); |
207 setResult(RESULT_CANCELED); | 242 setResult(RESULT_CANCELED); |
208 finish(); | 243 finish(); |
209 return; | 244 return; |
210 } | 245 } |
211 } | 246 } |
212 | 247 |
213 // Get Intent parameters. | 248 // Get Intent parameters. |
214 final Intent intent = getIntent(); | |
215 Uri roomUri = intent.getData(); | 249 Uri roomUri = intent.getData(); |
216 if (roomUri == null) { | 250 if (roomUri == null) { |
217 logAndToast(getString(R.string.missing_url)); | 251 logAndToast(getString(R.string.missing_url)); |
218 Log.e(TAG, "Didn't get any URL in intent!"); | 252 Log.e(TAG, "Didn't get any URL in intent!"); |
219 setResult(RESULT_CANCELED); | 253 setResult(RESULT_CANCELED); |
220 finish(); | 254 finish(); |
221 return; | 255 return; |
222 } | 256 } |
223 String roomId = intent.getStringExtra(EXTRA_ROOMID); | 257 String roomId = intent.getStringExtra(EXTRA_ROOMID); |
258 Log.d(TAG, "Room ID: " + roomId); | |
224 if (roomId == null || roomId.length() == 0) { | 259 if (roomId == null || roomId.length() == 0) { |
225 logAndToast(getString(R.string.missing_url)); | 260 logAndToast(getString(R.string.missing_url)); |
226 Log.e(TAG, "Incorrect room ID in intent!"); | 261 Log.e(TAG, "Incorrect room ID in intent!"); |
227 setResult(RESULT_CANCELED); | 262 setResult(RESULT_CANCELED); |
228 finish(); | 263 finish(); |
229 return; | 264 return; |
230 } | 265 } |
231 | 266 |
232 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); | 267 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); |
233 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); | 268 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); |
(...skipping 14 matching lines...) Loading... | |
248 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), | 283 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), |
249 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), | 284 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), |
250 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), | 285 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), |
251 intent.getStringExtra(EXTRA_AUDIOCODEC), | 286 intent.getStringExtra(EXTRA_AUDIOCODEC), |
252 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), | 287 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), |
253 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), | 288 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), |
254 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), | 289 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), |
255 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), | 290 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), |
256 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), | 291 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), |
257 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), | 292 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), |
258 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false)); | 293 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false), |
259 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); | 294 intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA), |
260 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); | 295 intent.getIntExtra(EXTRA_VIDEO_FILE_AS_CAMERA_WIDTH, 0), |
296 intent.getIntExtra(EXTRA_VIDEO_FILE_AS_CAMERA_HEIGHT, 0)); | |
297 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); | |
298 | |
299 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER A) + "'"); | |
261 | 300 |
262 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the | 301 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the |
263 // standard WebSocketRTCClient. | 302 // standard WebSocketRTCClient. |
264 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { | 303 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { |
265 appRtcClient = new WebSocketRTCClient(this); | 304 appRtcClient = new WebSocketRTCClient(this); |
266 } else { | 305 } else { |
267 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); | 306 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); |
268 appRtcClient = new DirectRTCClient(this); | 307 appRtcClient = new DirectRTCClient(this); |
269 } | 308 } |
270 // Create connection parameters. | 309 // Create connection parameters. |
(...skipping 115 matching lines...) Loading... | |
386 } else { | 425 } else { |
387 ft.hide(callFragment); | 426 ft.hide(callFragment); |
388 ft.hide(hudFragment); | 427 ft.hide(hudFragment); |
389 } | 428 } |
390 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); | 429 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); |
391 ft.commit(); | 430 ft.commit(); |
392 } | 431 } |
393 | 432 |
394 private void updateVideoView() { | 433 private void updateVideoView() { |
395 remoteRenderLayout.setPosition(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIG HT); | 434 remoteRenderLayout.setPosition(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIG HT); |
396 remoteRender.setScalingType(scalingType); | 435 remoteRenderScreen.setScalingType(scalingType); |
397 remoteRender.setMirror(false); | 436 remoteRenderScreen.setMirror(false); |
398 | 437 |
399 if (iceConnected) { | 438 if (iceConnected) { |
400 localRenderLayout.setPosition( | 439 localRenderLayout.setPosition( |
401 LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEI GHT_CONNECTED); | 440 LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEI GHT_CONNECTED); |
402 localRender.setScalingType(ScalingType.SCALE_ASPECT_FIT); | 441 localRender.setScalingType(ScalingType.SCALE_ASPECT_FIT); |
403 } else { | 442 } else { |
404 localRenderLayout.setPosition( | 443 localRenderLayout.setPosition( |
405 LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_ HEIGHT_CONNECTING); | 444 LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_ HEIGHT_CONNECTING); |
406 localRender.setScalingType(scalingType); | 445 localRender.setScalingType(scalingType); |
407 } | 446 } |
408 localRender.setMirror(true); | 447 localRender.setMirror(true); |
409 | 448 |
410 localRender.requestLayout(); | 449 localRender.requestLayout(); |
411 remoteRender.requestLayout(); | 450 remoteRenderScreen.requestLayout(); |
412 } | 451 } |
413 | 452 |
414 private void startCall() { | 453 private void startCall() { |
415 if (appRtcClient == null) { | 454 if (appRtcClient == null) { |
416 Log.e(TAG, "AppRTC client is not allocated for a call."); | 455 Log.e(TAG, "AppRTC client is not allocated for a call."); |
417 return; | 456 return; |
418 } | 457 } |
419 callStartedTimeMs = System.currentTimeMillis(); | 458 callStartedTimeMs = System.currentTimeMillis(); |
420 | 459 |
421 // Start room connection. | 460 // Start room connection. |
(...skipping 45 matching lines...) Loading... | |
467 appRtcClient = null; | 506 appRtcClient = null; |
468 } | 507 } |
469 if (peerConnectionClient != null) { | 508 if (peerConnectionClient != null) { |
470 peerConnectionClient.close(); | 509 peerConnectionClient.close(); |
471 peerConnectionClient = null; | 510 peerConnectionClient = null; |
472 } | 511 } |
473 if (localRender != null) { | 512 if (localRender != null) { |
474 localRender.release(); | 513 localRender.release(); |
475 localRender = null; | 514 localRender = null; |
476 } | 515 } |
477 if (remoteRender != null) { | 516 if (videoFileRenderer != null) { |
478 remoteRender.release(); | 517 videoFileRenderer.release(); |
479 remoteRender = null; | 518 videoFileRenderer = null; |
519 } | |
520 if (remoteRenderScreen != null) { | |
521 remoteRenderScreen.release(); | |
522 remoteRenderScreen = null; | |
480 } | 523 } |
481 if (audioManager != null) { | 524 if (audioManager != null) { |
482 audioManager.close(); | 525 audioManager.close(); |
483 audioManager = null; | 526 audioManager = null; |
484 } | 527 } |
485 if (iceConnected && !isError) { | 528 if (iceConnected && !isError) { |
486 setResult(RESULT_OK); | 529 setResult(RESULT_OK); |
487 } else { | 530 } else { |
488 setResult(RESULT_CANCELED); | 531 setResult(RESULT_CANCELED); |
489 } | 532 } |
(...skipping 43 matching lines...) Loading... | |
533 | 576 |
534 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- | 577 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- |
535 // All callbacks are invoked from websocket signaling looper thread and | 578 // All callbacks are invoked from websocket signaling looper thread and |
536 // are routed to UI thread. | 579 // are routed to UI thread. |
537 private void onConnectedToRoomInternal(final SignalingParameters params) { | 580 private void onConnectedToRoomInternal(final SignalingParameters params) { |
538 final long delta = System.currentTimeMillis() - callStartedTimeMs; | 581 final long delta = System.currentTimeMillis() - callStartedTimeMs; |
539 | 582 |
540 signalingParameters = params; | 583 signalingParameters = params; |
541 logAndToast("Creating peer connection, delay=" + delta + "ms"); | 584 logAndToast("Creating peer connection, delay=" + delta + "ms"); |
542 peerConnectionClient.createPeerConnection(rootEglBase.getEglBaseContext(), | 585 peerConnectionClient.createPeerConnection(rootEglBase.getEglBaseContext(), |
543 localRender, remoteRender, signalingParameters); | 586 localRender, remoteRenders, signalingParameters); |
544 | 587 |
545 if (signalingParameters.initiator) { | 588 if (signalingParameters.initiator) { |
546 logAndToast("Creating OFFER..."); | 589 logAndToast("Creating OFFER..."); |
547 // Create offer. Offer SDP will be sent to answering client in | 590 // Create offer. Offer SDP will be sent to answering client in |
548 // PeerConnectionEvents.onLocalDescription event. | 591 // PeerConnectionEvents.onLocalDescription event. |
549 peerConnectionClient.createOffer(); | 592 peerConnectionClient.createOffer(); |
550 } else { | 593 } else { |
551 if (params.offerSdp != null) { | 594 if (params.offerSdp != null) { |
552 peerConnectionClient.setRemoteDescription(params.offerSdp); | 595 peerConnectionClient.setRemoteDescription(params.offerSdp); |
553 logAndToast("Creating ANSWER..."); | 596 logAndToast("Creating ANSWER..."); |
(...skipping 175 matching lines...) Loading... | |
729 } | 772 } |
730 } | 773 } |
731 }); | 774 }); |
732 } | 775 } |
733 | 776 |
734 @Override | 777 @Override |
735 public void onPeerConnectionError(final String description) { | 778 public void onPeerConnectionError(final String description) { |
736 reportError(description); | 779 reportError(description); |
737 } | 780 } |
738 } | 781 } |
OLD | NEW |