Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: webrtc/api/java/jni/androidvideocapturer_jni.cc

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing one more place where RTC_FROM_HERE wasn't used. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_, 101 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_,
102 "stopCapture", "()V"); 102 "stopCapture", "()V");
103 jni()->CallVoidMethod(*j_video_capturer_, m); 103 jni()->CallVoidMethod(*j_video_capturer_, m);
104 CHECK_EXCEPTION(jni()) << "error during VideoCapturer.stopCapture"; 104 CHECK_EXCEPTION(jni()) << "error during VideoCapturer.stopCapture";
105 LOG(LS_INFO) << "AndroidVideoCapturerJni stop done"; 105 LOG(LS_INFO) << "AndroidVideoCapturerJni stop done";
106 } 106 }
107 107
108 template <typename... Args> 108 template <typename... Args>
109 void AndroidVideoCapturerJni::AsyncCapturerInvoke( 109 void AndroidVideoCapturerJni::AsyncCapturerInvoke(
110 const char* method_name, 110 const rtc::Location& posted_from,
111 void (webrtc::AndroidVideoCapturer::*method)(Args...), 111 void (webrtc::AndroidVideoCapturer::*method)(Args...),
112 typename Identity<Args>::type... args) { 112 typename Identity<Args>::type... args) {
113 rtc::CritScope cs(&capturer_lock_); 113 rtc::CritScope cs(&capturer_lock_);
114 if (!invoker_) { 114 if (!invoker_) {
115 LOG(LS_WARNING) << method_name << "() called for closed capturer."; 115 LOG(LS_WARNING) << posted_from.function_name()
116 << "() called for closed capturer.";
116 return; 117 return;
117 } 118 }
118 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...)); 119 invoker_->AsyncInvoke<void>(posted_from,
120 rtc::Bind(method, capturer_, args...));
119 } 121 }
120 122
121 std::vector<cricket::VideoFormat> 123 std::vector<cricket::VideoFormat>
122 AndroidVideoCapturerJni::GetSupportedFormats() { 124 AndroidVideoCapturerJni::GetSupportedFormats() {
123 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 125 JNIEnv* jni = AttachCurrentThreadIfNeeded();
124 jobject j_list_of_formats = jni->CallObjectMethod( 126 jobject j_list_of_formats = jni->CallObjectMethod(
125 *j_video_capturer_, 127 *j_video_capturer_,
126 GetMethodID(jni, *j_video_capturer_class_, "getSupportedFormats", 128 GetMethodID(jni, *j_video_capturer_class_, "getSupportedFormats",
127 "()Ljava/util/List;")); 129 "()Ljava/util/List;"));
128 CHECK_EXCEPTION(jni) << "error during getSupportedFormats"; 130 CHECK_EXCEPTION(jni) << "error during getSupportedFormats";
(...skipping 26 matching lines...) Expand all
155 formats.emplace_back(GetIntField(jni, j_format, j_width_field), 157 formats.emplace_back(GetIntField(jni, j_format, j_width_field),
156 GetIntField(jni, j_format, j_height_field), 158 GetIntField(jni, j_format, j_height_field),
157 frame_interval, cricket::FOURCC_NV21); 159 frame_interval, cricket::FOURCC_NV21);
158 } 160 }
159 CHECK_EXCEPTION(jni) << "error while extracting formats"; 161 CHECK_EXCEPTION(jni) << "error while extracting formats";
160 return formats; 162 return formats;
161 } 163 }
162 164
163 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) { 165 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) {
164 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success; 166 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success;
165 AsyncCapturerInvoke("OnCapturerStarted", 167 AsyncCapturerInvoke(
166 &webrtc::AndroidVideoCapturer::OnCapturerStarted, 168 RTC_FROM_HERE, &webrtc::AndroidVideoCapturer::OnCapturerStarted, success);
167 success);
168 } 169 }
169 170
170 void AndroidVideoCapturerJni::OnMemoryBufferFrame(void* video_frame, 171 void AndroidVideoCapturerJni::OnMemoryBufferFrame(void* video_frame,
171 int length, 172 int length,
172 int width, 173 int width,
173 int height, 174 int height,
174 int rotation, 175 int rotation,
175 int64_t timestamp_ns) { 176 int64_t timestamp_ns) {
176 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || 177 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 ||
177 rotation == 270); 178 rotation == 270);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 NativeHandleImpl(handle.oes_texture_id, matrix)), 302 NativeHandleImpl(handle.oes_texture_id, matrix)),
302 timestamp_ns, capturer_->apply_rotation() 303 timestamp_ns, capturer_->apply_rotation()
303 ? webrtc::kVideoRotation_0 304 ? webrtc::kVideoRotation_0
304 : static_cast<webrtc::VideoRotation>(rotation)), 305 : static_cast<webrtc::VideoRotation>(rotation)),
305 width, height); 306 width, height);
306 } 307 }
307 308
308 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, 309 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width,
309 int height, 310 int height,
310 int fps) { 311 int fps) {
311 AsyncCapturerInvoke("OnOutputFormatRequest", 312 AsyncCapturerInvoke(RTC_FROM_HERE,
312 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, 313 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest,
313 width, height, fps); 314 width, height, fps);
314 } 315 }
315 316
316 JNIEnv* AndroidVideoCapturerJni::jni() { return AttachCurrentThreadIfNeeded(); } 317 JNIEnv* AndroidVideoCapturerJni::jni() { return AttachCurrentThreadIfNeeded(); }
317 318
318 JOW(void, 319 JOW(void,
319 VideoCapturer_00024NativeObserver_nativeOnByteBufferFrameCaptured) 320 VideoCapturer_00024NativeObserver_nativeOnByteBufferFrameCaptured)
320 (JNIEnv* jni, jclass, jlong j_capturer, jbyteArray j_frame, jint length, 321 (JNIEnv* jni, jclass, jlong j_capturer, jbyteArray j_frame, jint length,
321 jint width, jint height, jint rotation, jlong timestamp) { 322 jint width, jint height, jint rotation, jlong timestamp) {
(...skipping 23 matching lines...) Expand all
345 346
346 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) 347 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest)
347 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, 348 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height,
348 jint j_fps) { 349 jint j_fps) {
349 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; 350 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest";
350 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( 351 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest(
351 j_width, j_height, j_fps); 352 j_width, j_height, j_fps);
352 } 353 }
353 354
354 } // namespace webrtc_jni 355 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/java/jni/androidvideocapturer_jni.h ('k') | webrtc/api/java/jni/peerconnection_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698