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

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

Issue 2488643002: Add screenshare support to AppRTCMobile. (Closed)
Patch Set: Use correct capturing format. 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 2014 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2014 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 15 matching lines...) Expand all
26 import android.view.View; 26 import android.view.View;
27 import android.view.View.OnClickListener; 27 import android.view.View.OnClickListener;
28 import android.view.inputmethod.EditorInfo; 28 import android.view.inputmethod.EditorInfo;
29 import android.webkit.URLUtil; 29 import android.webkit.URLUtil;
30 import android.widget.AdapterView; 30 import android.widget.AdapterView;
31 import android.widget.ArrayAdapter; 31 import android.widget.ArrayAdapter;
32 import android.widget.EditText; 32 import android.widget.EditText;
33 import android.widget.ImageButton; 33 import android.widget.ImageButton;
34 import android.widget.ListView; 34 import android.widget.ListView;
35 import android.widget.TextView; 35 import android.widget.TextView;
36 36 import java.util.ArrayList;
37 import java.util.Random;
37 import org.json.JSONArray; 38 import org.json.JSONArray;
38 import org.json.JSONException; 39 import org.json.JSONException;
39 40
40 import java.util.ArrayList;
41 import java.util.Random;
42
43 /** 41 /**
44 * Handles the initial setup where the user selects which room to join. 42 * Handles the initial setup where the user selects which room to join.
45 */ 43 */
46 public class ConnectActivity extends Activity { 44 public class ConnectActivity extends Activity {
47 private static final String TAG = "ConnectActivity"; 45 private static final String TAG = "ConnectActivity";
48 private static final int CONNECTION_REQUEST = 1; 46 private static final int CONNECTION_REQUEST = 1;
49 private static final int REMOVE_FAVORITE_INDEX = 0; 47 private static final int REMOVE_FAVORITE_INDEX = 0;
50 private static boolean commandLineRun = false; 48 private static boolean commandLineRun = false;
51 49
52 private ImageButton connectButton; 50 private ImageButton connectButton;
53 private ImageButton addFavoriteButton; 51 private ImageButton addFavoriteButton;
54 private EditText roomEditText; 52 private EditText roomEditText;
55 private ListView roomListView; 53 private ListView roomListView;
56 private SharedPreferences sharedPref; 54 private SharedPreferences sharedPref;
57 private String keyprefVideoCallEnabled; 55 private String keyprefVideoCallEnabled;
56 private String keyprefScreencapture;
58 private String keyprefCamera2; 57 private String keyprefCamera2;
59 private String keyprefResolution; 58 private String keyprefResolution;
60 private String keyprefFps; 59 private String keyprefFps;
61 private String keyprefCaptureQualitySlider; 60 private String keyprefCaptureQualitySlider;
62 private String keyprefVideoBitrateType; 61 private String keyprefVideoBitrateType;
63 private String keyprefVideoBitrateValue; 62 private String keyprefVideoBitrateValue;
64 private String keyprefVideoCodec; 63 private String keyprefVideoCodec;
65 private String keyprefAudioBitrateType; 64 private String keyprefAudioBitrateType;
66 private String keyprefAudioBitrateValue; 65 private String keyprefAudioBitrateValue;
67 private String keyprefAudioCodec; 66 private String keyprefAudioCodec;
(...skipping 15 matching lines...) Expand all
83 private ArrayAdapter<String> adapter; 82 private ArrayAdapter<String> adapter;
84 83
85 @Override 84 @Override
86 public void onCreate(Bundle savedInstanceState) { 85 public void onCreate(Bundle savedInstanceState) {
87 super.onCreate(savedInstanceState); 86 super.onCreate(savedInstanceState);
88 87
89 // Get setting keys. 88 // Get setting keys.
90 PreferenceManager.setDefaultValues(this, R.xml.preferences, false); 89 PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
91 sharedPref = PreferenceManager.getDefaultSharedPreferences(this); 90 sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
92 keyprefVideoCallEnabled = getString(R.string.pref_videocall_key); 91 keyprefVideoCallEnabled = getString(R.string.pref_videocall_key);
92 keyprefScreencapture = getString(R.string.pref_screencapture_key);
93 keyprefCamera2 = getString(R.string.pref_camera2_key); 93 keyprefCamera2 = getString(R.string.pref_camera2_key);
94 keyprefResolution = getString(R.string.pref_resolution_key); 94 keyprefResolution = getString(R.string.pref_resolution_key);
95 keyprefFps = getString(R.string.pref_fps_key); 95 keyprefFps = getString(R.string.pref_fps_key);
96 keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_k ey); 96 keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_k ey);
97 keyprefVideoBitrateType = getString(R.string.pref_maxvideobitrate_key); 97 keyprefVideoBitrateType = getString(R.string.pref_maxvideobitrate_key);
98 keyprefVideoBitrateValue = getString(R.string.pref_maxvideobitratevalue_key) ; 98 keyprefVideoBitrateValue = getString(R.string.pref_maxvideobitratevalue_key) ;
99 keyprefVideoCodec = getString(R.string.pref_videocodec_key); 99 keyprefVideoCodec = getString(R.string.pref_videocodec_key);
100 keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key); 100 keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key);
101 keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key); 101 keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key);
102 keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key); 102 keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 roomId = Integer.toString((new Random()).nextInt(100000000)); 288 roomId = Integer.toString((new Random()).nextInt(100000000));
289 } 289 }
290 290
291 String roomUrl = sharedPref.getString( 291 String roomUrl = sharedPref.getString(
292 keyprefRoomServerUrl, getString(R.string.pref_room_server_url_default)); 292 keyprefRoomServerUrl, getString(R.string.pref_room_server_url_default));
293 293
294 // Video call enabled flag. 294 // Video call enabled flag.
295 boolean videoCallEnabled = sharedPrefGetBoolean(R.string.pref_videocall_key, 295 boolean videoCallEnabled = sharedPrefGetBoolean(R.string.pref_videocall_key,
296 CallActivity.EXTRA_VIDEO_CALL, R.string.pref_videocall_default, useValue sFromIntent); 296 CallActivity.EXTRA_VIDEO_CALL, R.string.pref_videocall_default, useValue sFromIntent);
297 297
298 // Use screencapture option.
299 boolean useScreencapture = sharedPrefGetBoolean(R.string.pref_screencapture_ key,
300 CallActivity.EXTRA_SCREENCAPTURE, R.string.pref_screencapture_default, u seValuesFromIntent);
301
298 // Use Camera2 option. 302 // Use Camera2 option.
299 boolean useCamera2 = sharedPrefGetBoolean(R.string.pref_camera2_key, CallAct ivity.EXTRA_CAMERA2, 303 boolean useCamera2 = sharedPrefGetBoolean(R.string.pref_camera2_key, CallAct ivity.EXTRA_CAMERA2,
300 R.string.pref_camera2_default, useValuesFromIntent); 304 R.string.pref_camera2_default, useValuesFromIntent);
301 305
302 // Get default codecs. 306 // Get default codecs.
303 String videoCodec = sharedPrefGetString(R.string.pref_videocodec_key, 307 String videoCodec = sharedPrefGetString(R.string.pref_videocodec_key,
304 CallActivity.EXTRA_VIDEOCODEC, R.string.pref_videocodec_default, useValu esFromIntent); 308 CallActivity.EXTRA_VIDEOCODEC, R.string.pref_videocodec_default, useValu esFromIntent);
305 String audioCodec = sharedPrefGetString(R.string.pref_audiocodec_key, 309 String audioCodec = sharedPrefGetString(R.string.pref_audiocodec_key,
306 CallActivity.EXTRA_AUDIOCODEC, R.string.pref_audiocodec_default, useValu esFromIntent); 310 CallActivity.EXTRA_AUDIOCODEC, R.string.pref_audiocodec_default, useValu esFromIntent);
307 311
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 435
432 // Start AppRTCMobile activity. 436 // Start AppRTCMobile activity.
433 Log.d(TAG, "Connecting to room " + roomId + " at URL " + roomUrl); 437 Log.d(TAG, "Connecting to room " + roomId + " at URL " + roomUrl);
434 if (validateUrl(roomUrl)) { 438 if (validateUrl(roomUrl)) {
435 Uri uri = Uri.parse(roomUrl); 439 Uri uri = Uri.parse(roomUrl);
436 Intent intent = new Intent(this, CallActivity.class); 440 Intent intent = new Intent(this, CallActivity.class);
437 intent.setData(uri); 441 intent.setData(uri);
438 intent.putExtra(CallActivity.EXTRA_ROOMID, roomId); 442 intent.putExtra(CallActivity.EXTRA_ROOMID, roomId);
439 intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback); 443 intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback);
440 intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled); 444 intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled);
445 intent.putExtra(CallActivity.EXTRA_SCREENCAPTURE, useScreencapture);
441 intent.putExtra(CallActivity.EXTRA_CAMERA2, useCamera2); 446 intent.putExtra(CallActivity.EXTRA_CAMERA2, useCamera2);
442 intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth); 447 intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth);
443 intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight); 448 intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight);
444 intent.putExtra(CallActivity.EXTRA_VIDEO_FPS, cameraFps); 449 intent.putExtra(CallActivity.EXTRA_VIDEO_FPS, cameraFps);
445 intent.putExtra(CallActivity.EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED, cap tureQualitySlider); 450 intent.putExtra(CallActivity.EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED, cap tureQualitySlider);
446 intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate); 451 intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate);
447 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec); 452 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec);
448 intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec); 453 intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec);
449 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, captureToText ure); 454 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, captureToText ure);
450 intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED, noAudioProce ssing); 455 intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED, noAudioProce ssing);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 536 }
532 }; 537 };
533 538
534 private final OnClickListener connectListener = new OnClickListener() { 539 private final OnClickListener connectListener = new OnClickListener() {
535 @Override 540 @Override
536 public void onClick(View view) { 541 public void onClick(View view) {
537 connectToRoom(roomEditText.getText().toString(), false, false, false, 0); 542 connectToRoom(roomEditText.getText().toString(), false, false, false, 0);
538 } 543 }
539 }; 544 };
540 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698