Chromium Code Reviews| 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; |
|
magjed_webrtc
2016/09/16 13:46:25
Some of these imports are unused. Please remove al
|
| +import java.io.RandomAccessFile; |
| +import java.io.IOException; |
| +import android.os.Handler; |
| + |
| +public class FileVideoCapturerTimer implements CameraVideoCapturer { |
|
magjed_webrtc
2016/09/16 13:46:25
Why do we need both FileVideoCapturer and FileVide
mandermo
2016/09/23 15:12:03
To be able to late do timing based on physical cam
|
| + private final static String TAG = "FileVideoCapturerTimer"; |
| + |
| + private FileVideoCapturer fileVideoCapturer; |
| + private CapturerObserver capturerObserver; |
| + private volatile boolean isCapturing = false; |
|
magjed_webrtc
2016/09/16 13:46:25
This variable is unused. Please remove all unused
mandermo
2016/09/23 15:12:03
Done.
|
| + 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); |
|
magjed_webrtc
2016/09/16 13:46:25
This should be based on the framerate.
mandermo
2016/09/23 15:12:03
Based on framerate argument now
|
| + } |
| + |
| + @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; |
| + } |
| +} |