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

Side by Side Diff: talk/app/webrtc/java/jni/androidvideocapturer_jni.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + compile Created 5 years, 2 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 * 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void (webrtc::AndroidVideoCapturer::*method)(Args...), 145 void (webrtc::AndroidVideoCapturer::*method)(Args...),
146 Args... args) { 146 Args... args) {
147 rtc::CritScope cs(&capturer_lock_); 147 rtc::CritScope cs(&capturer_lock_);
148 if (!invoker_) { 148 if (!invoker_) {
149 LOG(LS_WARNING) << method_name << "() called for closed capturer."; 149 LOG(LS_WARNING) << method_name << "() called for closed capturer.";
150 return; 150 return;
151 } 151 }
152 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...)); 152 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...));
153 } 153 }
154 154
155 void AndroidVideoCapturerJni::ReturnBuffer(int64 time_stamp) { 155 void AndroidVideoCapturerJni::ReturnBuffer(int64_t time_stamp) {
156 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_, 156 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_,
157 "returnBuffer", "(J)V"); 157 "returnBuffer", "(J)V");
158 jni()->CallVoidMethod(*j_capturer_global_, m, time_stamp); 158 jni()->CallVoidMethod(*j_capturer_global_, m, time_stamp);
159 CHECK_EXCEPTION(jni()) << "error during VideoCapturerAndroid.returnBuffer"; 159 CHECK_EXCEPTION(jni()) << "error during VideoCapturerAndroid.returnBuffer";
160 } 160 }
161 161
162 std::string AndroidVideoCapturerJni::GetSupportedFormats() { 162 std::string AndroidVideoCapturerJni::GetSupportedFormats() {
163 jmethodID m = 163 jmethodID m =
164 GetMethodID(jni(), *j_video_capturer_class_, 164 GetMethodID(jni(), *j_video_capturer_class_,
165 "getSupportedFormatsAsJson", "()Ljava/lang/String;"); 165 "getSupportedFormatsAsJson", "()Ljava/lang/String;");
166 jstring j_json_caps = 166 jstring j_json_caps =
167 (jstring) jni()->CallObjectMethod(*j_capturer_global_, m); 167 (jstring) jni()->CallObjectMethod(*j_capturer_global_, m);
168 CHECK_EXCEPTION(jni()) << "error during supportedFormatsAsJson"; 168 CHECK_EXCEPTION(jni()) << "error during supportedFormatsAsJson";
169 return JavaToStdString(jni(), j_json_caps); 169 return JavaToStdString(jni(), j_json_caps);
170 } 170 }
171 171
172 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) { 172 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) {
173 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success; 173 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success;
174 AsyncCapturerInvoke("OnCapturerStarted", 174 AsyncCapturerInvoke("OnCapturerStarted",
175 &webrtc::AndroidVideoCapturer::OnCapturerStarted, 175 &webrtc::AndroidVideoCapturer::OnCapturerStarted,
176 success); 176 success);
177 } 177 }
178 178
179 void AndroidVideoCapturerJni::OnIncomingFrame(void* video_frame, 179 void AndroidVideoCapturerJni::OnIncomingFrame(void* video_frame,
180 int length, 180 int length,
181 int width, 181 int width,
182 int height, 182 int height,
183 int rotation, 183 int rotation,
184 int64 time_stamp) { 184 int64_t time_stamp) {
185 const uint8_t* y_plane = static_cast<uint8_t*>(video_frame); 185 const uint8_t* y_plane = static_cast<uint8_t*>(video_frame);
186 // Android guarantees that the stride is a multiple of 16. 186 // Android guarantees that the stride is a multiple of 16.
187 // http://developer.android.com/reference/android/hardware/Camera.Parameters.h tml#setPreviewFormat%28int%29 187 // http://developer.android.com/reference/android/hardware/Camera.Parameters.h tml#setPreviewFormat%28int%29
188 int y_stride; 188 int y_stride;
189 int uv_stride; 189 int uv_stride;
190 webrtc::Calc16ByteAlignedStride(width, &y_stride, &uv_stride); 190 webrtc::Calc16ByteAlignedStride(width, &y_stride, &uv_stride);
191 const uint8_t* v_plane = y_plane + y_stride * height; 191 const uint8_t* v_plane = y_plane + y_stride * height;
192 const uint8_t* u_plane = 192 const uint8_t* u_plane =
193 v_plane + uv_stride * webrtc::AlignInt(height, 2) / 2; 193 v_plane + uv_stride * webrtc::AlignInt(height, 2) / 2;
194 194
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest) 241 JOW(void, VideoCapturerAndroid_00024NativeObserver_nativeOnOutputFormatRequest)
242 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, 242 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height,
243 jint j_fps) { 243 jint j_fps) {
244 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; 244 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest";
245 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( 245 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest(
246 j_width, j_height, j_fps); 246 j_width, j_height, j_fps);
247 } 247 }
248 248
249 } // namespace webrtc_jni 249 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698