Skip to content

Commit a1c4ded

Browse files
committed
api: fix non-compliant timestamp field in stats
It must be a (double) number, expressed in milliseconds. The native API provides microseconds though.
1 parent b766fb5 commit a1c4ded

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

android/src/main/java/com/oney/WebRTCModule/StringUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public static String statsToJSON(RTCStatsReport report) {
3535

3636
RTCStats stats = statsMap.get(key);
3737
builder
38-
.append("\"timestamp\":\"")
39-
.append(stats.getTimestampUs())
40-
.append("\",\"type\":\"")
38+
.append("\"timestamp\":")
39+
.append(stats.getTimestampUs() / 1000.0)
40+
.append(",\"type\":\"")
4141
.append(stats.getType())
4242
.append("\",\"id\":\"")
4343
.append(stats.getId())

ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ - (NSString *)statsToJSON:(RTCStatisticsReport *)report
339339
[s appendString:@"\",{"];
340340

341341
RTCStatistics *statistics = report.statistics[key];
342-
[s appendString:@"\"timestamp\":\""];
343-
[s appendFormat:@"%f", statistics.timestamp_us];
344-
[s appendString:@"\",\"type\":\""];
342+
[s appendString:@"\"timestamp\":"];
343+
[s appendFormat:@"%f", statistics.timestamp_us / 1000.0];
344+
[s appendString:@",\"type\":\""];
345345
[s appendString:statistics.type];
346346
[s appendString:@"\",\"id\":\""];
347347
[s appendString:statistics.id];

0 commit comments

Comments
 (0)