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

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

Issue 2013433003: WIP: Android Camera2 capture implementation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix CaptureFormat jni parsing Created 4 years, 7 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 5b4a92c6e872e84f06229af8dbf296044cd26d0d..a6c939215cf24fdeb0f0703916aa66d4c501d4b1 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc
@@ -133,23 +133,36 @@ 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_width_field = GetFieldID(jni, j_format_class, "width", "I");
- jfieldID j_height_field = GetFieldID(jni, j_format_class, "height", "I");
+ 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",
+ "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_format_class, "maxFramerate", "I");
+ GetFieldID(jni, j_framerate_class, "max", "I");
std::vector<cricket::VideoFormat> formats;
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_format, j_max_framerate_field) + 999) / 1000);
- formats.emplace_back(GetIntField(jni, j_format, j_width_field),
- GetIntField(jni, j_format, j_height_field),
+ (GetIntField(jni, j_framerate, j_max_framerate_field) + 999) / 1000);
+ 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";
« no previous file with comments | « webrtc/api/java/android/org/webrtc/VideoCapturerAndroid2.java ('k') | webrtc/api/java/jni/classreferenceholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698