Chromium Code Reviews| 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 |
| 11 package org.appspot.apprtc; | 11 package org.appspot.apprtc; |
| 12 | 12 |
| 13 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; | 13 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; |
| 14 import org.appspot.apprtc.AppRTCClient.SignalingParameters; | 14 import org.appspot.apprtc.AppRTCClient.SignalingParameters; |
| 15 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; | 15 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; |
| 16 import org.appspot.apprtc.util.LooperExecutor; | 16 import org.appspot.apprtc.util.LooperExecutor; |
| 17 | 17 |
| 18 import android.app.Activity; | 18 import android.app.Activity; |
| 19 import android.app.AlertDialog; | 19 import android.app.AlertDialog; |
| 20 import android.app.FragmentTransaction; | 20 import android.app.FragmentTransaction; |
| 21 import android.content.DialogInterface; | 21 import android.content.DialogInterface; |
| 22 import android.content.Intent; | 22 import android.content.Intent; |
| 23 import android.content.pm.PackageManager; | 23 import android.content.pm.PackageManager; |
| 24 import android.net.Uri; | 24 import android.net.Uri; |
| 25 import android.opengl.GLSurfaceView; | 25 import android.opengl.GLSurfaceView; |
| 26 import android.os.Bundle; | 26 import android.os.Bundle; |
| 27 import android.os.Handler; | |
| 27 import android.util.Log; | 28 import android.util.Log; |
| 28 import android.view.View; | 29 import android.view.View; |
| 29 import android.view.Window; | 30 import android.view.Window; |
| 30 import android.view.WindowManager.LayoutParams; | 31 import android.view.WindowManager.LayoutParams; |
| 31 import android.widget.Toast; | 32 import android.widget.Toast; |
| 32 | 33 |
| 34 import org.webrtc.EglBase; | |
| 33 import org.webrtc.IceCandidate; | 35 import org.webrtc.IceCandidate; |
| 34 import org.webrtc.SessionDescription; | 36 import org.webrtc.SessionDescription; |
| 35 import org.webrtc.StatsReport; | 37 import org.webrtc.StatsReport; |
| 36 import org.webrtc.RendererCommon.ScalingType; | 38 import org.webrtc.RendererCommon.ScalingType; |
| 37 import org.webrtc.VideoRenderer; | 39 import org.webrtc.SurfaceViewRenderer; |
| 38 import org.webrtc.VideoRendererGui; | |
| 39 | 40 |
| 40 /** | 41 /** |
| 41 * Activity for peer connection call setup, call waiting | 42 * Activity for peer connection call setup, call waiting |
| 42 * and call view. | 43 * and call view. |
| 43 */ | 44 */ |
| 44 public class CallActivity extends Activity | 45 public class CallActivity extends Activity |
| 45 implements AppRTCClient.SignalingEvents, | 46 implements AppRTCClient.SignalingEvents, |
| 46 PeerConnectionClient.PeerConnectionEvents, | 47 PeerConnectionClient.PeerConnectionEvents, |
| 47 CallFragment.OnCallEvents { | 48 CallFragment.OnCallEvents { |
| 48 | 49 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 // Local preview screen position after call is connected. | 98 // Local preview screen position after call is connected. |
| 98 private static final int LOCAL_X_CONNECTED = 72; | 99 private static final int LOCAL_X_CONNECTED = 72; |
| 99 private static final int LOCAL_Y_CONNECTED = 72; | 100 private static final int LOCAL_Y_CONNECTED = 72; |
| 100 private static final int LOCAL_WIDTH_CONNECTED = 25; | 101 private static final int LOCAL_WIDTH_CONNECTED = 25; |
| 101 private static final int LOCAL_HEIGHT_CONNECTED = 25; | 102 private static final int LOCAL_HEIGHT_CONNECTED = 25; |
| 102 // Remote video screen position | 103 // Remote video screen position |
| 103 private static final int REMOTE_X = 0; | 104 private static final int REMOTE_X = 0; |
| 104 private static final int REMOTE_Y = 0; | 105 private static final int REMOTE_Y = 0; |
| 105 private static final int REMOTE_WIDTH = 100; | 106 private static final int REMOTE_WIDTH = 100; |
| 106 private static final int REMOTE_HEIGHT = 100; | 107 private static final int REMOTE_HEIGHT = 100; |
| 107 | |
| 108 private PeerConnectionClient peerConnectionClient = null; | 108 private PeerConnectionClient peerConnectionClient = null; |
| 109 private AppRTCClient appRtcClient; | 109 private AppRTCClient appRtcClient; |
| 110 private SignalingParameters signalingParameters; | 110 private SignalingParameters signalingParameters; |
| 111 private AppRTCAudioManager audioManager = null; | 111 private AppRTCAudioManager audioManager = null; |
| 112 private VideoRenderer.Callbacks localRender; | 112 private EglBase rootEglBase; |
| 113 private VideoRenderer.Callbacks remoteRender; | 113 private SurfaceViewRenderer localRender; |
| 114 private SurfaceViewRenderer remoteRender; | |
| 115 private PercentFrameLayout localRenderLayout; | |
| 116 private PercentFrameLayout remoteRenderLayout; | |
| 114 private ScalingType scalingType; | 117 private ScalingType scalingType; |
| 115 private Toast logToast; | 118 private Toast logToast; |
| 116 private boolean commandLineRun; | 119 private boolean commandLineRun; |
| 117 private int runTimeMs; | 120 private int runTimeMs; |
| 118 private boolean activityRunning; | 121 private boolean activityRunning; |
| 119 private RoomConnectionParameters roomConnectionParameters; | 122 private RoomConnectionParameters roomConnectionParameters; |
| 120 private PeerConnectionParameters peerConnectionParameters; | 123 private PeerConnectionParameters peerConnectionParameters; |
| 121 private boolean iceConnected; | 124 private boolean iceConnected; |
| 122 private boolean isError; | 125 private boolean isError; |
| 123 private boolean callControlFragmentVisible = true; | 126 private boolean callControlFragmentVisible = true; |
| 124 private long callStartedTimeMs = 0; | 127 private long callStartedTimeMs = 0; |
| 125 | 128 |
| 126 // Controls | 129 // Controls |
| 127 private GLSurfaceView videoView; | |
| 128 CallFragment callFragment; | 130 CallFragment callFragment; |
| 129 HudFragment hudFragment; | 131 HudFragment hudFragment; |
| 130 | 132 |
| 131 @Override | 133 @Override |
| 132 public void onCreate(Bundle savedInstanceState) { | 134 public void onCreate(Bundle savedInstanceState) { |
| 133 super.onCreate(savedInstanceState); | 135 super.onCreate(savedInstanceState); |
| 134 Thread.setDefaultUncaughtExceptionHandler( | 136 Thread.setDefaultUncaughtExceptionHandler( |
| 135 new UnhandledExceptionHandler(this)); | 137 new UnhandledExceptionHandler(this)); |
| 136 | 138 |
| 137 // Set window styles for fullscreen-window size. Needs to be done before | 139 // Set window styles for fullscreen-window size. Needs to be done before |
| 138 // adding content. | 140 // adding content. |
| 139 requestWindowFeature(Window.FEATURE_NO_TITLE); | 141 requestWindowFeature(Window.FEATURE_NO_TITLE); |
| 140 getWindow().addFlags( | 142 getWindow().addFlags( |
| 141 LayoutParams.FLAG_FULLSCREEN | 143 LayoutParams.FLAG_FULLSCREEN |
| 142 | LayoutParams.FLAG_KEEP_SCREEN_ON | 144 | LayoutParams.FLAG_KEEP_SCREEN_ON |
| 143 | LayoutParams.FLAG_DISMISS_KEYGUARD | 145 | LayoutParams.FLAG_DISMISS_KEYGUARD |
| 144 | LayoutParams.FLAG_SHOW_WHEN_LOCKED | 146 | LayoutParams.FLAG_SHOW_WHEN_LOCKED |
| 145 | LayoutParams.FLAG_TURN_SCREEN_ON); | 147 | LayoutParams.FLAG_TURN_SCREEN_ON); |
| 146 getWindow().getDecorView().setSystemUiVisibility( | 148 getWindow().getDecorView().setSystemUiVisibility( |
| 147 View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | 149 View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
| 148 | View.SYSTEM_UI_FLAG_FULLSCREEN | 150 | View.SYSTEM_UI_FLAG_FULLSCREEN |
| 149 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | 151 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); |
| 150 setContentView(R.layout.activity_call); | 152 setContentView(R.layout.activity_call); |
| 151 | 153 |
| 152 iceConnected = false; | 154 iceConnected = false; |
| 153 signalingParameters = null; | 155 signalingParameters = null; |
| 154 scalingType = ScalingType.SCALE_ASPECT_FILL; | 156 scalingType = ScalingType.SCALE_ASPECT_FILL; |
| 155 | 157 |
| 156 // Create UI controls. | 158 // Create UI controls. |
| 157 videoView = (GLSurfaceView) findViewById(R.id.glview_call); | 159 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view); |
| 160 remoteRender = (SurfaceViewRenderer) findViewById(R.id.remote_video_view); | |
| 161 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou t); | |
| 162 remoteRenderLayout = (PercentFrameLayout) findViewById(R.id.remote_video_lay out); | |
| 158 callFragment = new CallFragment(); | 163 callFragment = new CallFragment(); |
| 159 hudFragment = new HudFragment(); | 164 hudFragment = new HudFragment(); |
| 160 | 165 |
| 161 // Create video renderers. | |
| 162 VideoRendererGui.setView(videoView, new Runnable() { | |
| 163 @Override | |
| 164 public void run() { | |
| 165 createPeerConnectionFactory(); | |
| 166 } | |
| 167 }); | |
| 168 remoteRender = VideoRendererGui.create( | |
| 169 REMOTE_X, REMOTE_Y, | |
| 170 REMOTE_WIDTH, REMOTE_HEIGHT, scalingType, false); | |
| 171 localRender = VideoRendererGui.create( | |
| 172 LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, | |
| 173 LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING, scalingType, true); | |
| 174 | |
| 175 // Show/hide call control fragment on view click. | 166 // Show/hide call control fragment on view click. |
| 176 videoView.setOnClickListener(new View.OnClickListener() { | 167 View.OnClickListener listener = new View.OnClickListener() { |
| 177 @Override | 168 @Override |
| 178 public void onClick(View view) { | 169 public void onClick(View view) { |
| 179 toggleCallControlFragmentVisibility(); | 170 toggleCallControlFragmentVisibility(); |
| 180 } | 171 } |
| 181 }); | 172 }; |
| 173 | |
| 174 localRender.setOnClickListener(listener); | |
| 175 remoteRender.setOnClickListener(listener); | |
| 176 | |
| 177 // Create video renderers. | |
| 178 rootEglBase = new EglBase(); | |
| 179 localRender.init(rootEglBase.getContext(), null); | |
| 180 remoteRender.init(rootEglBase.getContext(), null); | |
| 181 localRender.setZOrderMediaOverlay(true); | |
| 182 updateVideoView(); | |
| 182 | 183 |
| 183 // Check for mandatory permissions. | 184 // Check for mandatory permissions. |
| 184 for (String permission : MANDATORY_PERMISSIONS) { | 185 for (String permission : MANDATORY_PERMISSIONS) { |
| 185 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_ GRANTED) { | 186 if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_ GRANTED) { |
| 186 logAndToast("Permission " + permission + " is not granted"); | 187 logAndToast("Permission " + permission + " is not granted"); |
| 187 setResult(RESULT_CANCELED); | 188 setResult(RESULT_CANCELED); |
| 188 finish(); | 189 finish(); |
| 189 return; | 190 return; |
| 190 } | 191 } |
| 191 } | 192 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 hudFragment.setArguments(intent.getExtras()); | 236 hudFragment.setArguments(intent.getExtras()); |
| 236 // Activate call and HUD fragments and start the call. | 237 // Activate call and HUD fragments and start the call. |
| 237 FragmentTransaction ft = getFragmentManager().beginTransaction(); | 238 FragmentTransaction ft = getFragmentManager().beginTransaction(); |
| 238 ft.add(R.id.call_fragment_container, callFragment); | 239 ft.add(R.id.call_fragment_container, callFragment); |
| 239 ft.add(R.id.hud_fragment_container, hudFragment); | 240 ft.add(R.id.hud_fragment_container, hudFragment); |
| 240 ft.commit(); | 241 ft.commit(); |
| 241 startCall(); | 242 startCall(); |
| 242 | 243 |
| 243 // For command line execution run connection for <runTimeMs> and exit. | 244 // For command line execution run connection for <runTimeMs> and exit. |
| 244 if (commandLineRun && runTimeMs > 0) { | 245 if (commandLineRun && runTimeMs > 0) { |
| 245 videoView.postDelayed(new Runnable() { | 246 (new Handler()).postDelayed(new Runnable() { |
| 246 public void run() { | 247 public void run() { |
| 247 disconnect(); | 248 disconnect(); |
| 248 } | 249 } |
| 249 }, runTimeMs); | 250 }, runTimeMs); |
| 250 } | 251 } |
| 252 createPeerConnectionFactory(); | |
| 251 } | 253 } |
| 252 | 254 |
| 253 // Activity interfaces | 255 // Activity interfaces |
| 254 @Override | 256 @Override |
| 255 public void onPause() { | 257 public void onPause() { |
| 256 super.onPause(); | 258 super.onPause(); |
| 257 videoView.onPause(); | |
| 258 activityRunning = false; | 259 activityRunning = false; |
| 259 if (peerConnectionClient != null) { | 260 if (peerConnectionClient != null) { |
| 260 peerConnectionClient.stopVideoSource(); | 261 peerConnectionClient.stopVideoSource(); |
| 261 } | 262 } |
| 262 } | 263 } |
| 263 | 264 |
| 264 @Override | 265 @Override |
| 265 public void onResume() { | 266 public void onResume() { |
| 266 super.onResume(); | 267 super.onResume(); |
| 267 videoView.onResume(); | |
| 268 activityRunning = true; | 268 activityRunning = true; |
| 269 if (peerConnectionClient != null) { | 269 if (peerConnectionClient != null) { |
| 270 peerConnectionClient.startVideoSource(); | 270 peerConnectionClient.startVideoSource(); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 @Override | 274 @Override |
| 275 protected void onDestroy() { | 275 protected void onDestroy() { |
| 276 disconnect(); | 276 disconnect(); |
| 277 super.onDestroy(); | |
| 278 if (logToast != null) { | 277 if (logToast != null) { |
| 279 logToast.cancel(); | 278 logToast.cancel(); |
| 280 } | 279 } |
| 281 activityRunning = false; | 280 activityRunning = false; |
| 282 VideoRendererGui.dispose(); | 281 localRender.release(); |
|
perkj_webrtc
2015/09/21 15:03:53
renderer.release needs to be done before the facto
magjed_webrtc
2015/09/22 07:15:46
Done. I moved the renderer.release() inside discon
| |
| 282 localRender = null; | |
| 283 remoteRender.release(); | |
| 284 remoteRender = null; | |
| 285 rootEglBase.release(); | |
| 286 rootEglBase = null; | |
| 287 super.onDestroy(); | |
| 283 } | 288 } |
| 284 | 289 |
| 285 // CallFragment.OnCallEvents interface implementation. | 290 // CallFragment.OnCallEvents interface implementation. |
| 286 @Override | 291 @Override |
| 287 public void onCallHangUp() { | 292 public void onCallHangUp() { |
| 288 disconnect(); | 293 disconnect(); |
| 289 } | 294 } |
| 290 | 295 |
| 291 @Override | 296 @Override |
| 292 public void onCameraSwitch() { | 297 public void onCameraSwitch() { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 314 ft.show(hudFragment); | 319 ft.show(hudFragment); |
| 315 } else { | 320 } else { |
| 316 ft.hide(callFragment); | 321 ft.hide(callFragment); |
| 317 ft.hide(hudFragment); | 322 ft.hide(hudFragment); |
| 318 } | 323 } |
| 319 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); | 324 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); |
| 320 ft.commit(); | 325 ft.commit(); |
| 321 } | 326 } |
| 322 | 327 |
| 323 private void updateVideoView() { | 328 private void updateVideoView() { |
| 324 VideoRendererGui.update(remoteRender, | 329 remoteRenderLayout.setPosition(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIG HT); |
| 325 REMOTE_X, REMOTE_Y, | 330 remoteRender.setScalingType(scalingType); |
| 326 REMOTE_WIDTH, REMOTE_HEIGHT, scalingType, false); | 331 remoteRender.setMirror(false); |
| 332 | |
| 327 if (iceConnected) { | 333 if (iceConnected) { |
| 328 VideoRendererGui.update(localRender, | 334 localRenderLayout.setPosition( |
| 329 LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, | 335 LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEI GHT_CONNECTED); |
| 330 LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED, | 336 localRender.setScalingType(ScalingType.SCALE_ASPECT_FIT); |
| 331 ScalingType.SCALE_ASPECT_FIT, true); | |
| 332 } else { | 337 } else { |
| 333 VideoRendererGui.update(localRender, | 338 localRenderLayout.setPosition( |
| 334 LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, | 339 LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_ HEIGHT_CONNECTING); |
| 335 LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING, scalingType, true); | 340 localRender.setScalingType(scalingType); |
| 336 } | 341 } |
| 342 localRender.setMirror(true); | |
| 343 | |
| 344 localRender.requestLayout(); | |
| 345 remoteRender.requestLayout(); | |
| 337 } | 346 } |
| 338 | 347 |
| 339 private void startCall() { | 348 private void startCall() { |
| 340 if (appRtcClient == null) { | 349 if (appRtcClient == null) { |
| 341 Log.e(TAG, "AppRTC client is not allocated for a call."); | 350 Log.e(TAG, "AppRTC client is not allocated for a call."); |
| 342 return; | 351 return; |
| 343 } | 352 } |
| 344 callStartedTimeMs = System.currentTimeMillis(); | 353 callStartedTimeMs = System.currentTimeMillis(); |
| 345 | 354 |
| 346 // Start room connection. | 355 // Start room connection. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 // Enable statistics callback. | 387 // Enable statistics callback. |
| 379 peerConnectionClient.enableStatsEvents(true, STAT_CALLBACK_PERIOD); | 388 peerConnectionClient.enableStatsEvents(true, STAT_CALLBACK_PERIOD); |
| 380 } | 389 } |
| 381 | 390 |
| 382 private void onAudioManagerChangedState() { | 391 private void onAudioManagerChangedState() { |
| 383 // TODO(henrika): disable video if AppRTCAudioManager.AudioDevice.EARPIECE | 392 // TODO(henrika): disable video if AppRTCAudioManager.AudioDevice.EARPIECE |
| 384 // is active. | 393 // is active. |
| 385 } | 394 } |
| 386 | 395 |
| 387 // Create peer connection factory when EGL context is ready. | 396 // Create peer connection factory when EGL context is ready. |
| 388 private void createPeerConnectionFactory() { | 397 private void createPeerConnectionFactory() { |
|
perkj_webrtc
2015/09/22 12:24:43
This is ok by me to remove this. But I am not sure
| |
| 389 runOnUiThread(new Runnable() { | 398 runOnUiThread(new Runnable() { |
| 390 @Override | 399 @Override |
| 391 public void run() { | 400 public void run() { |
| 392 if (peerConnectionClient == null) { | 401 if (peerConnectionClient == null) { |
| 393 final long delta = System.currentTimeMillis() - callStartedTimeMs; | 402 final long delta = System.currentTimeMillis() - callStartedTimeMs; |
| 394 Log.d(TAG, "Creating peer connection factory, delay=" + delta + "ms"); | 403 Log.d(TAG, "Creating peer connection factory, delay=" + delta + "ms"); |
| 395 peerConnectionClient = PeerConnectionClient.getInstance(); | 404 peerConnectionClient = PeerConnectionClient.getInstance(); |
| 396 peerConnectionClient.createPeerConnectionFactory(CallActivity.this, | 405 peerConnectionClient.createPeerConnectionFactory(CallActivity.this, |
| 397 peerConnectionParameters, CallActivity.this); | 406 peerConnectionParameters, CallActivity.this); |
| 398 } | 407 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 } | 478 } |
| 470 | 479 |
| 471 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- | 480 // -----Implementation of AppRTCClient.AppRTCSignalingEvents --------------- |
| 472 // All callbacks are invoked from websocket signaling looper thread and | 481 // All callbacks are invoked from websocket signaling looper thread and |
| 473 // are routed to UI thread. | 482 // are routed to UI thread. |
| 474 private void onConnectedToRoomInternal(final SignalingParameters params) { | 483 private void onConnectedToRoomInternal(final SignalingParameters params) { |
| 475 final long delta = System.currentTimeMillis() - callStartedTimeMs; | 484 final long delta = System.currentTimeMillis() - callStartedTimeMs; |
| 476 | 485 |
| 477 signalingParameters = params; | 486 signalingParameters = params; |
| 478 if (peerConnectionClient == null) { | 487 if (peerConnectionClient == null) { |
| 479 Log.w(TAG, "Room is connected, but EGL context is not ready yet."); | 488 Log.w(TAG, "Room is connected, but EGL context is not ready yet."); |
|
perkj_webrtc
2015/09/21 15:03:53
Is this still true?
magjed_webrtc
2015/09/22 07:15:46
No. I inlined createPeerConnectionFactory() and re
| |
| 480 return; | 489 return; |
| 481 } | 490 } |
| 482 logAndToast("Creating peer connection, delay=" + delta + "ms"); | 491 logAndToast("Creating peer connection, delay=" + delta + "ms"); |
| 483 peerConnectionClient.createPeerConnection(VideoRendererGui.getEGLContext(), | 492 peerConnectionClient.createPeerConnection(rootEglBase.getContext(), |
| 484 localRender, remoteRender, signalingParameters); | 493 localRender, remoteRender, signalingParameters); |
| 485 | 494 |
| 486 if (signalingParameters.initiator) { | 495 if (signalingParameters.initiator) { |
| 487 logAndToast("Creating OFFER..."); | 496 logAndToast("Creating OFFER..."); |
| 488 // Create offer. Offer SDP will be sent to answering client in | 497 // Create offer. Offer SDP will be sent to answering client in |
| 489 // PeerConnectionEvents.onLocalDescription event. | 498 // PeerConnectionEvents.onLocalDescription event. |
| 490 peerConnectionClient.createOffer(); | 499 peerConnectionClient.createOffer(); |
| 491 } else { | 500 } else { |
| 492 if (params.offerSdp != null) { | 501 if (params.offerSdp != null) { |
| 493 peerConnectionClient.setRemoteDescription(params.offerSdp); | 502 peerConnectionClient.setRemoteDescription(params.offerSdp); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 } | 650 } |
| 642 } | 651 } |
| 643 }); | 652 }); |
| 644 } | 653 } |
| 645 | 654 |
| 646 @Override | 655 @Override |
| 647 public void onPeerConnectionError(final String description) { | 656 public void onPeerConnectionError(final String description) { |
| 648 reportError(description); | 657 reportError(description); |
| 649 } | 658 } |
| 650 } | 659 } |
| OLD | NEW |