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

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 + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void (webrtc::AndroidVideoCapturer::*method)(Args...), 119 void (webrtc::AndroidVideoCapturer::*method)(Args...),
120 Args... args) { 120 Args... args) {
121 rtc::CritScope cs(&capturer_lock_); 121 rtc::CritScope cs(&capturer_lock_);
122 if (!invoker_) { 122 if (!invoker_) {
123 LOG(LS_WARNING) << method_name << "() called for closed capturer."; 123 LOG(LS_WARNING) << method_name << "() called for closed capturer.";
124 return; 124 return;
125 } 125 }
126 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...)); 126 invoker_->AsyncInvoke<void>(rtc::Bind(method, capturer_, args...));
127 } 127 }
128 128
129 void AndroidVideoCapturerJni::ReturnBuffer(int64 time_stamp) { 129 void AndroidVideoCapturerJni::ReturnBuffer(int64_t time_stamp) {
130 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_, 130 jmethodID m = GetMethodID(jni(), *j_video_capturer_class_,
131 "returnBuffer", "(J)V"); 131 "returnBuffer", "(J)V");
132 jni()->CallVoidMethod(*j_capturer_global_, m, time_stamp); 132 jni()->CallVoidMethod(*j_capturer_global_, m, time_stamp);
133 CHECK_EXCEPTION(jni()) << "error during VideoCapturerAndroid.returnBuffer"; 133 CHECK_EXCEPTION(jni()) << "error during VideoCapturerAndroid.returnBuffer";
134 } 134 }
135 135
136 std::string AndroidVideoCapturerJni::GetSupportedFormats() { 136 std::string AndroidVideoCapturerJni::GetSupportedFormats() {
137 jmethodID m = 137 jmethodID m =
138 GetMethodID(jni(), *j_video_capturer_class_, 138 GetMethodID(jni(), *j_video_capturer_class_,
139 "getSupportedFormatsAsJson", "()Ljava/lang/String;"); 139 "getSupportedFormatsAsJson", "()Ljava/lang/String;");
140 jstring j_json_caps = 140 jstring j_json_caps =
141 (jstring) jni()->CallObjectMethod(*j_capturer_global_, m); 141 (jstring) jni()->CallObjectMethod(*j_capturer_global_, m);
142 CHECK_EXCEPTION(jni()) << "error during supportedFormatsAsJson"; 142 CHECK_EXCEPTION(jni()) << "error during supportedFormatsAsJson";
143 return JavaToStdString(jni(), j_json_caps); 143 return JavaToStdString(jni(), j_json_caps);
144 } 144 }
145 145
146 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) { 146 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) {
147 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success; 147 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success;
148 AsyncCapturerInvoke("OnCapturerStarted", 148 AsyncCapturerInvoke("OnCapturerStarted",
149 &webrtc::AndroidVideoCapturer::OnCapturerStarted, 149 &webrtc::AndroidVideoCapturer::OnCapturerStarted,
150 success); 150 success);
151 } 151 }
152 152
153 void AndroidVideoCapturerJni::OnIncomingFrame(void* video_frame, 153 void AndroidVideoCapturerJni::OnIncomingFrame(void* video_frame,
154 int length, 154 int length,
155 int width, 155 int width,
156 int height, 156 int height,
157 int rotation, 157 int rotation,
158 int64 time_stamp) { 158 int64_t time_stamp) {
159 const uint8_t* y_plane = static_cast<uint8_t*>(video_frame); 159 const uint8_t* y_plane = static_cast<uint8_t*>(video_frame);
160 // Android guarantees that the stride is a multiple of 16. 160 // Android guarantees that the stride is a multiple of 16.
161 // http://developer.android.com/reference/android/hardware/Camera.Parameters.h tml#setPreviewFormat%28int%29 161 // http://developer.android.com/reference/android/hardware/Camera.Parameters.h tml#setPreviewFormat%28int%29
162 int y_stride; 162 int y_stride;
163 int uv_stride; 163 int uv_stride;
164 webrtc::Calc16ByteAlignedStride(width, &y_stride, &uv_stride); 164 webrtc::Calc16ByteAlignedStride(width, &y_stride, &uv_stride);
165 const uint8_t* v_plane = y_plane + y_stride * height; 165 const uint8_t* v_plane = y_plane + y_stride * height;
166 const uint8_t* u_plane = 166 const uint8_t* u_plane =
167 v_plane + uv_stride * webrtc::AlignInt(height, 2) / 2; 167 v_plane + uv_stride * webrtc::AlignInt(height, 2) / 2;
168 168
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 (JNIEnv* jni, jclass, jobject j_video_capturer) { 224 (JNIEnv* jni, jclass, jobject j_video_capturer) {
225 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = 225 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
226 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer); 226 new rtc::RefCountedObject<AndroidVideoCapturerJni>(jni, j_video_capturer);
227 rtc::scoped_ptr<cricket::VideoCapturer> capturer( 227 rtc::scoped_ptr<cricket::VideoCapturer> capturer(
228 new webrtc::AndroidVideoCapturer(delegate)); 228 new webrtc::AndroidVideoCapturer(delegate));
229 // Caller takes ownership of the cricket::VideoCapturer* pointer. 229 // Caller takes ownership of the cricket::VideoCapturer* pointer.
230 return jlongFromPointer(capturer.release()); 230 return jlongFromPointer(capturer.release());
231 } 231 }
232 232
233 } // namespace webrtc_jni 233 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/androidvideocapturer_jni.h ('k') | talk/app/webrtc/java/jni/peerconnection_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698