OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 const NativeTextureHandleImpl& handle); | 64 const NativeTextureHandleImpl& handle); |
65 void OnOutputFormatRequest(int width, int height, int fps); | 65 void OnOutputFormatRequest(int width, int height, int fps); |
66 | 66 |
67 protected: | 67 protected: |
68 ~AndroidVideoCapturerJni(); | 68 ~AndroidVideoCapturerJni(); |
69 | 69 |
70 private: | 70 private: |
71 void ReturnBuffer(int64_t time_stamp); | 71 void ReturnBuffer(int64_t time_stamp); |
72 JNIEnv* jni(); | 72 JNIEnv* jni(); |
73 | 73 |
74 // To avoid deducing Args from the 3rd parameter of AsyncCapturerInvoke | |
75 template <typename T> struct Identity { typedef T type; }; | |
magjed_webrtc
2015/10/20 13:06:23
It this necessary to make it compile now?
nit: Rem
| |
76 | |
74 // Helper function to make safe asynchronous calls to |capturer_|. The calls | 77 // Helper function to make safe asynchronous calls to |capturer_|. The calls |
75 // are not guaranteed to be delivered. | 78 // are not guaranteed to be delivered. |
76 template <typename... Args> | 79 template <typename... Args> |
77 void AsyncCapturerInvoke( | 80 void AsyncCapturerInvoke( |
78 const char* method_name, | 81 const char* method_name, |
79 void (webrtc::AndroidVideoCapturer::*method)(Args...), | 82 void (webrtc::AndroidVideoCapturer::*method)(Args...), |
80 Args... args); | 83 typename Identity<Args>::type... args); |
81 | 84 |
82 const ScopedGlobalRef<jobject> j_capturer_global_; | 85 const ScopedGlobalRef<jobject> j_capturer_global_; |
83 const ScopedGlobalRef<jclass> j_video_capturer_class_; | 86 const ScopedGlobalRef<jclass> j_video_capturer_class_; |
84 const ScopedGlobalRef<jclass> j_observer_class_; | 87 const ScopedGlobalRef<jclass> j_observer_class_; |
85 | 88 |
86 rtc::ThreadChecker thread_checker_; | 89 rtc::ThreadChecker thread_checker_; |
87 | 90 |
88 // |capturer| is a guaranteed to be a valid pointer between a call to | 91 // |capturer| is a guaranteed to be a valid pointer between a call to |
89 // AndroidVideoCapturerDelegate::Start | 92 // AndroidVideoCapturerDelegate::Start |
90 // until AndroidVideoCapturerDelegate::Stop. | 93 // until AndroidVideoCapturerDelegate::Stop. |
91 rtc::CriticalSection capturer_lock_; | 94 rtc::CriticalSection capturer_lock_; |
92 webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_); | 95 webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_); |
93 // |invoker_| is used to communicate with |capturer_| on the thread Start() is | 96 // |invoker_| is used to communicate with |capturer_| on the thread Start() is |
94 // called on. | 97 // called on. |
95 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); | 98 rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_); |
96 | 99 |
97 static jobject application_context_; | 100 static jobject application_context_; |
98 | 101 |
99 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); | 102 RTC_DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); |
100 }; | 103 }; |
101 | 104 |
102 } // namespace webrtc_jni | 105 } // namespace webrtc_jni |
103 | 106 |
104 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ | 107 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ |
OLD | NEW |