| 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 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 JOW(jobject, PeerConnection_createDataChannel)( | 1719 JOW(jobject, PeerConnection_createDataChannel)( |
| 1720 JNIEnv* jni, jobject j_pc, jstring j_label, jobject j_init) { | 1720 JNIEnv* jni, jobject j_pc, jstring j_label, jobject j_init) { |
| 1721 DataChannelInit init = JavaDataChannelInitToNative(jni, j_init); | 1721 DataChannelInit init = JavaDataChannelInitToNative(jni, j_init); |
| 1722 rtc::scoped_refptr<DataChannelInterface> channel( | 1722 rtc::scoped_refptr<DataChannelInterface> channel( |
| 1723 ExtractNativePC(jni, j_pc)->CreateDataChannel( | 1723 ExtractNativePC(jni, j_pc)->CreateDataChannel( |
| 1724 JavaToStdString(jni, j_label), &init)); | 1724 JavaToStdString(jni, j_label), &init)); |
| 1725 // Mustn't pass channel.get() directly through NewObject to avoid reading its | 1725 // Mustn't pass channel.get() directly through NewObject to avoid reading its |
| 1726 // vararg parameter as 64-bit and reading memory that doesn't belong to the | 1726 // vararg parameter as 64-bit and reading memory that doesn't belong to the |
| 1727 // 32-bit parameter. | 1727 // 32-bit parameter. |
| 1728 jlong nativeChannelPtr = jlongFromPointer(channel.get()); | 1728 jlong nativeChannelPtr = jlongFromPointer(channel.get()); |
| 1729 RTC_CHECK(nativeChannelPtr) << "Failed to create DataChannel"; | 1729 if (!nativeChannelPtr) { |
| 1730 LOG(LS_ERROR) << "Failed to create DataChannel"; |
| 1731 return nullptr; |
| 1732 } |
| 1730 jclass j_data_channel_class = FindClass(jni, "org/webrtc/DataChannel"); | 1733 jclass j_data_channel_class = FindClass(jni, "org/webrtc/DataChannel"); |
| 1731 jmethodID j_data_channel_ctor = GetMethodID( | 1734 jmethodID j_data_channel_ctor = GetMethodID( |
| 1732 jni, j_data_channel_class, "<init>", "(J)V"); | 1735 jni, j_data_channel_class, "<init>", "(J)V"); |
| 1733 jobject j_channel = jni->NewObject( | 1736 jobject j_channel = jni->NewObject( |
| 1734 j_data_channel_class, j_data_channel_ctor, nativeChannelPtr); | 1737 j_data_channel_class, j_data_channel_ctor, nativeChannelPtr); |
| 1735 CHECK_EXCEPTION(jni) << "error during NewObject"; | 1738 CHECK_EXCEPTION(jni) << "error during NewObject"; |
| 1736 // Channel is now owned by Java object, and will be freed from there. | 1739 // Channel is now owned by Java object, and will be freed from there. |
| 1737 int bumped_count = channel->AddRef(); | 1740 int bumped_count = channel->AddRef(); |
| 1738 RTC_CHECK(bumped_count == 2) << "Unexpected refcount"; | 1741 RTC_CHECK(bumped_count == 2) << "Unexpected refcount"; |
| 1739 return j_channel; | 1742 return j_channel; |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 return JavaStringFromStdString( | 2348 return JavaStringFromStdString( |
| 2346 jni, | 2349 jni, |
| 2347 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2350 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
| 2348 } | 2351 } |
| 2349 | 2352 |
| 2350 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2353 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
| 2351 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2354 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
| 2352 } | 2355 } |
| 2353 | 2356 |
| 2354 } // namespace webrtc_jni | 2357 } // namespace webrtc_jni |
| OLD | NEW |