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

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

Issue 1361083002: Android AppRTCDemo: Add slider for changing camera capture quality during call (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Move programmatic layout changes into fragment_call.xml instead Created 5 years, 2 months 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 private ImageButton addRoomButton; 50 private ImageButton addRoomButton;
51 private ImageButton removeRoomButton; 51 private ImageButton removeRoomButton;
52 private ImageButton connectButton; 52 private ImageButton connectButton;
53 private ImageButton connectLoopbackButton; 53 private ImageButton connectLoopbackButton;
54 private EditText roomEditText; 54 private EditText roomEditText;
55 private ListView roomListView; 55 private ListView roomListView;
56 private SharedPreferences sharedPref; 56 private SharedPreferences sharedPref;
57 private String keyprefVideoCallEnabled; 57 private String keyprefVideoCallEnabled;
58 private String keyprefResolution; 58 private String keyprefResolution;
59 private String keyprefFps; 59 private String keyprefFps;
60 private String keyprefCaptureQualitySlider;
60 private String keyprefVideoBitrateType; 61 private String keyprefVideoBitrateType;
61 private String keyprefVideoBitrateValue; 62 private String keyprefVideoBitrateValue;
62 private String keyprefVideoCodec; 63 private String keyprefVideoCodec;
63 private String keyprefAudioBitrateType; 64 private String keyprefAudioBitrateType;
64 private String keyprefAudioBitrateValue; 65 private String keyprefAudioBitrateValue;
65 private String keyprefAudioCodec; 66 private String keyprefAudioCodec;
66 private String keyprefHwCodecAcceleration; 67 private String keyprefHwCodecAcceleration;
67 private String keyprefNoAudioProcessingPipeline; 68 private String keyprefNoAudioProcessingPipeline;
68 private String keyprefCpuUsageDetection; 69 private String keyprefCpuUsageDetection;
69 private String keyprefDisplayHud; 70 private String keyprefDisplayHud;
70 private String keyprefRoomServerUrl; 71 private String keyprefRoomServerUrl;
71 private String keyprefRoom; 72 private String keyprefRoom;
72 private String keyprefRoomList; 73 private String keyprefRoomList;
73 private ArrayList<String> roomList; 74 private ArrayList<String> roomList;
74 private ArrayAdapter<String> adapter; 75 private ArrayAdapter<String> adapter;
75 76
76 @Override 77 @Override
77 public void onCreate(Bundle savedInstanceState) { 78 public void onCreate(Bundle savedInstanceState) {
78 super.onCreate(savedInstanceState); 79 super.onCreate(savedInstanceState);
79 80
80 // Get setting keys. 81 // Get setting keys.
81 PreferenceManager.setDefaultValues(this, R.xml.preferences, false); 82 PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
82 sharedPref = PreferenceManager.getDefaultSharedPreferences(this); 83 sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
83 keyprefVideoCallEnabled = getString(R.string.pref_videocall_key); 84 keyprefVideoCallEnabled = getString(R.string.pref_videocall_key);
84 keyprefResolution = getString(R.string.pref_resolution_key); 85 keyprefResolution = getString(R.string.pref_resolution_key);
85 keyprefFps = getString(R.string.pref_fps_key); 86 keyprefFps = getString(R.string.pref_fps_key);
87 keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_k ey);
86 keyprefVideoBitrateType = getString(R.string.pref_startvideobitrate_key); 88 keyprefVideoBitrateType = getString(R.string.pref_startvideobitrate_key);
87 keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_ke y); 89 keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_ke y);
88 keyprefVideoCodec = getString(R.string.pref_videocodec_key); 90 keyprefVideoCodec = getString(R.string.pref_videocodec_key);
89 keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key); 91 keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key);
90 keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key); 92 keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key);
91 keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_ke y); 93 keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_ke y);
92 keyprefAudioCodec = getString(R.string.pref_audiocodec_key); 94 keyprefAudioCodec = getString(R.string.pref_audiocodec_key);
93 keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing _key); 95 keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing _key);
94 keyprefCpuUsageDetection = getString(R.string.pref_cpu_usage_detection_key); 96 keyprefCpuUsageDetection = getString(R.string.pref_cpu_usage_detection_key);
95 keyprefDisplayHud = getString(R.string.pref_displayhud_key); 97 keyprefDisplayHud = getString(R.string.pref_displayhud_key);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 getString(R.string.pref_fps_default)); 281 getString(R.string.pref_fps_default));
280 String[] fpsValues = fps.split("[ x]+"); 282 String[] fpsValues = fps.split("[ x]+");
281 if (fpsValues.length == 2) { 283 if (fpsValues.length == 2) {
282 try { 284 try {
283 cameraFps = Integer.parseInt(fpsValues[0]); 285 cameraFps = Integer.parseInt(fpsValues[0]);
284 } catch (NumberFormatException e) { 286 } catch (NumberFormatException e) {
285 Log.e(TAG, "Wrong camera fps setting: " + fps); 287 Log.e(TAG, "Wrong camera fps setting: " + fps);
286 } 288 }
287 } 289 }
288 290
291 // Check capture quality slider flag.
292 boolean captureQualitySlider = sharedPref.getBoolean(keyprefCaptureQualitySl ider,
293 Boolean.valueOf(getString(R.string.pref_capturequalityslider_default)));
294
289 // Get video and audio start bitrate. 295 // Get video and audio start bitrate.
290 int videoStartBitrate = 0; 296 int videoStartBitrate = 0;
291 String bitrateTypeDefault = getString( 297 String bitrateTypeDefault = getString(
292 R.string.pref_startvideobitrate_default); 298 R.string.pref_startvideobitrate_default);
293 String bitrateType = sharedPref.getString( 299 String bitrateType = sharedPref.getString(
294 keyprefVideoBitrateType, bitrateTypeDefault); 300 keyprefVideoBitrateType, bitrateTypeDefault);
295 if (!bitrateType.equals(bitrateTypeDefault)) { 301 if (!bitrateType.equals(bitrateTypeDefault)) {
296 String bitrateValue = sharedPref.getString(keyprefVideoBitrateValue, 302 String bitrateValue = sharedPref.getString(keyprefVideoBitrateValue,
297 getString(R.string.pref_startvideobitratevalue_default)); 303 getString(R.string.pref_startvideobitratevalue_default));
298 videoStartBitrate = Integer.parseInt(bitrateValue); 304 videoStartBitrate = Integer.parseInt(bitrateValue);
(...skipping 23 matching lines...) Expand all
322 if (validateUrl(roomUrl)) { 328 if (validateUrl(roomUrl)) {
323 Uri uri = Uri.parse(roomUrl); 329 Uri uri = Uri.parse(roomUrl);
324 Intent intent = new Intent(this, CallActivity.class); 330 Intent intent = new Intent(this, CallActivity.class);
325 intent.setData(uri); 331 intent.setData(uri);
326 intent.putExtra(CallActivity.EXTRA_ROOMID, roomId); 332 intent.putExtra(CallActivity.EXTRA_ROOMID, roomId);
327 intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback); 333 intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback);
328 intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled); 334 intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled);
329 intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth); 335 intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth);
330 intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight); 336 intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight);
331 intent.putExtra(CallActivity.EXTRA_VIDEO_FPS, cameraFps); 337 intent.putExtra(CallActivity.EXTRA_VIDEO_FPS, cameraFps);
338 intent.putExtra(CallActivity.EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED,
339 captureQualitySlider);
332 intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate); 340 intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate);
333 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec); 341 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec);
334 intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec); 342 intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec);
335 intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED, 343 intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED,
336 noAudioProcessing); 344 noAudioProcessing);
337 intent.putExtra(CallActivity.EXTRA_AUDIO_BITRATE, audioStartBitrate); 345 intent.putExtra(CallActivity.EXTRA_AUDIO_BITRATE, audioStartBitrate);
338 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, audioCodec); 346 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, audioCodec);
339 intent.putExtra(CallActivity.EXTRA_CPUOVERUSE_DETECTION, 347 intent.putExtra(CallActivity.EXTRA_CPUOVERUSE_DETECTION,
340 cpuOveruseDetection); 348 cpuOveruseDetection);
341 intent.putExtra(CallActivity.EXTRA_DISPLAY_HUD, displayHud); 349 intent.putExtra(CallActivity.EXTRA_DISPLAY_HUD, displayHud);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 402 }
395 } 403 }
396 if (position != AdapterView.INVALID_POSITION) { 404 if (position != AdapterView.INVALID_POSITION) {
397 return adapter.getItem(position); 405 return adapter.getItem(position);
398 } else { 406 } else {
399 return null; 407 return null;
400 } 408 }
401 } 409 }
402 410
403 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698