OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 private String keyprefVideoBitrateValue; | 62 private String keyprefVideoBitrateValue; |
63 private String keyprefVideoCodec; | 63 private String keyprefVideoCodec; |
64 private String keyprefAudioBitrateType; | 64 private String keyprefAudioBitrateType; |
65 private String keyprefAudioBitrateValue; | 65 private String keyprefAudioBitrateValue; |
66 private String keyprefAudioCodec; | 66 private String keyprefAudioCodec; |
67 private String keyprefHwCodecAcceleration; | 67 private String keyprefHwCodecAcceleration; |
68 private String keyprefCaptureToTexture; | 68 private String keyprefCaptureToTexture; |
69 private String keyprefNoAudioProcessingPipeline; | 69 private String keyprefNoAudioProcessingPipeline; |
70 private String keyprefOpenSLES; | 70 private String keyprefOpenSLES; |
71 private String keyprefDisplayHud; | 71 private String keyprefDisplayHud; |
| 72 private String keyprefTracing; |
72 private String keyprefRoomServerUrl; | 73 private String keyprefRoomServerUrl; |
73 private String keyprefRoom; | 74 private String keyprefRoom; |
74 private String keyprefRoomList; | 75 private String keyprefRoomList; |
75 private ArrayList<String> roomList; | 76 private ArrayList<String> roomList; |
76 private ArrayAdapter<String> adapter; | 77 private ArrayAdapter<String> adapter; |
77 | 78 |
78 @Override | 79 @Override |
79 public void onCreate(Bundle savedInstanceState) { | 80 public void onCreate(Bundle savedInstanceState) { |
80 super.onCreate(savedInstanceState); | 81 super.onCreate(savedInstanceState); |
81 | 82 |
82 // Get setting keys. | 83 // Get setting keys. |
83 PreferenceManager.setDefaultValues(this, R.xml.preferences, false); | 84 PreferenceManager.setDefaultValues(this, R.xml.preferences, false); |
84 sharedPref = PreferenceManager.getDefaultSharedPreferences(this); | 85 sharedPref = PreferenceManager.getDefaultSharedPreferences(this); |
85 keyprefVideoCallEnabled = getString(R.string.pref_videocall_key); | 86 keyprefVideoCallEnabled = getString(R.string.pref_videocall_key); |
86 keyprefResolution = getString(R.string.pref_resolution_key); | 87 keyprefResolution = getString(R.string.pref_resolution_key); |
87 keyprefFps = getString(R.string.pref_fps_key); | 88 keyprefFps = getString(R.string.pref_fps_key); |
88 keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_k
ey); | 89 keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_k
ey); |
89 keyprefVideoBitrateType = getString(R.string.pref_startvideobitrate_key); | 90 keyprefVideoBitrateType = getString(R.string.pref_startvideobitrate_key); |
90 keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_ke
y); | 91 keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_ke
y); |
91 keyprefVideoCodec = getString(R.string.pref_videocodec_key); | 92 keyprefVideoCodec = getString(R.string.pref_videocodec_key); |
92 keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key); | 93 keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key); |
93 keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key); | 94 keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key); |
94 keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key); | 95 keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key); |
95 keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_ke
y); | 96 keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_ke
y); |
96 keyprefAudioCodec = getString(R.string.pref_audiocodec_key); | 97 keyprefAudioCodec = getString(R.string.pref_audiocodec_key); |
97 keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing
_key); | 98 keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing
_key); |
98 keyprefOpenSLES = getString(R.string.pref_opensles_key); | 99 keyprefOpenSLES = getString(R.string.pref_opensles_key); |
99 keyprefDisplayHud = getString(R.string.pref_displayhud_key); | 100 keyprefDisplayHud = getString(R.string.pref_displayhud_key); |
| 101 keyprefTracing = getString(R.string.pref_tracing_key); |
100 keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key); | 102 keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key); |
101 keyprefRoom = getString(R.string.pref_room_key); | 103 keyprefRoom = getString(R.string.pref_room_key); |
102 keyprefRoomList = getString(R.string.pref_room_list_key); | 104 keyprefRoomList = getString(R.string.pref_room_list_key); |
103 | 105 |
104 setContentView(R.layout.activity_connect); | 106 setContentView(R.layout.activity_connect); |
105 | 107 |
106 roomEditText = (EditText) findViewById(R.id.room_edittext); | 108 roomEditText = (EditText) findViewById(R.id.room_edittext); |
107 roomEditText.setOnEditorActionListener( | 109 roomEditText.setOnEditorActionListener( |
108 new TextView.OnEditorActionListener() { | 110 new TextView.OnEditorActionListener() { |
109 @Override | 111 @Override |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 if (!bitrateType.equals(bitrateTypeDefault)) { | 323 if (!bitrateType.equals(bitrateTypeDefault)) { |
322 String bitrateValue = sharedPref.getString(keyprefAudioBitrateValue, | 324 String bitrateValue = sharedPref.getString(keyprefAudioBitrateValue, |
323 getString(R.string.pref_startaudiobitratevalue_default)); | 325 getString(R.string.pref_startaudiobitratevalue_default)); |
324 audioStartBitrate = Integer.parseInt(bitrateValue); | 326 audioStartBitrate = Integer.parseInt(bitrateValue); |
325 } | 327 } |
326 | 328 |
327 // Check statistics display option. | 329 // Check statistics display option. |
328 boolean displayHud = sharedPref.getBoolean(keyprefDisplayHud, | 330 boolean displayHud = sharedPref.getBoolean(keyprefDisplayHud, |
329 Boolean.valueOf(getString(R.string.pref_displayhud_default))); | 331 Boolean.valueOf(getString(R.string.pref_displayhud_default))); |
330 | 332 |
| 333 boolean tracing = sharedPref.getBoolean( |
| 334 keyprefTracing, Boolean.valueOf(getString(R.string.pref_tracing_defa
ult))); |
| 335 |
331 // Start AppRTCDemo activity. | 336 // Start AppRTCDemo activity. |
332 Log.d(TAG, "Connecting to room " + roomId + " at URL " + roomUrl); | 337 Log.d(TAG, "Connecting to room " + roomId + " at URL " + roomUrl); |
333 if (validateUrl(roomUrl)) { | 338 if (validateUrl(roomUrl)) { |
334 Uri uri = Uri.parse(roomUrl); | 339 Uri uri = Uri.parse(roomUrl); |
335 Intent intent = new Intent(this, CallActivity.class); | 340 Intent intent = new Intent(this, CallActivity.class); |
336 intent.setData(uri); | 341 intent.setData(uri); |
337 intent.putExtra(CallActivity.EXTRA_ROOMID, roomId); | 342 intent.putExtra(CallActivity.EXTRA_ROOMID, roomId); |
338 intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback); | 343 intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback); |
339 intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled); | 344 intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled); |
340 intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth); | 345 intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth); |
341 intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight); | 346 intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight); |
342 intent.putExtra(CallActivity.EXTRA_VIDEO_FPS, cameraFps); | 347 intent.putExtra(CallActivity.EXTRA_VIDEO_FPS, cameraFps); |
343 intent.putExtra(CallActivity.EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED, | 348 intent.putExtra(CallActivity.EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED, |
344 captureQualitySlider); | 349 captureQualitySlider); |
345 intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate); | 350 intent.putExtra(CallActivity.EXTRA_VIDEO_BITRATE, videoStartBitrate); |
346 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec); | 351 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, videoCodec); |
347 intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec); | 352 intent.putExtra(CallActivity.EXTRA_HWCODEC_ENABLED, hwCodec); |
348 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, captureToText
ure); | 353 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, captureToText
ure); |
349 intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED, | 354 intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED, |
350 noAudioProcessing); | 355 noAudioProcessing); |
351 intent.putExtra(CallActivity.EXTRA_OPENSLES_ENABLED, useOpenSLES); | 356 intent.putExtra(CallActivity.EXTRA_OPENSLES_ENABLED, useOpenSLES); |
352 intent.putExtra(CallActivity.EXTRA_AUDIO_BITRATE, audioStartBitrate); | 357 intent.putExtra(CallActivity.EXTRA_AUDIO_BITRATE, audioStartBitrate); |
353 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, audioCodec); | 358 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, audioCodec); |
354 intent.putExtra(CallActivity.EXTRA_DISPLAY_HUD, displayHud); | 359 intent.putExtra(CallActivity.EXTRA_DISPLAY_HUD, displayHud); |
| 360 intent.putExtra(CallActivity.EXTRA_TRACING, tracing); |
355 intent.putExtra(CallActivity.EXTRA_CMDLINE, commandLineRun); | 361 intent.putExtra(CallActivity.EXTRA_CMDLINE, commandLineRun); |
356 intent.putExtra(CallActivity.EXTRA_RUNTIME, runTimeMs); | 362 intent.putExtra(CallActivity.EXTRA_RUNTIME, runTimeMs); |
357 | 363 |
358 startActivityForResult(intent, CONNECTION_REQUEST); | 364 startActivityForResult(intent, CONNECTION_REQUEST); |
359 } | 365 } |
360 } | 366 } |
361 | 367 |
362 private boolean validateUrl(String url) { | 368 private boolean validateUrl(String url) { |
363 if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) { | 369 if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) { |
364 return true; | 370 return true; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 413 } |
408 } | 414 } |
409 if (position != AdapterView.INVALID_POSITION) { | 415 if (position != AdapterView.INVALID_POSITION) { |
410 return adapter.getItem(position); | 416 return adapter.getItem(position); |
411 } else { | 417 } else { |
412 return null; | 418 return null; |
413 } | 419 } |
414 } | 420 } |
415 | 421 |
416 } | 422 } |
OLD | NEW |