Index: webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java |
diff --git a/webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java b/webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ed24471cd9cd8f9c14ccf286daa6ca1f0022409b |
--- /dev/null |
+++ b/webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java |
@@ -0,0 +1,82 @@ |
+/* |
+ * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+package org.webrtc; |
+ |
+import android.content.Context; |
+ |
+import java.util.List; |
+import java.util.Timer; |
+import java.util.TimerTask; |
+ |
+import java.io.File; |
+import java.io.RandomAccessFile; |
+import java.io.IOException; |
+import android.os.Handler; |
+ |
+public class FileVideoCapturerTimer implements CameraVideoCapturer { |
+ private final static String TAG = "FileVideoCapturerTimer"; |
+ |
+ private FileVideoCapturer fileVideoCapturer; |
+ private CapturerObserver capturerObserver; |
+ private volatile boolean isCapturing = false; |
+ private Timer timer = new Timer(); |
+ private TimerTask tickTask = new TimerTask() { |
+ @Override |
+ public void run() { |
+ fileVideoCapturer.tick(capturerObserver); |
+ } |
+ }; |
+ |
+ public FileVideoCapturerTimer(FileVideoCapturer fileVideoCapturer) { |
+ this.fileVideoCapturer = fileVideoCapturer; |
+ } |
+ |
+ @Override |
+ public void initialize(SurfaceTextureHelper surfaceTextureHelper, Context applicationContext, |
+ CapturerObserver capturerObserver) { |
+ this.capturerObserver = capturerObserver; |
+ } |
+ |
+ @Override |
+ public void startCapture( |
+ int width, int height, int framerate) { |
+ timer.schedule(tickTask, 0, 33); |
+ } |
+ |
+ @Override |
+ public void stopCapture() throws InterruptedException { |
+ timer.cancel(); |
+ } |
+ |
+ @Override |
+ public void onOutputFormatRequest(int width, int height, int framerate) { |
+ // Empty on purpose |
+ } |
+ |
+ @Override |
+ public void changeCaptureFormat(int width, int height, int framerate) { |
+ // Empty on purpose |
+ } |
+ |
+ @Override |
+ public void dispose() { |
+ fileVideoCapturer.dispose(); |
+ } |
+ |
+ @Override |
+ public void switchCamera(CameraSwitchHandler switchEventsHandler) { |
+ // Empty on purpose |
+ } |
+ |
+ @Override |
+ public boolean isScreencast() { |
+ return false; |
+ } |
+} |