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

Unified Diff: webrtc/api/java/jni/androidvideocapturer_jni.cc

Issue 2066773002: Android: Add Size 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/java/jni/androidvideocapturer_jni.cc
diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.cc b/webrtc/api/java/jni/androidvideocapturer_jni.cc
index 4f3d64b97aa98dbbdcce92374865b0e4e0a427a5..a11df6ab320049fe4498c3b553f5095a2ee10e64 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc
@@ -132,17 +132,23 @@ AndroidVideoCapturerJni::GetSupportedFormats() {
jclass j_list_class = jni->FindClass("java/util/List");
jclass j_format_class =
jni->FindClass("org/webrtc/CameraEnumerationAndroid$CaptureFormat");
+ jclass j_size_class =
+ jni->FindClass("org/webrtc/CameraEnumerationAndroid$CaptureFormat$Size");
jclass j_framerate_class = jni->FindClass(
"org/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange");
+
const int size = jni->CallIntMethod(
j_list_of_formats, GetMethodID(jni, j_list_class, "size", "()I"));
jmethodID j_get =
GetMethodID(jni, j_list_class, "get", "(I)Ljava/lang/Object;");
+ jfieldID j_size_field =
+ GetFieldID(jni, j_format_class, "size",
+ "org/webrtc/CameraEnumerationAndroid$CaptureFormat$Size");
jfieldID j_framerate_field = GetFieldID(
jni, j_format_class, "framerate",
- "Lorg/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange;");
- jfieldID j_width_field = GetFieldID(jni, j_format_class, "width", "I");
- jfieldID j_height_field = GetFieldID(jni, j_format_class, "height", "I");
+ "org/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange");
+ jfieldID j_width_field = GetFieldID(jni, j_size_class, "width", "I");
+ jfieldID j_height_field = GetFieldID(jni, j_size_class, "height", "I");
jfieldID j_max_framerate_field =
GetFieldID(jni, j_framerate_class, "max", "I");
@@ -150,11 +156,12 @@ AndroidVideoCapturerJni::GetSupportedFormats() {
formats.reserve(size);
for (int i = 0; i < size; ++i) {
jobject j_format = jni->CallObjectMethod(j_list_of_formats, j_get, i);
+ jobject j_size = GetObjectField(jni, j_format, j_size_field);
jobject j_framerate = GetObjectField(jni, j_format, j_framerate_field);
const int frame_interval = cricket::VideoFormat::FpsToInterval(
(GetIntField(jni, j_framerate, j_max_framerate_field) + 999) / 1000);
- formats.emplace_back(GetIntField(jni, j_format, j_width_field),
- GetIntField(jni, j_format, j_height_field),
+ formats.emplace_back(GetIntField(jni, j_size, j_height_field),
+ GetIntField(jni, j_size, j_height_field),
frame_interval, cricket::FOURCC_NV21);
}
CHECK_EXCEPTION(jni) << "error while extracting formats";

Powered by Google App Engine
This is Rietveld 408576698