| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
| 6 #define MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 6 #define MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "base/threading/thread_checker.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "media/capture/capture_export.h" | 17 #include "media/capture/capture_export.h" |
| 17 #include "media/capture/video/video_capture_device.h" | 18 #include "media/capture/video/video_capture_device.h" |
| 18 | 19 |
| 19 namespace tracked_objects { | 20 namespace tracked_objects { |
| 20 class Location; | 21 class Location; |
| 21 } // namespace tracked_ | 22 } // namespace tracked_ |
| 22 | 23 |
| 23 namespace media { | 24 namespace media { |
| 24 | 25 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 enum InternalState { | 97 enum InternalState { |
| 97 kIdle, // The device is opened but not in use. | 98 kIdle, // The device is opened but not in use. |
| 98 kCapturing, // Video is being captured. | 99 kCapturing, // Video is being captured. |
| 99 kError // Hit error. User needs to recover by destroying the object. | 100 kError // Hit error. User needs to recover by destroying the object. |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 VideoPixelFormat GetColorspace(); | 103 VideoPixelFormat GetColorspace(); |
| 103 void SetErrorState(const tracked_objects::Location& from_here, | 104 void SetErrorState(const tracked_objects::Location& from_here, |
| 104 const std::string& reason); | 105 const std::string& reason); |
| 105 | 106 |
| 107 base::ThreadChecker thread_checker_; |
| 108 |
| 106 // Prevent racing on accessing |state_| and |client_| since both could be | 109 // Prevent racing on accessing |state_| and |client_| since both could be |
| 107 // accessed from different threads. | 110 // accessed from different threads. |
| 108 base::Lock lock_; | 111 base::Lock lock_; |
| 109 InternalState state_; | 112 InternalState state_; |
| 113 std::unique_ptr<VideoCaptureDevice::Client> client_; |
| 114 |
| 110 bool got_first_frame_; | 115 bool got_first_frame_; |
| 111 base::TimeTicks expected_next_frame_time_; | 116 base::TimeTicks expected_next_frame_time_; |
| 112 base::TimeTicks first_ref_time_; | 117 base::TimeTicks first_ref_time_; |
| 113 base::TimeDelta frame_interval_; | 118 base::TimeDelta frame_interval_; |
| 114 std::unique_ptr<VideoCaptureDevice::Client> client_; | |
| 115 | 119 |
| 116 // List of |photo_callbacks_| in flight, being served in Java side. | 120 // List of |photo_callbacks_| in flight, being served in Java side. |
| 117 base::Lock photo_callbacks_lock_; | 121 base::Lock photo_callbacks_lock_; |
| 118 std::list<std::unique_ptr<TakePhotoCallback>> photo_callbacks_; | 122 std::list<std::unique_ptr<TakePhotoCallback>> photo_callbacks_; |
| 119 | 123 |
| 120 gfx::Size next_photo_resolution_; | 124 gfx::Size next_photo_resolution_; |
| 121 | 125 |
| 122 Name device_name_; | 126 Name device_name_; |
| 123 VideoCaptureFormat capture_format_; | 127 VideoCaptureFormat capture_format_; |
| 124 | 128 |
| 125 // Java VideoCaptureAndroid instance. | 129 // Java VideoCaptureAndroid instance. |
| 126 base::android::ScopedJavaLocalRef<jobject> j_capture_; | 130 base::android::ScopedJavaLocalRef<jobject> j_capture_; |
| 127 | 131 |
| 128 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | 132 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
| 129 }; | 133 }; |
| 130 | 134 |
| 131 } // namespace media | 135 } // namespace media |
| 132 | 136 |
| 133 #endif // MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 137 #endif // MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
| OLD | NEW |