| 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 09a2c8ea62e01f7fb0146e31893d6f40c10413ac..19a01179cfcf7771af218a566809842bd106a5ef 100644
|
| --- a/media/capture/video/android/video_capture_device_android.h
|
| +++ b/media/capture/video/android/video_capture_device_android.h
|
| @@ -106,17 +106,45 @@ class CAPTURE_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice {
|
|
|
| void ConfigureForTesting();
|
|
|
| - private:
|
| + protected:
|
| enum InternalState {
|
| 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();
|
| + // Helper code executed when the frame is available; if it is the first frame,
|
| + // setup time fluctuation control and process any pending photo requests.
|
| + void ProcessFirstFrameAvailable(base::TimeTicks current_time);
|
| +
|
| + // Check if there is client and if the state is valid.
|
| + bool IsClientConfiguredForIncomingData();
|
| +
|
| + // Check if the incoming frame didn't arrived too, advance the next frame
|
| + // expectation time and return true;
|
| + bool AdvanceToNextFrameTime(base::TimeTicks current_time);
|
| + void SendIncomingDataToClient(const uint8_t* data,
|
| + int length,
|
| + int rotation,
|
| + base::TimeTicks reference_time,
|
| + base::TimeDelta timestamp);
|
| void SetErrorState(const tracked_objects::Location& from_here,
|
| const std::string& reason);
|
|
|
| + VideoCaptureFormat capture_format_;
|
| + // Java VideoCaptureAndroid instance.
|
| + base::android::ScopedJavaLocalRef<jobject> j_capture_;
|
| +
|
| + // |lock_| protects |state_|, |client_|, |got_first_frame_| and
|
| + // |photo_requests_queue_| from concurrent access.
|
| + base::Lock lock_;
|
| + InternalState state_ = kIdle;
|
| + std::unique_ptr<VideoCaptureDevice::Client> client_;
|
| + bool got_first_frame_ = false;
|
| + base::TimeDelta frame_interval_;
|
| +
|
| + private:
|
| + VideoPixelFormat GetColorspace();
|
| void DoGetPhotoState(GetPhotoStateCallback callback);
|
| void DoSetPhotoOptions(mojom::PhotoSettingsPtr settings,
|
| SetPhotoOptionsCallback callback);
|
| @@ -125,28 +153,17 @@ class CAPTURE_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice {
|
| // Thread on which we are created.
|
| const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
|
|
|
| - // |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::TimeDelta frame_interval_;
|
|
|
| // List of |photo_callbacks_| in flight, being served in Java side.
|
| base::Lock photo_callbacks_lock_;
|
| std::list<std::unique_ptr<TakePhotoCallback>> photo_callbacks_;
|
|
|
| const VideoCaptureDeviceDescriptor device_descriptor_;
|
| - VideoCaptureFormat capture_format_;
|
| -
|
| - // Java VideoCaptureAndroid instance.
|
| - base::android::ScopedJavaLocalRef<jobject> j_capture_;
|
|
|
| base::WeakPtrFactory<VideoCaptureDeviceAndroid> weak_ptr_factory_;
|
|
|
|
|