Index: webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java |
diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java |
index 94b66a769f51069a6388a3aba9cc34df58eed8fc..95cf8936dd2003315da06a0b60eb77c56c59a22f 100644 |
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java |
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java |
@@ -33,7 +33,10 @@ import org.webrtc.SdpObserver; |
import org.webrtc.SessionDescription; |
import org.webrtc.StatsObserver; |
import org.webrtc.StatsReport; |
+import org.webrtc.CameraVideoCapturer; |
+import org.webrtc.VideoCapturer; |
import org.webrtc.VideoCapturerAndroid; |
+import org.webrtc.VideoCapturerAndroid2; |
import org.webrtc.VideoRenderer; |
import org.webrtc.VideoSource; |
import org.webrtc.VideoTrack; |
@@ -93,6 +96,7 @@ public class PeerConnectionClient { |
private final SDPObserver sdpObserver = new SDPObserver(); |
private final ScheduledExecutorService executor; |
+ private Context context; |
private PeerConnectionFactory factory; |
private PeerConnection peerConnection; |
PeerConnectionFactory.Options options = null; |
@@ -121,7 +125,7 @@ public class PeerConnectionClient { |
private SessionDescription localSdp; // either offer or answer SDP |
private MediaStream mediaStream; |
private int numberOfCameras; |
- private VideoCapturerAndroid videoCapturer; |
+ private CameraVideoCapturer videoCapturer; |
// enableVideo is set to true if video should be rendered and sent. |
private boolean renderVideo; |
private VideoTrack localVideoTrack; |
@@ -247,6 +251,7 @@ public class PeerConnectionClient { |
this.events = events; |
videoCallEnabled = peerConnectionParameters.videoCallEnabled; |
// Reset variables to initial states. |
+ this.context = null; |
factory = null; |
peerConnection = null; |
preferIsac = false; |
@@ -359,6 +364,7 @@ public class PeerConnectionClient { |
if (options != null) { |
Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMask); |
} |
+ this.context = context; |
factory = new PeerConnectionFactory(options); |
Log.d(TAG, "Peer connection factory created."); |
} |
@@ -497,8 +503,7 @@ public class PeerConnectionClient { |
cameraDeviceName = frontCameraDeviceName; |
} |
Log.d(TAG, "Opening camera: " + cameraDeviceName); |
- videoCapturer = VideoCapturerAndroid.create(cameraDeviceName, null, |
- peerConnectionParameters.captureToTexture); |
+ videoCapturer = new VideoCapturerAndroid2(context, "1", null); |
if (videoCapturer == null) { |
reportError("Failed to open camera"); |
return; |
@@ -778,7 +783,7 @@ public class PeerConnectionClient { |
return localAudioTrack; |
} |
- private VideoTrack createVideoTrack(VideoCapturerAndroid capturer) { |
+ private VideoTrack createVideoTrack(VideoCapturer capturer) { |
videoSource = factory.createVideoSource(capturer, videoConstraints); |
localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource); |