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

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

Issue 1853523002: Allowing a Java object field to be null in a new JNI helper method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding comment around maxBitrateBps explaining null value. Created 4 years, 8 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 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 jfieldID active_id = 2035 jfieldID active_id =
2036 GetFieldID(jni, j_encoding_parameters_class, "active", "Z"); 2036 GetFieldID(jni, j_encoding_parameters_class, "active", "Z");
2037 jfieldID bitrate_id = GetFieldID(jni, j_encoding_parameters_class, 2037 jfieldID bitrate_id = GetFieldID(jni, j_encoding_parameters_class,
2038 "maxBitrateBps", "Ljava/lang/Integer;"); 2038 "maxBitrateBps", "Ljava/lang/Integer;");
2039 jclass j_integer_class = jni->FindClass("java/lang/Integer"); 2039 jclass j_integer_class = jni->FindClass("java/lang/Integer");
2040 jmethodID int_value_id = GetMethodID(jni, j_integer_class, "intValue", "()I"); 2040 jmethodID int_value_id = GetMethodID(jni, j_integer_class, "intValue", "()I");
2041 2041
2042 for (jobject j_encoding_parameters : Iterable(jni, j_encodings)) { 2042 for (jobject j_encoding_parameters : Iterable(jni, j_encodings)) {
2043 webrtc::RtpEncodingParameters encoding; 2043 webrtc::RtpEncodingParameters encoding;
2044 encoding.active = GetBooleanField(jni, j_encoding_parameters, active_id); 2044 encoding.active = GetBooleanField(jni, j_encoding_parameters, active_id);
2045 jobject j_bitrate = GetObjectField(jni, j_encoding_parameters, bitrate_id); 2045 jobject j_bitrate =
2046 GetNullableObjectField(jni, j_encoding_parameters, bitrate_id);
2046 if (!IsNull(jni, j_bitrate)) { 2047 if (!IsNull(jni, j_bitrate)) {
2047 int bitrate_value = jni->CallIntMethod(j_bitrate, int_value_id); 2048 int bitrate_value = jni->CallIntMethod(j_bitrate, int_value_id);
2048 CHECK_EXCEPTION(jni) << "error during CallIntMethod"; 2049 CHECK_EXCEPTION(jni) << "error during CallIntMethod";
2049 encoding.max_bitrate_bps = bitrate_value; 2050 encoding.max_bitrate_bps = bitrate_value;
2050 } else { 2051 } else {
2051 encoding.max_bitrate_bps = kBitrateUnlimited; 2052 encoding.max_bitrate_bps = kBitrateUnlimited;
2052 } 2053 }
2053 encodings->push_back(encoding); 2054 encodings->push_back(encoding);
2054 } 2055 }
2055 return true; 2056 return true;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 return JavaStringFromStdString( 2146 return JavaStringFromStdString(
2146 jni, 2147 jni,
2147 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2148 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2148 } 2149 }
2149 2150
2150 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 2151 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
2151 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2152 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2152 } 2153 }
2153 2154
2154 } // namespace webrtc_jni 2155 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698