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 = new EglBase(); | 184 rootEglBase = EglBase.create(); |
185 localRender.init(rootEglBase.getContext(), null); | 185 localRender.init(rootEglBase.getEglBaseContext(), null); |
186 remoteRender.init(rootEglBase.getContext(), null); | 186 remoteRender.init(rootEglBase.getEglBaseContext(), 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 |
257 public void run() { | 258 public void run() { |
258 disconnect(); | 259 disconnect(); |
259 } | 260 } |
260 }, runTimeMs); | 261 }, runTimeMs); |
261 } | 262 } |
262 | 263 |
263 peerConnectionClient = PeerConnectionClient.getInstance(); | 264 peerConnectionClient = PeerConnectionClient.getInstance(); |
264 peerConnectionClient.createPeerConnectionFactory( | 265 peerConnectionClient.createPeerConnectionFactory( |
265 CallActivity.this, peerConnectionParameters, CallActivity.this); | 266 CallActivity.this, peerConnectionParameters, CallActivity.this); |
266 } | 267 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 482 } |
482 | 483 |
483 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- | 484 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- |
484 // All callbacks are invoked from websocket signaling looper thread and | 485 // All callbacks are invoked from websocket signaling looper thread and |
485 // are routed to UI thread. | 486 // are routed to UI thread. |
486 private void onConnectedToRoomInternal(final SignalingParameters params) { | 487 private void onConnectedToRoomInternal(final SignalingParameters params) { |
487 final long delta = System.currentTimeMillis() - callStartedTimeMs; | 488 final long delta = System.currentTimeMillis() - callStartedTimeMs; |
488 | 489 |
489 signalingParameters = params; | 490 signalingParameters = params; |
490 logAndToast("Creating peer connection, delay=" + delta + "ms"); | 491 logAndToast("Creating peer connection, delay=" + delta + "ms"); |
491 peerConnectionClient.createPeerConnection(rootEglBase.getContext(), | 492 peerConnectionClient.createPeerConnection(rootEglBase.getEglBaseContext(), |
492 localRender, remoteRender, signalingParameters); | 493 localRender, remoteRender, signalingParameters); |
493 | 494 |
494 if (signalingParameters.initiator) { | 495 if (signalingParameters.initiator) { |
495 logAndToast("Creating OFFER..."); | 496 logAndToast("Creating OFFER..."); |
496 // Create offer. Offer SDP will be sent to answering client in | 497 // Create offer. Offer SDP will be sent to answering client in |
497 // PeerConnectionEvents.onLocalDescription event. | 498 // PeerConnectionEvents.onLocalDescription event. |
498 peerConnectionClient.createOffer(); | 499 peerConnectionClient.createOffer(); |
499 } else { | 500 } else { |
500 if (params.offerSdp != null) { | 501 if (params.offerSdp != null) { |
501 peerConnectionClient.setRemoteDescription(params.offerSdp); | 502 peerConnectionClient.setRemoteDescription(params.offerSdp); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 650 } |
650 } | 651 } |
651 }); | 652 }); |
652 } | 653 } |
653 | 654 |
654 @Override | 655 @Override |
655 public void onPeerConnectionError(final String description) { | 656 public void onPeerConnectionError(final String description) { |
656 reportError(description); | 657 reportError(description); |
657 } | 658 } |
658 } | 659 } |
OLD | NEW |