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

Side by Side Diff: webrtc/sdk/android/src/jni/pc/mediaconstraints_jni.cc

Issue 2989323002: Revert of Break peerconnection_jni.cc into multiple files, in "pc" directory. (Closed)
Patch Set: Created 3 years, 4 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
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/sdk/android/src/jni/pc/mediaconstraints_jni.h"
12
13 namespace webrtc_jni {
14
15 MediaConstraintsJni::MediaConstraintsJni(JNIEnv* jni, jobject j_constraints) {
16 PopulateConstraintsFromJavaPairList(jni, j_constraints, "mandatory",
17 &mandatory_);
18 PopulateConstraintsFromJavaPairList(jni, j_constraints, "optional",
19 &optional_);
20 }
21
22 // static
23 void MediaConstraintsJni::PopulateConstraintsFromJavaPairList(
24 JNIEnv* jni,
25 jobject j_constraints,
26 const char* field_name,
27 Constraints* field) {
28 jfieldID j_id = GetFieldID(jni, GetObjectClass(jni, j_constraints),
29 field_name, "Ljava/util/List;");
30 jobject j_list = GetObjectField(jni, j_constraints, j_id);
31 for (jobject entry : Iterable(jni, j_list)) {
32 jmethodID get_key = GetMethodID(jni, GetObjectClass(jni, entry), "getKey",
33 "()Ljava/lang/String;");
34 jstring j_key =
35 reinterpret_cast<jstring>(jni->CallObjectMethod(entry, get_key));
36 CHECK_EXCEPTION(jni) << "error during CallObjectMethod";
37 jmethodID get_value = GetMethodID(jni, GetObjectClass(jni, entry),
38 "getValue", "()Ljava/lang/String;");
39 jstring j_value =
40 reinterpret_cast<jstring>(jni->CallObjectMethod(entry, get_value));
41 CHECK_EXCEPTION(jni) << "error during CallObjectMethod";
42 field->push_back(
43 Constraint(JavaToStdString(jni, j_key), JavaToStdString(jni, j_value)));
44 }
45 }
46
47 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/mediaconstraints_jni.h ('k') | webrtc/sdk/android/src/jni/pc/mediasource_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698