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