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 18 matching lines...) Expand all Loading... |
29 import android.view.WindowManager; | 29 import android.view.WindowManager; |
30 import android.view.WindowManager.LayoutParams; | 30 import android.view.WindowManager.LayoutParams; |
31 import android.widget.Toast; | 31 import android.widget.Toast; |
32 import java.io.IOException; | 32 import java.io.IOException; |
33 import java.lang.RuntimeException; | 33 import java.lang.RuntimeException; |
34 import java.util.ArrayList; | 34 import java.util.ArrayList; |
35 import java.util.List; | 35 import java.util.List; |
36 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; | 36 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; |
37 import org.appspot.apprtc.AppRTCClient.SignalingParameters; | 37 import org.appspot.apprtc.AppRTCClient.SignalingParameters; |
38 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; | 38 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; |
| 39 import org.appspot.apprtc.PeerConnectionClient.DataChannelParameters; |
39 import org.webrtc.Camera1Enumerator; | 40 import org.webrtc.Camera1Enumerator; |
40 import org.webrtc.Camera2Enumerator; | 41 import org.webrtc.Camera2Enumerator; |
41 import org.webrtc.CameraEnumerator; | 42 import org.webrtc.CameraEnumerator; |
42 import org.webrtc.EglBase; | 43 import org.webrtc.EglBase; |
43 import org.webrtc.FileVideoCapturer; | 44 import org.webrtc.FileVideoCapturer; |
44 import org.webrtc.IceCandidate; | 45 import org.webrtc.IceCandidate; |
45 import org.webrtc.Logging; | 46 import org.webrtc.Logging; |
46 import org.webrtc.PeerConnectionFactory; | 47 import org.webrtc.PeerConnectionFactory; |
47 import org.webrtc.RendererCommon.ScalingType; | 48 import org.webrtc.RendererCommon.ScalingType; |
48 import org.webrtc.ScreenCapturerAndroid; | 49 import org.webrtc.ScreenCapturerAndroid; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 public static final String EXTRA_RUNTIME = "org.appspot.apprtc.RUNTIME"; | 91 public static final String EXTRA_RUNTIME = "org.appspot.apprtc.RUNTIME"; |
91 public static final String EXTRA_VIDEO_FILE_AS_CAMERA = "org.appspot.apprtc.VI
DEO_FILE_AS_CAMERA"; | 92 public static final String EXTRA_VIDEO_FILE_AS_CAMERA = "org.appspot.apprtc.VI
DEO_FILE_AS_CAMERA"; |
92 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE = | 93 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE = |
93 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; | 94 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; |
94 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = | 95 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = |
95 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; | 96 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; |
96 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = | 97 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = |
97 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; | 98 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; |
98 public static final String EXTRA_USE_VALUES_FROM_INTENT = | 99 public static final String EXTRA_USE_VALUES_FROM_INTENT = |
99 "org.appspot.apprtc.USE_VALUES_FROM_INTENT"; | 100 "org.appspot.apprtc.USE_VALUES_FROM_INTENT"; |
| 101 public static final String EXTRA_DATA_CHANNEL_ENABLED = "org.appspot.apprtc.DA
TA_CHANNEL_ENABLED"; |
| 102 public static final String EXTRA_ORDERED = "org.appspot.apprtc.ORDERED"; |
| 103 public static final String EXTRA_MAX_RETRANSMITS_MS = "org.appspot.apprtc.MAX_
RETRANSMITS_MS"; |
| 104 public static final String EXTRA_MAX_RETRANSMITS = "org.appspot.apprtc.MAX_RET
RANSMITS"; |
| 105 public static final String EXTRA_PROTOCOL = "org.appspot.apprtc.PROTOCOL"; |
| 106 public static final String EXTRA_NEGOTIATED = "org.appspot.apprtc.NEGOTIATED"; |
| 107 public static final String EXTRA_ID = "org.appspot.apprtc.ID"; |
| 108 |
100 private static final String TAG = "CallRTCClient"; | 109 private static final String TAG = "CallRTCClient"; |
101 private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1; | 110 private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1; |
102 | 111 |
103 // List of mandatory application permissions. | 112 // List of mandatory application permissions. |
104 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD
IFY_AUDIO_SETTINGS", | 113 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD
IFY_AUDIO_SETTINGS", |
105 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"}; | 114 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"}; |
106 | 115 |
107 // Peer connection statistics callback period in ms. | 116 // Peer connection statistics callback period in ms. |
108 private static final int STAT_CALLBACK_PERIOD = 1000; | 117 private static final int STAT_CALLBACK_PERIOD = 1000; |
109 // Local preview screen position before call is connected. | 118 // Local preview screen position before call is connected. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 screencaptureEnabled = intent.getBooleanExtra(EXTRA_SCREENCAPTURE, false); | 266 screencaptureEnabled = intent.getBooleanExtra(EXTRA_SCREENCAPTURE, false); |
258 // If capturing format is not specified for screencapture, use screen resolu
tion. | 267 // If capturing format is not specified for screencapture, use screen resolu
tion. |
259 if (screencaptureEnabled && videoWidth == 0 && videoHeight == 0) { | 268 if (screencaptureEnabled && videoWidth == 0 && videoHeight == 0) { |
260 DisplayMetrics displayMetrics = new DisplayMetrics(); | 269 DisplayMetrics displayMetrics = new DisplayMetrics(); |
261 WindowManager windowManager = | 270 WindowManager windowManager = |
262 (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVI
CE); | 271 (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVI
CE); |
263 windowManager.getDefaultDisplay().getRealMetrics(displayMetrics); | 272 windowManager.getDefaultDisplay().getRealMetrics(displayMetrics); |
264 videoWidth = displayMetrics.widthPixels; | 273 videoWidth = displayMetrics.widthPixels; |
265 videoHeight = displayMetrics.heightPixels; | 274 videoHeight = displayMetrics.heightPixels; |
266 } | 275 } |
267 | 276 DataChannelParameters dataChannelParameters = null; |
| 277 if (intent.getBooleanExtra(EXTRA_DATA_CHANNEL_ENABLED, true)) { |
| 278 dataChannelParameters = new DataChannelParameters(intent.getBooleanExtra(E
XTRA_ORDERED, true), |
| 279 intent.getIntExtra(EXTRA_MAX_RETRANSMITS_MS, -1), |
| 280 intent.getIntExtra(EXTRA_MAX_RETRANSMITS, -1), intent.getStringExtra(E
XTRA_PROTOCOL), |
| 281 intent.getBooleanExtra(EXTRA_NEGOTIATED, false), intent.getIntExtra(EX
TRA_ID, -1)); |
| 282 } |
268 peerConnectionParameters = | 283 peerConnectionParameters = |
269 new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, tr
ue), loopback, | 284 new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, tr
ue), loopback, |
270 tracing, videoWidth, videoHeight, intent.getIntExtra(EXTRA_VIDEO_FPS
, 0), | 285 tracing, videoWidth, videoHeight, intent.getIntExtra(EXTRA_VIDEO_FPS
, 0), |
271 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EX
TRA_VIDEOCODEC), | 286 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EX
TRA_VIDEOCODEC), |
272 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), | 287 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), |
273 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EX
TRA_AUDIOCODEC), | 288 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EX
TRA_AUDIOCODEC), |
274 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), | 289 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), |
275 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), | 290 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), |
276 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), | 291 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), |
277 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), | 292 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), |
278 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), | 293 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), |
279 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), | 294 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), |
280 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false)); | 295 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false), dataChann
elParameters); |
281 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); | 296 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); |
282 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); | 297 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); |
283 | 298 |
284 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER
A) + "'"); | 299 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER
A) + "'"); |
285 | 300 |
286 // 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 |
287 // standard WebSocketRTCClient. | 302 // standard WebSocketRTCClient. |
288 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { | 303 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { |
289 appRtcClient = new WebSocketRTCClient(this); | 304 appRtcClient = new WebSocketRTCClient(this); |
290 } else { | 305 } else { |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 } | 877 } |
863 } | 878 } |
864 }); | 879 }); |
865 } | 880 } |
866 | 881 |
867 @Override | 882 @Override |
868 public void onPeerConnectionError(final String description) { | 883 public void onPeerConnectionError(final String description) { |
869 reportError(description); | 884 reportError(description); |
870 } | 885 } |
871 } | 886 } |
OLD | NEW |