react-native-webrtc 1.94.0 → 1.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Everyone is welcome to our [Discourse community](https://react-native-webrtc.dis
|
|
|
15
15
|
|
|
16
16
|
## WebRTC Revision
|
|
17
17
|
|
|
18
|
-
* Currently used revision: [
|
|
18
|
+
* Currently used revision: [M94](https://github.com/jitsi/webrtc/commit/561d58b4136684f4247ed780ce090a871be7cf75)
|
|
19
19
|
* Supported architectures
|
|
20
20
|
* Android: armeabi-v7a, arm64-v8a, x86, x86_64
|
|
21
21
|
* iOS: arm64, x86_64 (for bitcode support, run [this script](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/tools/downloadBitcode.sh))
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.oney.WebRTCModule;
|
|
2
2
|
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
|
|
3
5
|
import org.webrtc.PeerConnection;
|
|
4
6
|
import org.webrtc.RTCStats;
|
|
5
7
|
import org.webrtc.RTCStatsReport;
|
|
@@ -7,6 +9,8 @@ import org.webrtc.RTCStatsReport;
|
|
|
7
9
|
import java.util.Map;
|
|
8
10
|
|
|
9
11
|
public class StringUtils {
|
|
12
|
+
private static final String TAG = StringUtils.class.getSimpleName();
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* Constructs a JSON <tt>String</tt> representation of a specific array of
|
|
12
16
|
* <tt>RTCStatsReport</tt>s (produced by {@link PeerConnection#getStats}).
|
|
@@ -74,6 +78,26 @@ public class StringUtils {
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
builder.append("]");
|
|
81
|
+
} else if (value instanceof Map) {
|
|
82
|
+
try {
|
|
83
|
+
Map<String, Object> mapValue = (Map) value;
|
|
84
|
+
|
|
85
|
+
boolean firstKey = true;
|
|
86
|
+
builder.append("{");
|
|
87
|
+
|
|
88
|
+
for (Map.Entry<String, Object> entry : mapValue.entrySet()) {
|
|
89
|
+
if (firstKey) {
|
|
90
|
+
firstKey = false;
|
|
91
|
+
} else {
|
|
92
|
+
builder.append(",");
|
|
93
|
+
}
|
|
94
|
+
builder.append("\"").append(entry.getKey()).append("\":");
|
|
95
|
+
appendValue(builder, entry.getValue());
|
|
96
|
+
}
|
|
97
|
+
builder.append("}");
|
|
98
|
+
} catch (ClassCastException e) {
|
|
99
|
+
Log.e(TAG, "Error parsing stats value " + value);
|
|
100
|
+
}
|
|
77
101
|
} else if (value instanceof String) {
|
|
78
102
|
builder.append("\"").append(value).append("\"");
|
|
79
103
|
} else {
|
|
@@ -402,34 +402,53 @@ RCT_EXPORT_METHOD(peerConnectionRestartIce:(nonnull NSNumber *)objectID)
|
|
|
402
402
|
[s appendString:key];
|
|
403
403
|
[s appendString:@"\":"];
|
|
404
404
|
NSObject *statisticsValue = [statistics.values objectForKey:key];
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
405
|
+
[self appendValue:statisticsValue toString:s];
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
[s appendString:@"}]"];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
[s appendString:@"]"];
|
|
412
|
+
|
|
413
|
+
return s;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
- (void)appendValue:(NSObject *)statisticsValue toString:(NSMutableString *)s {
|
|
417
|
+
if ([statisticsValue isKindOfClass:[NSArray class]]) {
|
|
418
|
+
[s appendString:@"["];
|
|
419
|
+
BOOL firstValue = YES;
|
|
420
|
+
for (NSObject *element in (NSArray *)statisticsValue) {
|
|
421
|
+
if(firstValue) {
|
|
410
422
|
firstValue = NO;
|
|
411
|
-
|
|
423
|
+
} else {
|
|
412
424
|
[s appendString:@","];
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
[s appendString:@"\""];
|
|
416
|
-
[s appendString:[NSString stringWithFormat:@"%@", value]];
|
|
417
|
-
[s appendString:@"\""];
|
|
418
425
|
}
|
|
419
|
-
|
|
420
|
-
|
|
426
|
+
|
|
427
|
+
[s appendString:@"\""];
|
|
428
|
+
[s appendString:[NSString stringWithFormat:@"%@", element]];
|
|
429
|
+
[s appendString:@"\""];
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
[s appendString:@"]"];
|
|
433
|
+
} else if ([statisticsValue isKindOfClass:[NSDictionary class]]) {
|
|
434
|
+
NSError *error;
|
|
435
|
+
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:statisticsValue
|
|
436
|
+
options:0
|
|
437
|
+
error:&error];
|
|
438
|
+
|
|
439
|
+
if (!jsonData) {
|
|
421
440
|
[s appendString:@"\""];
|
|
422
441
|
[s appendString:[NSString stringWithFormat:@"%@", statisticsValue]];
|
|
423
442
|
[s appendString:@"\""];
|
|
443
|
+
} else {
|
|
444
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
445
|
+
[s appendString:jsonString];
|
|
424
446
|
}
|
|
447
|
+
} else {
|
|
448
|
+
[s appendString:@"\""];
|
|
449
|
+
[s appendString:[NSString stringWithFormat:@"%@", statisticsValue]];
|
|
450
|
+
[s appendString:@"\""];
|
|
425
451
|
}
|
|
426
|
-
|
|
427
|
-
[s appendString:@"}]"];
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
[s appendString:@"]"];
|
|
431
|
-
|
|
432
|
-
return s;
|
|
433
452
|
}
|
|
434
453
|
|
|
435
454
|
- (NSString *)stringForPeerConnectionState:(RTCPeerConnectionState)state {
|