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

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

Powered by Google App Engine
This is Rietveld 408576698