| Index: media/capture/video/android/video_capture_device_android.h
|
| diff --git a/media/capture/video/android/video_capture_device_android.h b/media/capture/video/android/video_capture_device_android.h
|
| index 9a637a39eb1af496995747d86fdca0e43586bb4c..f4d9236f7cddd8e01efe1f8a7e7a2106778be8e7 100644
|
| --- a/media/capture/video/android/video_capture_device_android.h
|
| +++ b/media/capture/video/android/video_capture_device_android.h
|
| @@ -10,6 +10,7 @@
|
|
|
| #include "base/android/scoped_java_ref.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/synchronization/lock.h"
|
| #include "base/threading/thread.h"
|
| #include "base/threading/thread_checker.h"
|
| @@ -17,9 +18,13 @@
|
| #include "media/capture/capture_export.h"
|
| #include "media/capture/video/video_capture_device.h"
|
|
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +}
|
| +
|
| namespace tracked_objects {
|
| class Location;
|
| -} // namespace tracked_
|
| +} // namespace tracked_objects
|
|
|
| namespace media {
|
|
|
| @@ -97,24 +102,33 @@ class CAPTURE_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice {
|
|
|
| private:
|
| enum InternalState {
|
| - kIdle, // The device is opened but not in use.
|
| - kCapturing, // Video is being captured.
|
| - kError // Hit error. User needs to recover by destroying the object.
|
| + kIdle, // The device is opened but not in use.
|
| + kConfigured, // The device has been AllocateAndStart()ed.
|
| + kError // Hit error. User needs to recover by destroying the object.
|
| };
|
|
|
| VideoPixelFormat GetColorspace();
|
| void SetErrorState(const tracked_objects::Location& from_here,
|
| const std::string& reason);
|
|
|
| - base::ThreadChecker thread_checker_;
|
| + void DoGetPhotoCapabilities(GetPhotoCapabilitiesCallback callback);
|
| + void DoSetPhotoOptions(mojom::PhotoSettingsPtr settings,
|
| + SetPhotoOptionsCallback callback);
|
| + void DoTakePhoto(TakePhotoCallback callback);
|
| +
|
| + // Thread on which we are created.
|
| + const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
|
|
|
| - // Prevent racing on accessing |state_| and |client_| since both could be
|
| - // accessed from different threads.
|
| + // |lock_| protects |state_|, |client_|, |got_first_frame_| and
|
| + // |photo_requests_queue_| from concurrent access.
|
| base::Lock lock_;
|
| InternalState state_;
|
| std::unique_ptr<VideoCaptureDevice::Client> client_;
|
| -
|
| bool got_first_frame_;
|
| + // Photo-related requests waiting for |got_first_frame_| to be served. Android
|
| + // APIs need the device capturing or nearly-capturing to be fully oeprational.
|
| + std::list<base::Closure> photo_requests_queue_;
|
| +
|
| base::TimeTicks expected_next_frame_time_;
|
| base::TimeTicks first_ref_time_;
|
| base::TimeDelta frame_interval_;
|
| @@ -131,6 +145,8 @@ class CAPTURE_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice {
|
| // Java VideoCaptureAndroid instance.
|
| base::android::ScopedJavaLocalRef<jobject> j_capture_;
|
|
|
| + base::WeakPtrFactory<VideoCaptureDeviceAndroid> weak_ptr_factory_;
|
| +
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid);
|
| };
|
|
|
|
|