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

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

Issue 2273573003: Support for video file instead of camera and output video out to file (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added file to start automated loopback run Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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 238d123dea4f3d3249e0fab8b8139e83ca95e6e9..05ed71eb6ab1edd1d389fd68e8150bd4e19e1bd7 100644
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java
@@ -40,6 +40,9 @@ import org.webrtc.StatsObserver;
import org.webrtc.StatsReport;
import org.webrtc.VideoCapturer;
import org.webrtc.VideoRenderer;
+import org.webrtc.VideoCapturerAndroid;
+import org.webrtc.CameraVideoCapturer;
+import org.webrtc.FileVideoCapturer;
import org.webrtc.VideoSource;
import org.webrtc.VideoTrack;
import org.webrtc.voiceengine.WebRtcAudioManager;
@@ -163,6 +166,9 @@ public class PeerConnectionClient {
public final boolean disableBuiltInAGC;
public final boolean disableBuiltInNS;
public final boolean enableLevelControl;
+ public final String videoFileAsCamera;
+ public final int videoFileAsCameraWidth;
+ public final int videoFileAsCameraHeight;
public PeerConnectionParameters(
boolean videoCallEnabled, boolean loopback, boolean tracing, boolean useCamera2,
@@ -171,7 +177,9 @@ public class PeerConnectionClient {
boolean captureToTexture, int audioStartBitrate, String audioCodec,
boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES,
boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean disableBuiltInNS,
- boolean enableLevelControl) {
+ boolean enableLevelControl,
+ String videoFileAsCamera, int videoFileAsCameraWidth, int videoFileAsCameraHeight) {
+
this.videoCallEnabled = videoCallEnabled;
this.useCamera2 = useCamera2;
this.loopback = loopback;
@@ -192,6 +200,9 @@ public class PeerConnectionClient {
this.disableBuiltInAGC = disableBuiltInAGC;
this.disableBuiltInNS = disableBuiltInNS;
this.enableLevelControl = enableLevelControl;
+ this.videoFileAsCamera = videoFileAsCamera;
+ this.videoFileAsCameraWidth = videoFileAsCameraWidth;
+ this.videoFileAsCameraHeight = videoFileAsCameraHeight;
}
}
@@ -557,11 +568,26 @@ public class PeerConnectionClient {
Logging.d(TAG, "Creating capturer using camera1 API.");
createCapturer(new Camera1Enumerator(peerConnectionParameters.captureToTexture));
}
-
if (videoCapturer == null) {
reportError("Failed to open camera");
return;
}
+ if (peerConnectionParameters.videoFileAsCamera != null) {
+ CameraVideoCapturer fileVideoCapturer = FileVideoCapturer.create(
+ new File(peerConnectionParameters.videoFileAsCamera),
+ peerConnectionParameters.videoFileAsCameraWidth,
+ peerConnectionParameters.videoFileAsCameraHeight,
+ videoCapturer);
+
+ if (fileVideoCapturer == null) {
+ Log.d(TAG, "Failed to open video file for emulated camera");
+ reportError("Failed to open video file for emulated camera");
+ return;
+ }
+ else {
+ videoCapturer = fileVideoCapturer;
+ }
+ }
mediaStream.addTrack(createVideoTrack(videoCapturer));
}

Powered by Google App Engine
This is Rietveld 408576698