OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // To avoid deducing Args from the 3rd parameter of AsyncCapturerInvoke. | 61 // To avoid deducing Args from the 3rd parameter of AsyncCapturerInvoke. |
62 template <typename T> | 62 template <typename T> |
63 struct Identity { | 63 struct Identity { |
64 typedef T type; | 64 typedef T type; |
65 }; | 65 }; |
66 | 66 |
67 // Helper function to make safe asynchronous calls to |capturer_|. The calls | 67 // Helper function to make safe asynchronous calls to |capturer_|. The calls |
68 // are not guaranteed to be delivered. | 68 // are not guaranteed to be delivered. |
69 template <typename... Args> | 69 template <typename... Args> |
70 void AsyncCapturerInvoke( | 70 void AsyncCapturerInvoke( |
71 const char* method_name, | 71 const rtc::Location& posted_from, |
72 void (webrtc::AndroidVideoCapturer::*method)(Args...), | 72 void (webrtc::AndroidVideoCapturer::*method)(Args...), |
73 typename Identity<Args>::type... args); | 73 typename Identity<Args>::type... args); |
74 | 74 |
75 const ScopedGlobalRef<jobject> j_video_capturer_; | 75 const ScopedGlobalRef<jobject> j_video_capturer_; |
76 const ScopedGlobalRef<jclass> j_video_capturer_class_; | 76 const ScopedGlobalRef<jclass> j_video_capturer_class_; |
77 const ScopedGlobalRef<jclass> j_observer_class_; | 77 const ScopedGlobalRef<jclass> j_observer_class_; |
78 | 78 |
79 // Used on the Java thread running the camera. | 79 // Used on the Java thread running the camera. |
80 webrtc::I420BufferPool buffer_pool_; | 80 webrtc::I420BufferPool buffer_pool_; |
81 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper_; | 81 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper_; |
82 rtc::ThreadChecker thread_checker_; | 82 rtc::ThreadChecker thread_checker_; |
83 | 83 |
84 // |capturer| is a guaranteed to be a valid pointer between a call to | 84 // |capturer| is a guaranteed to be a valid pointer between a call to |
85 // AndroidVideoCapturerDelegate::Start | 85 // AndroidVideoCapturerDelegate::Start |
86 // until AndroidVideoCapturerDelegate::Stop. | 86 // until AndroidVideoCapturerDelegate::Stop. |
87 rtc::CriticalSection capturer_lock_; | 87 rtc::CriticalSection capturer_lock_; |
88 webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_); | 88 webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_); |
89 // |invoker_| is used to communicate with |capturer_| on the thread Start() is | 89 // |invoker_| is used to communicate with |capturer_| on the thread Start() is |
90 // called on. | 90 // called on. |
91 std::unique_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); | 91 std::unique_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); |
92 | 92 |
93 static jobject application_context_; | 93 static jobject application_context_; |
94 | 94 |
95 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); | 95 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace webrtc_jni | 98 } // namespace webrtc_jni |
99 | 99 |
100 #endif // WEBRTC_API_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ | 100 #endif // WEBRTC_API_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ |
OLD | NEW |