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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 "stopCapture", "()V"); | 111 "stopCapture", "()V"); |
112 jni()->CallVoidMethod(*j_capturer_global_, m); | 112 jni()->CallVoidMethod(*j_capturer_global_, m); |
113 CHECK_EXCEPTION(jni()) << "error during VideoCapturerAndroid.stopCapture"; | 113 CHECK_EXCEPTION(jni()) << "error during VideoCapturerAndroid.stopCapture"; |
114 LOG(LS_INFO) << "AndroidVideoCapturerJni stop done"; | 114 LOG(LS_INFO) << "AndroidVideoCapturerJni stop done"; |
115 } | 115 } |
116 | 116 |
117 template <typename... Args> | 117 template <typename... Args> |
118 void AndroidVideoCapturerJni::AsyncCapturerInvoke( | 118 void AndroidVideoCapturerJni::AsyncCapturerInvoke( |
119 const char* method_name, | 119 const char* method_name, |
120 void (webrtc::AndroidVideoCapturer::*method)(Args...), | 120 void (webrtc::AndroidVideoCapturer::*method)(Args...), |
121 Args... args) { | 121 typename Identity<Args>::type... args) { |
122 rtc::CritScope cs(&capturer_lock_); | 122 rtc::CritScope cs(&capturer_lock_); |
123 if (!invoker_) { | 123 if (!invoker_) { |
124 LOG(LS_WARNING) << method_name << "() called for closed capturer."; | 124 LOG(LS_WARNING) << method_name << "() called for closed capturer."; |
125 return; | 125 return; |
126 } | 126 } |
127 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...)); | 127 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...)); |
128 } | 128 } |
129 | 129 |
130 void AndroidVideoCapturerJni::ReturnBuffer(int64_t time_stamp) { | 130 void AndroidVideoCapturerJni::ReturnBuffer(int64_t time_stamp) { |
131 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_, | 131 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 (JNIEnv* jni, jclass, jobject j_video_capturer) { | 257 (JNIEnv* jni, jclass, jobject j_video_capturer) { |
258 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 258 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
259 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); | 259 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); |
260 rtc::scoped_ptr<cricket::VideoCapturer> capturer( | 260 rtc::scoped_ptr<cricket::VideoCapturer> capturer( |
261 new webrtc::AndroidVideoCapturer(delegate)); | 261 new webrtc::AndroidVideoCapturer(delegate)); |
262 // Caller takes ownership of the cricket::VideoCapturer* pointer. | 262 // Caller takes ownership of the cricket::VideoCapturer* pointer. |
263 return jlongFromPointer(capturer.release()); | 263 return jlongFromPointer(capturer.release()); |
264 } | 264 } |
265 | 265 |
266 } // namespace webrtc_jni | 266 } // namespace webrtc_jni |
OLD | NEW |