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

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

Issue 2464243002: Add Datachannel support to Android AppRTCMobile (Closed)
Patch Set: data channel patch set 4 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;
16 17
17 import android.app.Activity; 18 import android.app.Activity;
18 import android.app.AlertDialog; 19 import android.app.AlertDialog;
19 import android.app.FragmentTransaction; 20 import android.app.FragmentTransaction;
20 import android.content.DialogInterface; 21 import android.content.DialogInterface;
21 import android.content.Intent; 22 import android.content.Intent;
22 import android.content.pm.PackageManager; 23 import android.content.pm.PackageManager;
23 import android.net.Uri; 24 import android.net.Uri;
24 import android.os.Bundle; 25 import android.os.Bundle;
25 import android.os.Handler; 26 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"; 87 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"; 88 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 = 89 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE =
89 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; 90 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE";
90 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = 91 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH =
91 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; 92 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH";
92 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = 93 public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT =
93 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; 94 "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT";
94 public static final String EXTRA_USE_VALUES_FROM_INTENT = 95 public static final String EXTRA_USE_VALUES_FROM_INTENT =
95 "org.appspot.apprtc.USE_VALUES_FROM_INTENT"; 96 "org.appspot.apprtc.USE_VALUES_FROM_INTENT";
97 public static final String EXTRA_DATA_CHANNEL_ENABLED = "org.appspot.apprtc.DA TA_CHANNEL_ENABLED";
98 public static final String EXTRA_ORDERED = "org.appspot.apprtc.ORDERED";
99 public static final String EXTRA_MAX_RETRANSMITS_MS = "org.appspot.apprtc.MAX_ RETRANSMITS_MS";
100 public static final String EXTRA_MAX_RETRANSMITS = "org.appspot.apprtc.MAX_RET RANSMITS";
101 public static final String EXTRA_PROTOCOL = "org.appspot.apprtc.PROTOCOL";
102 public static final String EXTRA_NEGOTIATED = "org.appspot.apprtc.NEGOTIATED";
103 public static final String EXTRA_ID = "org.appspot.apprtc.ID";
104
96 private static final String TAG = "CallRTCClient"; 105 private static final String TAG = "CallRTCClient";
97 106
98 // List of mandatory application permissions. 107 // List of mandatory application permissions.
99 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD IFY_AUDIO_SETTINGS", 108 private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MOD IFY_AUDIO_SETTINGS",
100 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"}; 109 "android.permission.RECORD_AUDIO", "android.permission.INTERNET"};
101 110
102 // Peer connection statistics callback period in ms. 111 // Peer connection statistics callback period in ms.
103 private static final int STAT_CALLBACK_PERIOD = 1000; 112 private static final int STAT_CALLBACK_PERIOD = 1000;
104 // Local preview screen position before call is connected. 113 // Local preview screen position before call is connected.
105 private static final int LOCAL_X_CONNECTING = 0; 114 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) { 244 if (roomId == null || roomId.length() == 0) {
236 logAndToast(getString(R.string.missing_url)); 245 logAndToast(getString(R.string.missing_url));
237 Log.e(TAG, "Incorrect room ID in intent!"); 246 Log.e(TAG, "Incorrect room ID in intent!");
238 setResult(RESULT_CANCELED); 247 setResult(RESULT_CANCELED);
239 finish(); 248 finish();
240 return; 249 return;
241 } 250 }
242 251
243 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); 252 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
244 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); 253 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
245 254 DataChannelParameters dataChannelParameters = null;
255 if (intent.getBooleanExtra(EXTRA_DATA_CHANNEL_ENABLED, true)) {
256 dataChannelParameters = new DataChannelParameters(intent.getBooleanExtra(E XTRA_ORDERED, true),
257 intent.getIntExtra(EXTRA_MAX_RETRANSMITS_MS, -1),
258 intent.getIntExtra(EXTRA_MAX_RETRANSMITS, -1), intent.getStringExtra(E XTRA_PROTOCOL),
259 intent.getBooleanExtra(EXTRA_NEGOTIATED, false), intent.getIntExtra(EX TRA_ID, -1));
260 }
246 peerConnectionParameters = 261 peerConnectionParameters =
247 new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, tr ue), loopback, 262 new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, tr ue), loopback,
248 tracing, intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0), 263 tracing, intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0),
249 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), intent.getIntExtra(EXTRA_ VIDEO_FPS, 0), 264 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), intent.getIntExtra(EXTRA_ VIDEO_FPS, 0),
250 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EX TRA_VIDEOCODEC), 265 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EX TRA_VIDEOCODEC),
251 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), 266 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
252 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EX TRA_AUDIOCODEC), 267 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EX TRA_AUDIOCODEC),
253 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), 268 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false),
254 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), 269 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false),
255 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false), 270 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false),
256 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), 271 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false),
257 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), 272 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false),
258 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), 273 intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false),
259 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false)); 274 intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false), dataChann elParameters);
260 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); 275 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
261 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); 276 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
262 277
263 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER A) + "'"); 278 Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMER A) + "'");
264 279
265 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the 280 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the
266 // standard WebSocketRTCClient. 281 // standard WebSocketRTCClient.
267 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { 282 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) {
268 appRtcClient = new WebSocketRTCClient(this); 283 appRtcClient = new WebSocketRTCClient(this);
269 } else { 284 } else {
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 } 823 }
809 } 824 }
810 }); 825 });
811 } 826 }
812 827
813 @Override 828 @Override
814 public void onPeerConnectionError(final String description) { 829 public void onPeerConnectionError(final String description) {
815 reportError(description); 830 reportError(description);
816 } 831 }
817 } 832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698