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

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

Issue 2024573002: Revert of Android: Add FramerateRange class (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 jobject j_list_of_formats = jni->CallObjectMethod( 127 jobject j_list_of_formats = jni->CallObjectMethod(
128 *j_video_capturer_, 128 *j_video_capturer_,
129 GetMethodID(jni, *j_video_capturer_class_, "getSupportedFormats", 129 GetMethodID(jni, *j_video_capturer_class_, "getSupportedFormats",
130 "()Ljava/util/List;")); 130 "()Ljava/util/List;"));
131 CHECK_EXCEPTION(jni) << "error during getSupportedFormats"; 131 CHECK_EXCEPTION(jni) << "error during getSupportedFormats";
132 132
133 // Extract Java List<CaptureFormat> to std::vector<cricket::VideoFormat>. 133 // Extract Java List<CaptureFormat> to std::vector<cricket::VideoFormat>.
134 jclass j_list_class = jni->FindClass("java/util/List"); 134 jclass j_list_class = jni->FindClass("java/util/List");
135 jclass j_format_class = 135 jclass j_format_class =
136 jni->FindClass("org/webrtc/CameraEnumerationAndroid$CaptureFormat"); 136 jni->FindClass("org/webrtc/CameraEnumerationAndroid$CaptureFormat");
137 jclass j_framerate_class = jni->FindClass(
138 "org/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange");
139 const int size = jni->CallIntMethod( 137 const int size = jni->CallIntMethod(
140 j_list_of_formats, GetMethodID(jni, j_list_class, "size", "()I")); 138 j_list_of_formats, GetMethodID(jni, j_list_class, "size", "()I"));
141 jmethodID j_get = 139 jmethodID j_get =
142 GetMethodID(jni, j_list_class, "get", "(I)Ljava/lang/Object;"); 140 GetMethodID(jni, j_list_class, "get", "(I)Ljava/lang/Object;");
143 jfieldID j_framerate_field = GetFieldID(
144 jni, j_format_class, "framerate",
145 "org/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange");
146 jfieldID j_width_field = GetFieldID(jni, j_format_class, "width", "I"); 141 jfieldID j_width_field = GetFieldID(jni, j_format_class, "width", "I");
147 jfieldID j_height_field = GetFieldID(jni, j_format_class, "height", "I"); 142 jfieldID j_height_field = GetFieldID(jni, j_format_class, "height", "I");
148 jfieldID j_max_framerate_field = 143 jfieldID j_max_framerate_field =
149 GetFieldID(jni, j_framerate_class, "max", "I"); 144 GetFieldID(jni, j_format_class, "maxFramerate", "I");
150 145
151 std::vector<cricket::VideoFormat> formats; 146 std::vector<cricket::VideoFormat> formats;
152 formats.reserve(size); 147 formats.reserve(size);
153 for (int i = 0; i < size; ++i) { 148 for (int i = 0; i < size; ++i) {
154 jobject j_format = jni->CallObjectMethod(j_list_of_formats, j_get, i); 149 jobject j_format = jni->CallObjectMethod(j_list_of_formats, j_get, i);
155 jobject j_framerate = GetObjectField(jni, j_format, j_framerate_field);
156 const int frame_interval = cricket::VideoFormat::FpsToInterval( 150 const int frame_interval = cricket::VideoFormat::FpsToInterval(
157 (GetIntField(jni, j_framerate, j_max_framerate_field) + 999) / 1000); 151 (GetIntField(jni, j_format, j_max_framerate_field) + 999) / 1000);
158 formats.emplace_back(GetIntField(jni, j_format, j_width_field), 152 formats.emplace_back(GetIntField(jni, j_format, j_width_field),
159 GetIntField(jni, j_format, j_height_field), 153 GetIntField(jni, j_format, j_height_field),
160 frame_interval, cricket::FOURCC_NV21); 154 frame_interval, cricket::FOURCC_NV21);
161 } 155 }
162 CHECK_EXCEPTION(jni) << "error while extracting formats"; 156 CHECK_EXCEPTION(jni) << "error while extracting formats";
163 return formats; 157 return formats;
164 } 158 }
165 159
166 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) { 160 void AndroidVideoCapturerJni::OnCapturerStarted(bool success) {
167 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success; 161 LOG(LS_INFO) << "AndroidVideoCapturerJni capture started: " << success;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 334
341 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) 335 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest)
342 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, 336 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height,
343 jint j_fps) { 337 jint j_fps) {
344 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; 338 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest";
345 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( 339 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest(
346 j_width, j_height, j_fps); 340 j_width, j_height, j_fps);
347 } 341 }
348 342
349 } // namespace webrtc_jni 343 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698