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...) Expand all 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.io.IOException; |
| 33 import java.lang.RuntimeException; |
| 34 import java.util.ArrayList; |
| 35 import java.util.List; |
| 36 |
32 import org.webrtc.Camera2Enumerator; | 37 import org.webrtc.Camera2Enumerator; |
33 import org.webrtc.EglBase; | 38 import org.webrtc.EglBase; |
| 39 import org.webrtc.GlVideoFileRenderer; |
34 import org.webrtc.IceCandidate; | 40 import org.webrtc.IceCandidate; |
35 import org.webrtc.PeerConnectionFactory; | 41 import org.webrtc.PeerConnectionFactory; |
36 import org.webrtc.RendererCommon.ScalingType; | 42 import org.webrtc.RendererCommon.ScalingType; |
37 import org.webrtc.SessionDescription; | 43 import org.webrtc.SessionDescription; |
38 import org.webrtc.StatsReport; | 44 import org.webrtc.StatsReport; |
39 import org.webrtc.SurfaceViewRenderer; | 45 import org.webrtc.SurfaceViewRenderer; |
| 46 import org.webrtc.VideoRenderer; |
40 | 47 |
41 /** | 48 /** |
42 * Activity for peer connection call setup, call waiting | 49 * Activity for peer connection call setup, call waiting |
43 * and call view. | 50 * and call view. |
44 */ | 51 */ |
45 public class CallActivity extends Activity | 52 public class CallActivity extends Activity |
46 implements AppRTCClient.SignalingEvents, | 53 implements AppRTCClient.SignalingEvents, |
47 PeerConnectionClient.PeerConnectionEvents, | 54 PeerConnectionClient.PeerConnectionEvents, |
48 CallFragment.OnCallEvents { | 55 CallFragment.OnCallEvents { |
49 | 56 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 "org.appspot.apprtc.DISABLE_BUILT_IN_NS"; | 96 "org.appspot.apprtc.DISABLE_BUILT_IN_NS"; |
90 public static final String EXTRA_ENABLE_LEVEL_CONTROL = | 97 public static final String EXTRA_ENABLE_LEVEL_CONTROL = |
91 "org.appspot.apprtc.ENABLE_LEVEL_CONTROL"; | 98 "org.appspot.apprtc.ENABLE_LEVEL_CONTROL"; |
92 public static final String EXTRA_DISPLAY_HUD = | 99 public static final String EXTRA_DISPLAY_HUD = |
93 "org.appspot.apprtc.DISPLAY_HUD"; | 100 "org.appspot.apprtc.DISPLAY_HUD"; |
94 public static final String EXTRA_TRACING = "org.appspot.apprtc.TRACING"; | 101 public static final String EXTRA_TRACING = "org.appspot.apprtc.TRACING"; |
95 public static final String EXTRA_CMDLINE = | 102 public static final String EXTRA_CMDLINE = |
96 "org.appspot.apprtc.CMDLINE"; | 103 "org.appspot.apprtc.CMDLINE"; |
97 public static final String EXTRA_RUNTIME = | 104 public static final String EXTRA_RUNTIME = |
98 "org.appspot.apprtc.RUNTIME"; | 105 "org.appspot.apprtc.RUNTIME"; |
| 106 public static final String EXTRA_VIDEO_FILE_AS_CAMERA = |
| 107 "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA"; |
| 108 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE = |
| 109 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; |
| 110 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = |
| 111 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; |
| 112 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = |
| 113 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; |
99 private static final String TAG = "CallRTCClient"; | 114 private static final String TAG = "CallRTCClient"; |
100 | 115 |
101 // List of mandatory application permissions. | 116 // List of mandatory application permissions. |
102 private static final String[] MANDATORY_PERMISSIONS = { | 117 private static final String[] MANDATORY_PERMISSIONS = { |
103 "android.permission.MODIFY_AUDIO_SETTINGS", | 118 "android.permission.MODIFY_AUDIO_SETTINGS", |
104 "android.permission.RECORD_AUDIO", | 119 "android.permission.RECORD_AUDIO", |
105 "android.permission.INTERNET" | 120 "android.permission.INTERNET" |
106 }; | 121 }; |
107 | 122 |
108 // Peer connection statistics callback period in ms. | 123 // Peer connection statistics callback period in ms. |
(...skipping 12 matching lines...) Expand all Loading... |
121 private static final int REMOTE_X = 0; | 136 private static final int REMOTE_X = 0; |
122 private static final int REMOTE_Y = 0; | 137 private static final int REMOTE_Y = 0; |
123 private static final int REMOTE_WIDTH = 100; | 138 private static final int REMOTE_WIDTH = 100; |
124 private static final int REMOTE_HEIGHT = 100; | 139 private static final int REMOTE_HEIGHT = 100; |
125 private PeerConnectionClient peerConnectionClient = null; | 140 private PeerConnectionClient peerConnectionClient = null; |
126 private AppRTCClient appRtcClient; | 141 private AppRTCClient appRtcClient; |
127 private SignalingParameters signalingParameters; | 142 private SignalingParameters signalingParameters; |
128 private AppRTCAudioManager audioManager = null; | 143 private AppRTCAudioManager audioManager = null; |
129 private EglBase rootEglBase; | 144 private EglBase rootEglBase; |
130 private SurfaceViewRenderer localRender; | 145 private SurfaceViewRenderer localRender; |
131 private SurfaceViewRenderer remoteRender; | 146 private SurfaceViewRenderer remoteRenderScreen; |
| 147 private GlVideoFileRenderer videoFileRenderer; |
| 148 private List<VideoRenderer.Callbacks> remoteRenders = new ArrayList<VideoRende
rer.Callbacks>(); |
132 private PercentFrameLayout localRenderLayout; | 149 private PercentFrameLayout localRenderLayout; |
133 private PercentFrameLayout remoteRenderLayout; | 150 private PercentFrameLayout remoteRenderLayout; |
134 private ScalingType scalingType; | 151 private ScalingType scalingType; |
135 private Toast logToast; | 152 private Toast logToast; |
136 private boolean commandLineRun; | 153 private boolean commandLineRun; |
137 private int runTimeMs; | 154 private int runTimeMs; |
138 private boolean activityRunning; | 155 private boolean activityRunning; |
139 private RoomConnectionParameters roomConnectionParameters; | 156 private RoomConnectionParameters roomConnectionParameters; |
140 private PeerConnectionParameters peerConnectionParameters; | 157 private PeerConnectionParameters peerConnectionParameters; |
141 private boolean iceConnected; | 158 private boolean iceConnected; |
(...skipping 27 matching lines...) Expand all Loading... |
169 | View.SYSTEM_UI_FLAG_FULLSCREEN | 186 | View.SYSTEM_UI_FLAG_FULLSCREEN |
170 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | 187 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); |
171 setContentView(R.layout.activity_call); | 188 setContentView(R.layout.activity_call); |
172 | 189 |
173 iceConnected = false; | 190 iceConnected = false; |
174 signalingParameters = null; | 191 signalingParameters = null; |
175 scalingType = ScalingType.SCALE_ASPECT_FILL; | 192 scalingType = ScalingType.SCALE_ASPECT_FILL; |
176 | 193 |
177 // Create UI controls. | 194 // Create UI controls. |
178 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view); | 195 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view); |
179 remoteRender = (SurfaceViewRenderer) findViewById(R.id.remote_video_view); | 196 remoteRenderScreen = (SurfaceViewRenderer) findViewById(R.id.remote_video_vi
ew); |
180 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou
t); | 197 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou
t); |
181 remoteRenderLayout = (PercentFrameLayout) findViewById(R.id.remote_video_lay
out); | 198 remoteRenderLayout = (PercentFrameLayout) findViewById(R.id.remote_video_lay
out); |
182 callFragment = new CallFragment(); | 199 callFragment = new CallFragment(); |
183 hudFragment = new HudFragment(); | 200 hudFragment = new HudFragment(); |
184 | 201 |
185 // Show/hide call control fragment on view click. | 202 // Show/hide call control fragment on view click. |
186 View.OnClickListener listener = new View.OnClickListener() { | 203 View.OnClickListener listener = new View.OnClickListener() { |
187 @Override | 204 @Override |
188 public void onClick(View view) { | 205 public void onClick(View view) { |
189 toggleCallControlFragmentVisibility(); | 206 toggleCallControlFragmentVisibility(); |
190 } | 207 } |
191 }; | 208 }; |
192 | 209 |
193 localRender.setOnClickListener(listener); | 210 localRender.setOnClickListener(listener); |
194 remoteRender.setOnClickListener(listener); | 211 remoteRenderScreen.setOnClickListener(listener); |
| 212 remoteRenders.add(remoteRenderScreen); |
| 213 |
| 214 final Intent intent = getIntent(); |
195 | 215 |
196 // Create video renderers. | 216 // Create video renderers. |
197 rootEglBase = EglBase.create(); | 217 rootEglBase = EglBase.create(); |
198 localRender.init(rootEglBase.getEglBaseContext(), null); | 218 localRender.init(rootEglBase.getEglBaseContext(), null); |
199 remoteRender.init(rootEglBase.getEglBaseContext(), null); | 219 String saveRemoteVideoToFile = intent.getStringExtra(EXTRA_SAVE_REMOTE_VIDEO
_TO_FILE); |
| 220 |
| 221 // When saveRemoveToFile is set we save the video from the remote to a file. |
| 222 if (saveRemoteVideoToFile != null) { |
| 223 int videoOutWidth = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WID
TH, 0); |
| 224 int videoOutHeight = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HE
IGHT, 0); |
| 225 try { |
| 226 videoFileRenderer = new GlVideoFileRenderer( |
| 227 saveRemoteVideoToFile, videoOutWidth, videoOutHeight, |
| 228 rootEglBase.getEglBaseContext()); |
| 229 remoteRenders.add(videoFileRenderer); |
| 230 } |
| 231 catch (IOException e) { |
| 232 throw new RuntimeException("Failed to open video file for output: " + sa
veRemoteVideoToFile, e); |
| 233 } |
| 234 } |
| 235 remoteRenderScreen.init(rootEglBase.getEglBaseContext(), null); |
| 236 |
200 localRender.setZOrderMediaOverlay(true); | 237 localRender.setZOrderMediaOverlay(true); |
201 updateVideoView(); | 238 updateVideoView(); |
202 | 239 |
203 // Check for mandatory permissions. | 240 // Check for mandatory permissions. |
204 for (String permission : MANDATORY_PERMISSIONS) { | 241 for (String permission : MANDATORY_PERMISSIONS) { |
205 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_
GRANTED) { | 242 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_
GRANTED) { |
206 logAndToast("Permission " + permission + " is not granted"); | 243 logAndToast("Permission " + permission + " is not granted"); |
207 setResult(RESULT_CANCELED); | 244 setResult(RESULT_CANCELED); |
208 finish(); | 245 finish(); |
209 return; | 246 return; |
210 } | 247 } |
211 } | 248 } |
212 | 249 |
213 // Get Intent parameters. | 250 // Get Intent parameters. |
214 final Intent intent = getIntent(); | |
215 Uri roomUri = intent.getData(); | 251 Uri roomUri = intent.getData(); |
216 if (roomUri == null) { | 252 if (roomUri == null) { |
217 logAndToast(getString(R.string.missing_url)); | 253 logAndToast(getString(R.string.missing_url)); |
218 Log.e(TAG, "Didn't get any URL in intent!"); | 254 Log.e(TAG, "Didn't get any URL in intent!"); |
219 setResult(RESULT_CANCELED); | 255 setResult(RESULT_CANCELED); |
220 finish(); | 256 finish(); |
221 return; | 257 return; |
222 } | 258 } |
223 String roomId = intent.getStringExtra(EXTRA_ROOMID); | 259 String roomId = intent.getStringExtra(EXTRA_ROOMID); |
| 260 Log.d(TAG, "Room ID: " + roomId); |
224 if (roomId == null || roomId.length() == 0) { | 261 if (roomId == null || roomId.length() == 0) { |
225 logAndToast(getString(R.string.missing_url)); | 262 logAndToast(getString(R.string.missing_url)); |
226 Log.e(TAG, "Incorrect room ID in intent!"); | 263 Log.e(TAG, "Incorrect room ID in intent!"); |
227 setResult(RESULT_CANCELED); | 264 setResult(RESULT_CANCELED); |
228 finish(); | 265 finish(); |
229 return; | 266 return; |
230 } | 267 } |
231 | 268 |
232 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); | 269 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); |
233 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); | 270 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); |
(...skipping 14 matching lines...) Expand all Loading... |
248 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), | 285 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), |
249 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), | 286 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), |
250 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), | 287 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), |
251 intent.getStringExtra(EXTRA_AUDIOCODEC), | 288 intent.getStringExtra(EXTRA_AUDIOCODEC), |
252 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), | 289 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), |
253 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), | 290 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), |
254 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), | 291 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), |
255 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), | 292 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), |
256 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), | 293 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), |
257 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), | 294 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), |
258 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false)); | 295 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false), |
259 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); | 296 intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA)); |
260 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 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...) Expand 10 before | Expand all | Expand 10 after 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...) Expand 10 before | Expand all | Expand 10 after 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...) Expand 10 before | Expand all | Expand 10 after 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...) Expand 10 before | Expand all | Expand 10 after 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 |