Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java

Issue 2464243002: Add Datachannel support to Android AppRTCMobile (Closed)
Patch Set: modify authors Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.PeerConnectionClient.DataChannelParameters;
17 import org.appspot.apprtc.util.LooperExecutor;
sakal 2016/11/09 11:45:03 Why did you add this?
hekra01 2016/11/10 02:32:20 DatChannelParams for what is set in settings Loope
16 18
17 import android.app.Activity; 19 import android.app.Activity;
18 import android.app.AlertDialog; 20 import android.app.AlertDialog;
19 import android.app.FragmentTransaction; 21 import android.app.FragmentTransaction;
20 import android.content.DialogInterface; 22 import android.content.DialogInterface;
21 import android.content.Intent; 23 import android.content.Intent;
22 import android.content.pm.PackageManager; 24 import android.content.pm.PackageManager;
23 import android.net.Uri; 25 import android.net.Uri;
24 import android.os.Bundle; 26 import android.os.Bundle;
25 import android.os.Handler; 27 import android.os.Handler;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 public static final String EXTRA_RUNTIME = "org.appspot.apprtc.RUNTIME"; 88 public static final String EXTRA_RUNTIME = "org.appspot.apprtc.RUNTIME";
87 public static final String EXTRA_VIDEO_FILE_AS_CAMERA = "org.appspot.apprtc.VI DEO_FILE_AS_CAMERA"; 89 public static final String EXTRA_VIDEO_FILE_AS_CAMERA = "org.appspot.apprtc.VI DEO_FILE_AS_CAMERA";
88 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE = 90 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE =
89 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; 91 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE";
90 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = 92 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH =
91 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; 93 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH";
92 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = 94 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT =
93 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; 95 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT";
94 public static final String EXTRA_USE_VALUES_FROM_INTENT = 96 public static final String EXTRA_USE_VALUES_FROM_INTENT =
95 "org.appspot.apprtc.USE_VALUES_FROM_INTENT"; 97 "org.appspot.apprtc.USE_VALUES_FROM_INTENT";
98 public static final String EXTRA_DATA_CHANNEL_ENABLED =
99 "org.appspot.apprtc.DATA_CHANNEL_ENABLED";
100 public static final String EXTRA_ORDERED =
101 "org.appspot.apprtc.ORDERED";
102 public static final String EXTRA_MAX_RETRANSMITS_MS =
103 "org.appspot.apprtc.MAX_RETRANSMITS_MS";
104 public static final String EXTRA_MAX_RETRANSMITS =
105 "org.appspot.apprtc.MAX_RETRANSMITS";
106 public static final String EXTRA_PROTOCOL =
107 "org.appspot.apprtc.PROTOCOL";
108 public static final String EXTRA_NEGOTIATED =
109 "org.appspot.apprtc.NEGOTIATED";
110 public static final String EXTRA_ID =
111 "org.appspot.apprtc.ID";
112
96 private static final String TAG = "CallRTCClient"; 113 private static final String TAG = "CallRTCClient";
97 114
98 // List of mandatory application permissions. 115 // List of mandatory application permissions.
99 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD IFY_AUDIO_SETTINGS", 116 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD IFY_AUDIO_SETTINGS",
100 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"}; 117 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"};
101 118
102 // Peer connection statistics callback period in ms. 119 // Peer connection statistics callback period in ms.
103 private static final int STAT_CALLBACK_PERIOD = 1000; 120 private static final int STAT_CALLBACK_PERIOD = 1000;
104 // Local preview screen position before call is connected. 121 // Local preview screen position before call is connected.
105 private static final int LOCAL_X_CONNECTING = 0; 122 private static final int LOCAL_X_CONNECTING = 0;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (roomId == null || roomId.length() == 0) { 252 if (roomId == null || roomId.length() == 0) {
236 logAndToast(getString(R.string.missing_url)); 253 logAndToast(getString(R.string.missing_url));
237 Log.e(TAG, "Incorrect room ID in intent!"); 254 Log.e(TAG, "Incorrect room ID in intent!");
238 setResult(RESULT_CANCELED); 255 setResult(RESULT_CANCELED);
239 finish(); 256 finish();
240 return; 257 return;
241 } 258 }
242 259
243 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); 260 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
244 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); 261 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
245 262 DataChannelParameters dataChannelParameters = null;
263 if (intent.getBooleanExtra(EXTRA_DATA_CHANNEL_ENABLED, true)) {
264 dataChannelParameters = new DataChannelParameters(
265 intent.getBooleanExtra(EXTRA_ORDERED, true),
266 intent.getIntExtra(EXTRA_MAX_RETRANSMITS_MS, -1),
267 intent.getIntExtra(EXTRA_MAX_RETRANSMITS, -1),
268 intent.getStringExtra(EXTRA_PROTOCOL),
269 intent.getBooleanExtra(EXTRA_NEGOTIATED, false),
270 intent.getIntExtra(EXTRA_ID, -1));
271 }
246 peerConnectionParameters = 272 peerConnectionParameters =
247 new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, tr ue), loopback, 273 new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, tr ue), loopback,
248 tracing, intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0), 274 tracing, intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0),
249 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), intent.getIntExtra(EXTRA_ VIDEO_FPS, 0), 275 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), intent.getIntExtra(EXTRA_ VIDEO_FPS, 0),
250 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EX TRA_VIDEOCODEC), 276 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EX TRA_VIDEOCODEC),
251 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), 277 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
252 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EX TRA_AUDIOCODEC), 278 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EX TRA_AUDIOCODEC),
253 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), 279 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false),
254 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), 280 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false),
255 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), 281 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false),
256 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), 282 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false),
257 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), 283 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false),
258 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), 284 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false),
259 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false)); 285 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false), dataChann elParameters);
260 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); 286 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
261 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); 287 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
262 288
263 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER A) + "'"); 289 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER A) + "'");
264 290
265 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the 291 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the
266 // standard WebSocketRTCClient. 292 // standard WebSocketRTCClient.
267 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { 293 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) {
268 appRtcClient = new WebSocketRTCClient(this); 294 appRtcClient = new WebSocketRTCClient(this);
269 } else { 295 } else {
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 } 834 }
809 } 835 }
810 }); 836 });
811 } 837 }
812 838
813 @Override 839 @Override
814 public void onPeerConnectionError(final String description) { 840 public void onPeerConnectionError(final String description) {
815 reportError(description); 841 reportError(description);
816 } 842 }
817 } 843 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698