| OLD | NEW |
| 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 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = GetObjectField(jni, j_encoding_parameters, bitrate_id); |
| 2046 if (!IsNull(jni, j_bitrate)) { | 2046 if (!IsNull(jni, j_bitrate)) { |
| 2047 int bitrate_value = jni->CallIntMethod(j_bitrate, int_value_id); | 2047 int bitrate_value = jni->CallIntMethod(j_bitrate, int_value_id); |
| 2048 CHECK_EXCEPTION(jni) << "error during CallIntMethod"; | 2048 CHECK_EXCEPTION(jni) << "error during CallIntMethod"; |
| 2049 encoding.max_bitrate_bps = bitrate_value; | 2049 encoding.max_bitrate_bps = rtc::Optional<int>(bitrate_value); |
| 2050 } else { | |
| 2051 encoding.max_bitrate_bps = kBitrateUnlimited; | |
| 2052 } | 2050 } |
| 2053 encodings->push_back(encoding); | 2051 encodings->push_back(encoding); |
| 2054 } | 2052 } |
| 2055 return true; | 2053 return true; |
| 2056 } | 2054 } |
| 2057 | 2055 |
| 2058 JOW(jboolean, RtpSender_nativeSetParameters) | 2056 JOW(jboolean, RtpSender_nativeSetParameters) |
| 2059 (JNIEnv* jni, jclass, jlong j_rtp_sender_pointer, jobject j_parameters) { | 2057 (JNIEnv* jni, jclass, jlong j_rtp_sender_pointer, jobject j_parameters) { |
| 2060 if (IsNull(jni, j_parameters)) { | 2058 if (IsNull(jni, j_parameters)) { |
| 2061 return false; | 2059 return false; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 | 2097 |
| 2100 jclass integer_class = jni->FindClass("java/lang/Integer"); | 2098 jclass integer_class = jni->FindClass("java/lang/Integer"); |
| 2101 jmethodID integer_ctor = GetMethodID(jni, integer_class, "<init>", "(I)V"); | 2099 jmethodID integer_ctor = GetMethodID(jni, integer_class, "<init>", "(I)V"); |
| 2102 | 2100 |
| 2103 for (const webrtc::RtpEncodingParameters& encoding : parameters.encodings) { | 2101 for (const webrtc::RtpEncodingParameters& encoding : parameters.encodings) { |
| 2104 jobject j_encoding_parameters = | 2102 jobject j_encoding_parameters = |
| 2105 jni->NewObject(encoding_class, encoding_ctor); | 2103 jni->NewObject(encoding_class, encoding_ctor); |
| 2106 CHECK_EXCEPTION(jni) << "error during NewObject"; | 2104 CHECK_EXCEPTION(jni) << "error during NewObject"; |
| 2107 jni->SetBooleanField(j_encoding_parameters, active_id, encoding.active); | 2105 jni->SetBooleanField(j_encoding_parameters, active_id, encoding.active); |
| 2108 CHECK_EXCEPTION(jni) << "error during SetBooleanField"; | 2106 CHECK_EXCEPTION(jni) << "error during SetBooleanField"; |
| 2109 if (encoding.max_bitrate_bps > 0) { | 2107 if (encoding.max_bitrate_bps) { |
| 2110 jobject j_bitrate_value = | 2108 jobject j_bitrate_value = jni->NewObject(integer_class, integer_ctor, |
| 2111 jni->NewObject(integer_class, integer_ctor, encoding.max_bitrate_bps); | 2109 *encoding.max_bitrate_bps); |
| 2112 CHECK_EXCEPTION(jni) << "error during NewObject"; | 2110 CHECK_EXCEPTION(jni) << "error during NewObject"; |
| 2113 jni->SetObjectField(j_encoding_parameters, bitrate_id, j_bitrate_value); | 2111 jni->SetObjectField(j_encoding_parameters, bitrate_id, j_bitrate_value); |
| 2114 CHECK_EXCEPTION(jni) << "error during SetObjectField"; | 2112 CHECK_EXCEPTION(jni) << "error during SetObjectField"; |
| 2115 } | 2113 } |
| 2116 jboolean added = | 2114 jboolean added = |
| 2117 jni->CallBooleanMethod(j_encodings, add, j_encoding_parameters); | 2115 jni->CallBooleanMethod(j_encodings, add, j_encoding_parameters); |
| 2118 CHECK_EXCEPTION(jni) << "error during CallBooleanMethod"; | 2116 CHECK_EXCEPTION(jni) << "error during CallBooleanMethod"; |
| 2119 } | 2117 } |
| 2120 return j_parameters; | 2118 return j_parameters; |
| 2121 } | 2119 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2145 return JavaStringFromStdString( | 2143 return JavaStringFromStdString( |
| 2146 jni, | 2144 jni, |
| 2147 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2145 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
| 2148 } | 2146 } |
| 2149 | 2147 |
| 2150 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2148 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
| 2151 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2149 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
| 2152 } | 2150 } |
| 2153 | 2151 |
| 2154 } // namespace webrtc_jni | 2152 } // namespace webrtc_jni |
| OLD | NEW |