OLD | NEW |
| (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 #ifndef WEBRTC_SDK_ANDROID_SRC_JNI_RTCSTATSCOLLECTORCALLBACKWRAPPER_H_ | |
12 #define WEBRTC_SDK_ANDROID_SRC_JNI_RTCSTATSCOLLECTORCALLBACKWRAPPER_H_ | |
13 | |
14 #include <jni.h> | |
15 | |
16 #include "webrtc/api/peerconnectioninterface.h" | |
17 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | |
18 | |
19 namespace webrtc_jni { | |
20 | |
21 // Adapter for a Java RTCStatsCollectorCallback presenting a C++ | |
22 // RTCStatsCollectorCallback and dispatching the callback from C++ back to | |
23 // Java. | |
24 class RTCStatsCollectorCallbackWrapper | |
25 : public webrtc::RTCStatsCollectorCallback { | |
26 public: | |
27 RTCStatsCollectorCallbackWrapper(JNIEnv* jni, jobject j_callback); | |
28 | |
29 void OnStatsDelivered( | |
30 const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report) override; | |
31 | |
32 private: | |
33 // Helper functions for converting C++ RTCStatsReport to Java equivalent. | |
34 jobject ReportToJava( | |
35 JNIEnv* jni, | |
36 const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report); | |
37 jobject StatsToJava(JNIEnv* jni, const webrtc::RTCStats& stats); | |
38 jobject MemberToJava(JNIEnv* jni, | |
39 const webrtc::RTCStatsMemberInterface* member); | |
40 | |
41 const ScopedGlobalRef<jobject> j_callback_global_; | |
42 const ScopedGlobalRef<jclass> j_callback_class_; | |
43 const jclass j_stats_report_class_; | |
44 const jmethodID j_stats_report_ctor_; | |
45 const jclass j_stats_class_; | |
46 const jmethodID j_stats_ctor_; | |
47 const jclass j_linked_hash_map_class_; | |
48 const jmethodID j_linked_hash_map_ctor_; | |
49 const jmethodID j_linked_hash_map_put_; | |
50 const jclass j_boolean_class_; | |
51 const jmethodID j_boolean_ctor_; | |
52 const jclass j_integer_class_; | |
53 const jmethodID j_integer_ctor_; | |
54 const jclass j_long_class_; | |
55 const jmethodID j_long_ctor_; | |
56 const jclass j_big_integer_class_; | |
57 const jmethodID j_big_integer_ctor_; | |
58 const jclass j_double_class_; | |
59 const jmethodID j_double_ctor_; | |
60 const jclass j_string_class_; | |
61 }; | |
62 | |
63 } // namespace webrtc_jni | |
64 | |
65 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_RTCSTATSCOLLECTORCALLBACKWRAPPER_H_ | |
OLD | NEW |