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

Unified Diff: webrtc/sdk/android/src/jni/pc/java_native_conversion.h

Issue 2992103002: Relanding: Break peerconnection_jni.cc into multiple files, in "pc" directory. (Closed)
Patch Set: Add jni/androidnetworkmonitor_jni.h include for backwards comaptibility. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/sdk/android/src/jni/pc/java_native_conversion.h
diff --git a/webrtc/sdk/android/src/jni/rtcstatscollectorcallbackwrapper.h b/webrtc/sdk/android/src/jni/pc/java_native_conversion.h
similarity index 13%
copy from webrtc/sdk/android/src/jni/rtcstatscollectorcallbackwrapper.h
copy to webrtc/sdk/android/src/jni/pc/java_native_conversion.h
index 5f1eb66bd216b2cbedcc8f1b40cd21103397dc82..0e4e2c1eb4ee4dfa066614233502dd44a17ea1d2 100644
--- a/webrtc/sdk/android/src/jni/rtcstatscollectorcallbackwrapper.h
+++ b/webrtc/sdk/android/src/jni/pc/java_native_conversion.h
@@ -8,58 +8,105 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_SDK_ANDROID_SRC_JNI_RTCSTATSCOLLECTORCALLBACKWRAPPER_H_
-#define WEBRTC_SDK_ANDROID_SRC_JNI_RTCSTATSCOLLECTORCALLBACKWRAPPER_H_
+#ifndef WEBRTC_SDK_ANDROID_SRC_JNI_PC_JAVA_NATIVE_CONVERSION_H_
+#define WEBRTC_SDK_ANDROID_SRC_JNI_PC_JAVA_NATIVE_CONVERSION_H_
-#include <jni.h>
+#include <vector>
+#include "webrtc/api/datachannelinterface.h"
+#include "webrtc/api/jsep.h"
+#include "webrtc/api/jsepicecandidate.h"
+#include "webrtc/api/mediastreaminterface.h"
+#include "webrtc/api/mediatypes.h"
#include "webrtc/api/peerconnectioninterface.h"
+#include "webrtc/api/rtpparameters.h"
+#include "webrtc/rtc_base/sslidentity.h"
#include "webrtc/sdk/android/src/jni/jni_helpers.h"
+// This file contains helper methods for converting between simple C++ and Java
+// PeerConnection-related structures. Similar to some methods in jni_helpers.h,
+// but specifically for structures tied to the PeerConnection API.
+
namespace webrtc_jni {
-// Adapter for a Java RTCStatsCollectorCallback presenting a C++
-// RTCStatsCollectorCallback and dispatching the callback from C++ back to
-// Java.
-class RTCStatsCollectorCallbackWrapper
- : public webrtc::RTCStatsCollectorCallback {
- public:
- RTCStatsCollectorCallbackWrapper(JNIEnv* jni, jobject j_callback);
-
- void OnStatsDelivered(
- const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report) override;
-
- private:
- // Helper functions for converting C++ RTCStatsReport to Java equivalent.
- jobject ReportToJava(
- JNIEnv* jni,
- const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report);
- jobject StatsToJava(JNIEnv* jni, const webrtc::RTCStats& stats);
- jobject MemberToJava(JNIEnv* jni,
- const webrtc::RTCStatsMemberInterface* member);
-
- const ScopedGlobalRef<jobject> j_callback_global_;
- const ScopedGlobalRef<jclass> j_callback_class_;
- const jclass j_stats_report_class_;
- const jmethodID j_stats_report_ctor_;
- const jclass j_stats_class_;
- const jmethodID j_stats_ctor_;
- const jclass j_linked_hash_map_class_;
- const jmethodID j_linked_hash_map_ctor_;
- const jmethodID j_linked_hash_map_put_;
- const jclass j_boolean_class_;
- const jmethodID j_boolean_ctor_;
- const jclass j_integer_class_;
- const jmethodID j_integer_ctor_;
- const jclass j_long_class_;
- const jmethodID j_long_ctor_;
- const jclass j_big_integer_class_;
- const jmethodID j_big_integer_ctor_;
- const jclass j_double_class_;
- const jmethodID j_double_ctor_;
- const jclass j_string_class_;
-};
+webrtc::DataChannelInit JavaToNativeDataChannelInit(JNIEnv* jni,
+ jobject j_init);
+
+cricket::MediaType JavaToNativeMediaType(JNIEnv* jni, jobject j_media_type);
+
+jobject NativeToJavaMediaType(JNIEnv* jni, cricket::MediaType media_type);
+
+cricket::Candidate JavaToNativeCandidate(JNIEnv* jni, jobject j_candidate);
+
+jobject NativeToJavaCandidate(JNIEnv* jni,
+ jclass* candidate_class,
+ const cricket::Candidate& candidate);
+
+jobjectArray NativeToJavaCandidateArray(
+ JNIEnv* jni,
+ const std::vector<cricket::Candidate>& candidates);
+
+webrtc::SessionDescriptionInterface* JavaToNativeSessionDescription(
+ JNIEnv* jni,
+ jobject j_sdp);
+
+jobject NativeToJavaSessionDescription(
+ JNIEnv* jni,
+ const webrtc::SessionDescriptionInterface* desc);
+
+webrtc::PeerConnectionFactoryInterface::Options
+JavaToNativePeerConnectionFactoryOptions(JNIEnv* jni, jobject options);
+
+/*****************************************************
+ * Below are all things that go into RTCConfiguration.
+ *****************************************************/
+webrtc::PeerConnectionInterface::IceTransportsType
+JavaToNativeIceTransportsType(JNIEnv* jni, jobject j_ice_transports_type);
+
+webrtc::PeerConnectionInterface::BundlePolicy JavaToNativeBundlePolicy(
+ JNIEnv* jni,
+ jobject j_bundle_policy);
+
+webrtc::PeerConnectionInterface::RtcpMuxPolicy JavaToNativeRtcpMuxPolicy(
+ JNIEnv* jni,
+ jobject j_rtcp_mux_policy);
+
+webrtc::PeerConnectionInterface::TcpCandidatePolicy
+JavaToNativeTcpCandidatePolicy(JNIEnv* jni, jobject j_tcp_candidate_policy);
+
+webrtc::PeerConnectionInterface::CandidateNetworkPolicy
+JavaToNativeCandidateNetworkPolicy(JNIEnv* jni,
+ jobject j_candidate_network_policy);
+
+rtc::KeyType JavaToNativeKeyType(JNIEnv* jni, jobject j_key_type);
+
+webrtc::PeerConnectionInterface::ContinualGatheringPolicy
+JavaToNativeContinualGatheringPolicy(JNIEnv* jni, jobject j_gathering_policy);
+
+webrtc::PeerConnectionInterface::TlsCertPolicy JavaToNativeTlsCertPolicy(
+ JNIEnv* jni,
+ jobject j_ice_server_tls_cert_policy);
+
+void JavaToNativeIceServers(
+ JNIEnv* jni,
+ jobject j_ice_servers,
+ webrtc::PeerConnectionInterface::IceServers* ice_servers);
+
+void JavaToNativeRTCConfiguration(
+ JNIEnv* jni,
+ jobject j_rtc_config,
+ webrtc::PeerConnectionInterface::RTCConfiguration* rtc_config);
+
+/*********************************************************
+ * RtpParameters, used for RtpSender and RtpReceiver APIs.
+ *********************************************************/
+void JavaToNativeRtpParameters(JNIEnv* jni,
+ jobject j_parameters,
+ webrtc::RtpParameters* parameters);
+
+jobject NativeToJavaRtpParameters(JNIEnv* jni,
+ const webrtc::RtpParameters& parameters);
} // namespace webrtc_jni
-#endif // WEBRTC_SDK_ANDROID_SRC_JNI_RTCSTATSCOLLECTORCALLBACKWRAPPER_H_
+#endif // WEBRTC_SDK_ANDROID_SRC_JNI_PC_JAVA_NATIVE_CONVERSION_H_
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/dtmfsender_jni.cc ('k') | webrtc/sdk/android/src/jni/pc/java_native_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698