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

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

Issue 1323453002: VideoCapturerAndroid: Move to android folder and split out camera enumeration into separate file (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « talk/libjingle.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 package org.appspot.apprtc; 11 package org.appspot.apprtc;
12 12
13 import android.content.Context; 13 import android.content.Context;
14 import android.opengl.EGLContext; 14 import android.opengl.EGLContext;
15 import android.util.Log; 15 import android.util.Log;
16 16
17 import org.appspot.apprtc.AppRTCClient.SignalingParameters; 17 import org.appspot.apprtc.AppRTCClient.SignalingParameters;
18 import org.appspot.apprtc.util.LooperExecutor; 18 import org.appspot.apprtc.util.LooperExecutor;
19 import org.webrtc.CameraEnumerationAndroid;
19 import org.webrtc.DataChannel; 20 import org.webrtc.DataChannel;
20 import org.webrtc.IceCandidate; 21 import org.webrtc.IceCandidate;
21 import org.webrtc.Logging; 22 import org.webrtc.Logging;
22 import org.webrtc.MediaCodecVideoEncoder; 23 import org.webrtc.MediaCodecVideoEncoder;
23 import org.webrtc.MediaConstraints; 24 import org.webrtc.MediaConstraints;
24 import org.webrtc.MediaConstraints.KeyValuePair; 25 import org.webrtc.MediaConstraints.KeyValuePair;
25 import org.webrtc.MediaStream; 26 import org.webrtc.MediaStream;
26 import org.webrtc.PeerConnection; 27 import org.webrtc.PeerConnection;
27 import org.webrtc.PeerConnection.IceConnectionState; 28 import org.webrtc.PeerConnection.IceConnectionState;
28 import org.webrtc.PeerConnectionFactory; 29 import org.webrtc.PeerConnectionFactory;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // Enable DTLS for normal calls and disable for loopback calls. 323 // Enable DTLS for normal calls and disable for loopback calls.
323 if (peerConnectionParameters.loopback) { 324 if (peerConnectionParameters.loopback) {
324 pcConstraints.optional.add( 325 pcConstraints.optional.add(
325 new MediaConstraints.KeyValuePair(DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT, "false")); 326 new MediaConstraints.KeyValuePair(DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT, "false"));
326 } else { 327 } else {
327 pcConstraints.optional.add( 328 pcConstraints.optional.add(
328 new MediaConstraints.KeyValuePair(DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT, "true")); 329 new MediaConstraints.KeyValuePair(DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT, "true"));
329 } 330 }
330 331
331 // Check if there is a camera on device and disable video call if not. 332 // Check if there is a camera on device and disable video call if not.
332 numberOfCameras = VideoCapturerAndroid.getDeviceCount(); 333 numberOfCameras = CameraEnumerationAndroid.getDeviceCount();
333 if (numberOfCameras == 0) { 334 if (numberOfCameras == 0) {
334 Log.w(TAG, "No camera on device. Switch to audio only call."); 335 Log.w(TAG, "No camera on device. Switch to audio only call.");
335 videoCallEnabled = false; 336 videoCallEnabled = false;
336 } 337 }
337 // Create video constraints if video call is enabled. 338 // Create video constraints if video call is enabled.
338 if (videoCallEnabled) { 339 if (videoCallEnabled) {
339 videoConstraints = new MediaConstraints(); 340 videoConstraints = new MediaConstraints();
340 int videoWidth = peerConnectionParameters.videoWidth; 341 int videoWidth = peerConnectionParameters.videoWidth;
341 int videoHeight = peerConnectionParameters.videoHeight; 342 int videoHeight = peerConnectionParameters.videoHeight;
342 343
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 428
428 // Set default WebRTC tracing and INFO libjingle logging. 429 // Set default WebRTC tracing and INFO libjingle logging.
429 // NOTE: this _must_ happen while |factory| is alive! 430 // NOTE: this _must_ happen while |factory| is alive!
430 Logging.enableTracing( 431 Logging.enableTracing(
431 "logcat:", 432 "logcat:",
432 EnumSet.of(Logging.TraceLevel.TRACE_DEFAULT), 433 EnumSet.of(Logging.TraceLevel.TRACE_DEFAULT),
433 Logging.Severity.LS_INFO); 434 Logging.Severity.LS_INFO);
434 435
435 mediaStream = factory.createLocalMediaStream("ARDAMS"); 436 mediaStream = factory.createLocalMediaStream("ARDAMS");
436 if (videoCallEnabled) { 437 if (videoCallEnabled) {
437 String cameraDeviceName = VideoCapturerAndroid.getDeviceName(0); 438 String cameraDeviceName = CameraEnumerationAndroid.getDeviceName(0);
438 String frontCameraDeviceName = 439 String frontCameraDeviceName =
439 VideoCapturerAndroid.getNameOfFrontFacingDevice(); 440 CameraEnumerationAndroid.getNameOfFrontFacingDevice();
440 if (numberOfCameras > 1 && frontCameraDeviceName != null) { 441 if (numberOfCameras > 1 && frontCameraDeviceName != null) {
441 cameraDeviceName = frontCameraDeviceName; 442 cameraDeviceName = frontCameraDeviceName;
442 } 443 }
443 Log.d(TAG, "Opening camera: " + cameraDeviceName); 444 Log.d(TAG, "Opening camera: " + cameraDeviceName);
444 videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null); 445 videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null);
445 if (videoCapturer == null) { 446 if (videoCapturer == null) {
446 reportError("Failed to open camera"); 447 reportError("Failed to open camera");
447 return; 448 return;
448 } 449 }
449 mediaStream.addTrack(createVideoTrack(videoCapturer)); 450 mediaStream.addTrack(createVideoTrack(videoCapturer));
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 public void onCreateFailure(final String error) { 1004 public void onCreateFailure(final String error) {
1004 reportError("createSDP error: " + error); 1005 reportError("createSDP error: " + error);
1005 } 1006 }
1006 1007
1007 @Override 1008 @Override
1008 public void onSetFailure(final String error) { 1009 public void onSetFailure(final String error) {
1009 reportError("setSDP error: " + error); 1010 reportError("setSDP error: " + error);
1010 } 1011 }
1011 } 1012 }
1012 } 1013 }
OLDNEW
« no previous file with comments | « talk/libjingle.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698