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

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

Issue 2077663003: Camera2 in AppRTC Android Demo. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@camera2_only
Patch Set: Rebase. Created 4 years, 5 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 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
(...skipping 11 matching lines...) Expand all
22 import android.util.Log; 22 import android.util.Log;
23 import android.view.View; 23 import android.view.View;
24 import android.view.Window; 24 import android.view.Window;
25 import android.view.WindowManager.LayoutParams; 25 import android.view.WindowManager.LayoutParams;
26 import android.widget.Toast; 26 import android.widget.Toast;
27 27
28 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; 28 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters;
29 import org.appspot.apprtc.AppRTCClient.SignalingParameters; 29 import org.appspot.apprtc.AppRTCClient.SignalingParameters;
30 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; 30 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters;
31 import org.appspot.apprtc.util.LooperExecutor; 31 import org.appspot.apprtc.util.LooperExecutor;
32 import org.webrtc.Camera2Enumerator;
32 import org.webrtc.EglBase; 33 import org.webrtc.EglBase;
33 import org.webrtc.IceCandidate; 34 import org.webrtc.IceCandidate;
34 import org.webrtc.PeerConnectionFactory; 35 import org.webrtc.PeerConnectionFactory;
35 import org.webrtc.RendererCommon.ScalingType; 36 import org.webrtc.RendererCommon.ScalingType;
36 import org.webrtc.SessionDescription; 37 import org.webrtc.SessionDescription;
37 import org.webrtc.StatsReport; 38 import org.webrtc.StatsReport;
38 import org.webrtc.SurfaceViewRenderer; 39 import org.webrtc.SurfaceViewRenderer;
39 40
40 /** 41 /**
41 * Activity for peer connection call setup, call waiting 42 * Activity for peer connection call setup, call waiting
42 * and call view. 43 * and call view.
43 */ 44 */
44 public class CallActivity extends Activity 45 public class CallActivity extends Activity
45 implements AppRTCClient.SignalingEvents, 46 implements AppRTCClient.SignalingEvents,
46 PeerConnectionClient.PeerConnectionEvents, 47 PeerConnectionClient.PeerConnectionEvents,
47 CallFragment.OnCallEvents { 48 CallFragment.OnCallEvents {
48 49
49 public static final String EXTRA_ROOMID = 50 public static final String EXTRA_ROOMID =
50 "org.appspot.apprtc.ROOMID"; 51 "org.appspot.apprtc.ROOMID";
51 public static final String EXTRA_LOOPBACK = 52 public static final String EXTRA_LOOPBACK =
52 "org.appspot.apprtc.LOOPBACK"; 53 "org.appspot.apprtc.LOOPBACK";
53 public static final String EXTRA_VIDEO_CALL = 54 public static final String EXTRA_VIDEO_CALL =
54 "org.appspot.apprtc.VIDEO_CALL"; 55 "org.appspot.apprtc.VIDEO_CALL";
56 public static final String EXTRA_CAMERA2 =
57 "org.appspot.apprtc.CAMERA2";
55 public static final String EXTRA_VIDEO_WIDTH = 58 public static final String EXTRA_VIDEO_WIDTH =
56 "org.appspot.apprtc.VIDEO_WIDTH"; 59 "org.appspot.apprtc.VIDEO_WIDTH";
57 public static final String EXTRA_VIDEO_HEIGHT = 60 public static final String EXTRA_VIDEO_HEIGHT =
58 "org.appspot.apprtc.VIDEO_HEIGHT"; 61 "org.appspot.apprtc.VIDEO_HEIGHT";
59 public static final String EXTRA_VIDEO_FPS = 62 public static final String EXTRA_VIDEO_FPS =
60 "org.appspot.apprtc.VIDEO_FPS"; 63 "org.appspot.apprtc.VIDEO_FPS";
61 public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED = 64 public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED =
62 "org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER"; 65 "org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER";
63 public static final String EXTRA_VIDEO_BITRATE = 66 public static final String EXTRA_VIDEO_BITRATE =
64 "org.appspot.apprtc.VIDEO_BITRATE"; 67 "org.appspot.apprtc.VIDEO_BITRATE";
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return; 215 return;
213 } 216 }
214 String roomId = intent.getStringExtra(EXTRA_ROOMID); 217 String roomId = intent.getStringExtra(EXTRA_ROOMID);
215 if (roomId == null || roomId.length() == 0) { 218 if (roomId == null || roomId.length() == 0) {
216 logAndToast(getString(R.string.missing_url)); 219 logAndToast(getString(R.string.missing_url));
217 Log.e(TAG, "Incorrect room ID in intent!"); 220 Log.e(TAG, "Incorrect room ID in intent!");
218 setResult(RESULT_CANCELED); 221 setResult(RESULT_CANCELED);
219 finish(); 222 finish();
220 return; 223 return;
221 } 224 }
225 String camera2Option = intent.getStringExtra(EXTRA_CAMERA2);
226 boolean camera2Enabled = camera2Option.equals("true") || camera2Option.equal s("force");
227 boolean camera1Enabled = !Camera2Enumerator.isSupported() || !camera2Option. equals("force");
magjed_webrtc 2016/06/29 13:36:45 Shouldn't this be just: boolean camera1Enabled = !
sakal 2016/06/30 09:14:52 The option in the settings is disabled if Camera2E
magjed_webrtc 2016/06/30 11:21:47 I think it's an overkill for this demo app to have
228
222 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false); 229 boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
223 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false); 230 boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
224 peerConnectionParameters = new PeerConnectionParameters( 231 peerConnectionParameters = new PeerConnectionParameters(
225 intent.getBooleanExtra(EXTRA_VIDEO_CALL, true), 232 intent.getBooleanExtra(EXTRA_VIDEO_CALL, true),
226 loopback, 233 loopback,
227 tracing, 234 tracing,
235 camera2Enabled,
236 camera1Enabled,
228 intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0), 237 intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0),
229 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), 238 intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0),
230 intent.getIntExtra(EXTRA_VIDEO_FPS, 0), 239 intent.getIntExtra(EXTRA_VIDEO_FPS, 0),
231 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), 240 intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0),
232 intent.getStringExtra(EXTRA_VIDEOCODEC), 241 intent.getStringExtra(EXTRA_VIDEOCODEC),
233 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true), 242 intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
234 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false), 243 intent.getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false),
235 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), 244 intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0),
236 intent.getStringExtra(EXTRA_AUDIOCODEC), 245 intent.getStringExtra(EXTRA_AUDIOCODEC),
237 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false), 246 intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false),
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 716 }
708 } 717 }
709 }); 718 });
710 } 719 }
711 720
712 @Override 721 @Override
713 public void onPeerConnectionError(final String description) { 722 public void onPeerConnectionError(final String description) {
714 reportError(description); 723 reportError(description);
715 } 724 }
716 } 725 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698