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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 @Override | 174 @Override |
175 public void onClick(View view) { | 175 public void onClick(View view) { |
176 toggleCallControlFragmentVisibility(); | 176 toggleCallControlFragmentVisibility(); |
177 } | 177 } |
178 }; | 178 }; |
179 | 179 |
180 localRender.setOnClickListener(listener); | 180 localRender.setOnClickListener(listener); |
181 remoteRender.setOnClickListener(listener); | 181 remoteRender.setOnClickListener(listener); |
182 | 182 |
183 // Create video renderers. | 183 // Create video renderers. |
184 rootEglBase = EglBase.create(); | 184 rootEglBase = new EglBase(); |
185 localRender.init(rootEglBase.getEglBaseContext(), null); | 185 localRender.init(rootEglBase.getContext(), null); |
186 remoteRender.init(rootEglBase.getEglBaseContext(), null); | 186 remoteRender.init(rootEglBase.getContext(), null); |
187 localRender.setZOrderMediaOverlay(true); | 187 localRender.setZOrderMediaOverlay(true); |
188 updateVideoView(); | 188 updateVideoView(); |
189 | 189 |
190 // Check for mandatory permissions. | 190 // Check for mandatory permissions. |
191 for (String permission : MANDATORY_PERMISSIONS) { | 191 for (String permission : MANDATORY_PERMISSIONS) { |
192 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_
GRANTED) { | 192 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_
GRANTED) { |
193 logAndToast("Permission " + permission + " is not granted"); | 193 logAndToast("Permission " + permission + " is not granted"); |
194 setResult(RESULT_CANCELED); | 194 setResult(RESULT_CANCELED); |
195 finish(); | 195 finish(); |
196 return; | 196 return; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // Activate call and HUD fragments and start the call. | 247 // Activate call and HUD fragments and start the call. |
248 FragmentTransaction ft = getFragmentManager().beginTransaction(); | 248 FragmentTransaction ft = getFragmentManager().beginTransaction(); |
249 ft.add(R.id.call_fragment_container, callFragment); | 249 ft.add(R.id.call_fragment_container, callFragment); |
250 ft.add(R.id.hud_fragment_container, hudFragment); | 250 ft.add(R.id.hud_fragment_container, hudFragment); |
251 ft.commit(); | 251 ft.commit(); |
252 startCall(); | 252 startCall(); |
253 | 253 |
254 // For command line execution run connection for <runTimeMs> and exit. | 254 // For command line execution run connection for <runTimeMs> and exit. |
255 if (commandLineRun && runTimeMs > 0) { | 255 if (commandLineRun && runTimeMs > 0) { |
256 (new Handler()).postDelayed(new Runnable() { | 256 (new Handler()).postDelayed(new Runnable() { |
257 @Override | |
258 public void run() { | 257 public void run() { |
259 disconnect(); | 258 disconnect(); |
260 } | 259 } |
261 }, runTimeMs); | 260 }, runTimeMs); |
262 } | 261 } |
263 | 262 |
264 peerConnectionClient = PeerConnectionClient.getInstance(); | 263 peerConnectionClient = PeerConnectionClient.getInstance(); |
265 peerConnectionClient.createPeerConnectionFactory( | 264 peerConnectionClient.createPeerConnectionFactory( |
266 CallActivity.this, peerConnectionParameters, CallActivity.this); | 265 CallActivity.this, peerConnectionParameters, CallActivity.this); |
267 } | 266 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 } | 481 } |
483 | 482 |
484 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- | 483 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- |
485 // All callbacks are invoked from websocket signaling looper thread and | 484 // All callbacks are invoked from websocket signaling looper thread and |
486 // are routed to UI thread. | 485 // are routed to UI thread. |
487 private void onConnectedToRoomInternal(final SignalingParameters params) { | 486 private void onConnectedToRoomInternal(final SignalingParameters params) { |
488 final long delta = System.currentTimeMillis() - callStartedTimeMs; | 487 final long delta = System.currentTimeMillis() - callStartedTimeMs; |
489 | 488 |
490 signalingParameters = params; | 489 signalingParameters = params; |
491 logAndToast("Creating peer connection, delay=" + delta + "ms"); | 490 logAndToast("Creating peer connection, delay=" + delta + "ms"); |
492 peerConnectionClient.createPeerConnection(rootEglBase.getEglBaseContext(), | 491 peerConnectionClient.createPeerConnection(rootEglBase.getContext(), |
493 localRender, remoteRender, signalingParameters); | 492 localRender, remoteRender, signalingParameters); |
494 | 493 |
495 if (signalingParameters.initiator) { | 494 if (signalingParameters.initiator) { |
496 logAndToast("Creating OFFER..."); | 495 logAndToast("Creating OFFER..."); |
497 // Create offer. Offer SDP will be sent to answering client in | 496 // Create offer. Offer SDP will be sent to answering client in |
498 // PeerConnectionEvents.onLocalDescription event. | 497 // PeerConnectionEvents.onLocalDescription event. |
499 peerConnectionClient.createOffer(); | 498 peerConnectionClient.createOffer(); |
500 } else { | 499 } else { |
501 if (params.offerSdp != null) { | 500 if (params.offerSdp != null) { |
502 peerConnectionClient.setRemoteDescription(params.offerSdp); | 501 peerConnectionClient.setRemoteDescription(params.offerSdp); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 } | 649 } |
651 } | 650 } |
652 }); | 651 }); |
653 } | 652 } |
654 | 653 |
655 @Override | 654 @Override |
656 public void onPeerConnectionError(final String description) { | 655 public void onPeerConnectionError(final String description) { |
657 reportError(description); | 656 reportError(description); |
658 } | 657 } |
659 } | 658 } |
OLD | NEW |