OLD | NEW |
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; |
| 14 import org.appspot.apprtc.AppRTCClient.SignalingParameters; |
| 15 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; |
| 16 import org.appspot.apprtc.util.LooperExecutor; |
| 17 |
13 import android.app.Activity; | 18 import android.app.Activity; |
14 import android.app.AlertDialog; | 19 import android.app.AlertDialog; |
15 import android.app.FragmentTransaction; | 20 import android.app.FragmentTransaction; |
16 import android.content.DialogInterface; | 21 import android.content.DialogInterface; |
17 import android.content.Intent; | 22 import android.content.Intent; |
18 import android.content.pm.PackageManager; | 23 import android.content.pm.PackageManager; |
19 import android.net.Uri; | 24 import android.net.Uri; |
20 import android.os.Bundle; | 25 import android.os.Bundle; |
21 import android.os.Handler; | 26 import android.os.Handler; |
22 import android.util.Log; | 27 import android.util.Log; |
23 import android.view.View; | 28 import android.view.View; |
24 import android.view.Window; | 29 import android.view.Window; |
25 import android.view.WindowManager.LayoutParams; | 30 import android.view.WindowManager.LayoutParams; |
26 import android.widget.Toast; | 31 import android.widget.Toast; |
27 | 32 |
28 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; | 33 import org.webrtc.Camera2Enumerator; |
29 import org.appspot.apprtc.AppRTCClient.SignalingParameters; | |
30 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; | |
31 import org.appspot.apprtc.util.LooperExecutor; | |
32 import org.webrtc.EglBase; | 34 import org.webrtc.EglBase; |
33 import org.webrtc.IceCandidate; | 35 import org.webrtc.IceCandidate; |
34 import org.webrtc.PeerConnectionFactory; | 36 import org.webrtc.PeerConnectionFactory; |
35 import org.webrtc.RendererCommon.ScalingType; | 37 import org.webrtc.RendererCommon.ScalingType; |
36 import org.webrtc.SessionDescription; | 38 import org.webrtc.SessionDescription; |
37 import org.webrtc.StatsReport; | 39 import org.webrtc.StatsReport; |
38 import org.webrtc.SurfaceViewRenderer; | 40 import org.webrtc.SurfaceViewRenderer; |
39 | 41 |
40 /** | 42 /** |
41 * Activity for peer connection call setup, call waiting | 43 * Activity for peer connection call setup, call waiting |
42 * and call view. | 44 * and call view. |
43 */ | 45 */ |
44 public class CallActivity extends Activity | 46 public class CallActivity extends Activity |
45 implements AppRTCClient.SignalingEvents, | 47 implements AppRTCClient.SignalingEvents, |
46 PeerConnectionClient.PeerConnectionEvents, | 48 PeerConnectionClient.PeerConnectionEvents, |
47 CallFragment.OnCallEvents { | 49 CallFragment.OnCallEvents { |
48 | 50 |
49 public static final String EXTRA_ROOMID = | 51 public static final String EXTRA_ROOMID = |
50 "org.appspot.apprtc.ROOMID"; | 52 "org.appspot.apprtc.ROOMID"; |
51 public static final String EXTRA_LOOPBACK = | 53 public static final String EXTRA_LOOPBACK = |
52 "org.appspot.apprtc.LOOPBACK"; | 54 "org.appspot.apprtc.LOOPBACK"; |
53 public static final String EXTRA_VIDEO_CALL = | 55 public static final String EXTRA_VIDEO_CALL = |
54 "org.appspot.apprtc.VIDEO_CALL"; | 56 "org.appspot.apprtc.VIDEO_CALL"; |
| 57 public static final String EXTRA_CAMERA2 = |
| 58 "org.appspot.apprtc.CAMERA2"; |
55 public static final String EXTRA_VIDEO_WIDTH = | 59 public static final String EXTRA_VIDEO_WIDTH = |
56 "org.appspot.apprtc.VIDEO_WIDTH"; | 60 "org.appspot.apprtc.VIDEO_WIDTH"; |
57 public static final String EXTRA_VIDEO_HEIGHT = | 61 public static final String EXTRA_VIDEO_HEIGHT = |
58 "org.appspot.apprtc.VIDEO_HEIGHT"; | 62 "org.appspot.apprtc.VIDEO_HEIGHT"; |
59 public static final String EXTRA_VIDEO_FPS = | 63 public static final String EXTRA_VIDEO_FPS = |
60 "org.appspot.apprtc.VIDEO_FPS"; | 64 "org.appspot.apprtc.VIDEO_FPS"; |
61 public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED = | 65 public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED = |
62 "org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER"; | 66 "org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER"; |
63 public static final String EXTRA_VIDEO_BITRATE = | 67 public static final String EXTRA_VIDEO_BITRATE = |
64 "org.appspot.apprtc.VIDEO_BITRATE"; | 68 "org.appspot.apprtc.VIDEO_BITRATE"; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return; | 216 return; |
213 } | 217 } |
214 String roomId = intent.getStringExtra(EXTRA_ROOMID); | 218 String roomId = intent.getStringExtra(EXTRA_ROOMID); |
215 if (roomId == null || roomId.length() == 0) { | 219 if (roomId == null || roomId.length() == 0) { |
216 logAndToast(getString(R.string.missing_url)); | 220 logAndToast(getString(R.string.missing_url)); |
217 Log.e(TAG, "Incorrect room ID in intent!"); | 221 Log.e(TAG, "Incorrect room ID in intent!"); |
218 setResult(RESULT_CANCELED); | 222 setResult(RESULT_CANCELED); |
219 finish(); | 223 finish(); |
220 return; | 224 return; |
221 } | 225 } |
| 226 |
222 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); | 227 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); |
223 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); | 228 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); |
| 229 |
| 230 boolean useCamera2 = Camera2Enumerator.isSupported() |
| 231 && intent.getBooleanExtra(EXTRA_CAMERA2, true); |
| 232 |
224 peerConnectionParameters = new PeerConnectionParameters( | 233 peerConnectionParameters = new PeerConnectionParameters( |
225 intent.getBooleanExtra(EXTRA_VIDEO_CALL, true), | 234 intent.getBooleanExtra(EXTRA_VIDEO_CALL, true), |
226 loopback, | 235 loopback, |
227 tracing, | 236 tracing, |
| 237 useCamera2, |
228 intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0), | 238 intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0), |
229 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), | 239 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), |
230 intent.getIntExtra(EXTRA_VIDEO_FPS, 0), | 240 intent.getIntExtra(EXTRA_VIDEO_FPS, 0), |
231 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), | 241 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), |
232 intent.getStringExtra(EXTRA_VIDEOCODEC), | 242 intent.getStringExtra(EXTRA_VIDEOCODEC), |
233 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), | 243 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), |
234 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), | 244 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), |
235 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), | 245 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), |
236 intent.getStringExtra(EXTRA_AUDIOCODEC), | 246 intent.getStringExtra(EXTRA_AUDIOCODEC), |
237 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), | 247 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 } | 717 } |
708 } | 718 } |
709 }); | 719 }); |
710 } | 720 } |
711 | 721 |
712 @Override | 722 @Override |
713 public void onPeerConnectionError(final String description) { | 723 public void onPeerConnectionError(final String description) { |
714 reportError(description); | 724 reportError(description); |
715 } | 725 } |
716 } | 726 } |
OLD | NEW |