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