Diff
Modified: trunk/LayoutTests/ChangeLog (217518 => 217519)
--- trunk/LayoutTests/ChangeLog 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/LayoutTests/ChangeLog 2017-05-27 03:27:51 UTC (rev 217519)
@@ -1,3 +1,13 @@
+2017-05-26 Youenn Fablet <[email protected]>
+
+ WebRTC stats should be in milliseconds
+ https://bugs.webkit.org/show_bug.cgi?id=172644
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ * webrtc/video-stats.html: Making it less flaky prone.
+
2017-05-26 Sam Weinig <[email protected]>
[WebIDL] Overloaded functions should throw this object check exception before argument check exception
Modified: trunk/LayoutTests/TestExpectations (217518 => 217519)
--- trunk/LayoutTests/TestExpectations 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/LayoutTests/TestExpectations 2017-05-27 03:27:51 UTC (rev 217519)
@@ -735,7 +735,6 @@
webrtc/negotiatedneeded-event-addStream.html [ Pass Crash ]
webrtc/video-replace-track.html [ Pass Failure ]
-webrtc/video-stats.html [ Pass Failure ]
webrtc/video-getParameters.html [ Failure ]
webrtc/peer-connection-audio-mute2.html [ Pass Failure ]
webrtc/peer-connection-remote-audio-mute2.html [ Pass Failure ]
Modified: trunk/LayoutTests/webrtc/video-stats.html (217518 => 217519)
--- trunk/LayoutTests/webrtc/video-stats.html 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/LayoutTests/webrtc/video-stats.html 2017-05-27 03:27:51 UTC (rev 217519)
@@ -46,6 +46,32 @@
});
}
+function checkInboundFramesNumberIncreased(secondConnection, statsSecondConnection, count)
+{
+ return getInboundRTPStats(secondConnection).then((stats) => {
+ if (stats.timestamp > statsSecondConnection.timestamp && stats.framesDecoded > statsSecondConnection.framesDecoded)
+ return;
+ if (++count === 20)
+ return Promise.reject("checking inbound stats frame number increasing timed out");
+ return waitFor(50).then(() => {
+ return checkInboundFramesNumberIncreased(secondConnection, statsSecondConnection, count)
+ });
+ });
+}
+
+function checkOutboundFramesNumberIncreased(firstConnection, statsFirstConnection, count)
+{
+ return getOutboundRTPStats(firstConnection).then((stats) => {
+ if (stats.timestamp > statsFirstConnection.timestamp && stats.framesEncoded > statsFirstConnection.framesEncoded)
+ return;
+ if (++count === 20)
+ return Promise.reject("checking outbound stats frame number increasing timed out");
+ return waitFor(50).then(() => {
+ return checkOutboundFramesNumberIncreased(firstConnection, statsFirstConnection, count)
+ });
+ });
+}
+
var firstConnection, secondConnection;
promise_test((test) => {
if (window.testRunner)
@@ -73,6 +99,8 @@
assert_true(!!stats, "outbound-rtp stats should not be null");
assert_true(Number.isInteger(stats.framesEncoded), "framesEncoded should be an integer");
assert_true(Number.isInteger(stats.qpSum), "outbound qpSum should be an integer");
+ assert_false(Number.isInteger(stats.timestamp), "timestamp should be a double");
+ assert_true(typeof stats.timestamp === "number", "timestamp should be a double");
statsFirstConnection = stats;
return getInboundRTPStats(secondConnection);
}).then((stats) => {
@@ -79,18 +107,13 @@
assert_true(!!stats, "inbound-rtp stats should not be null");
assert_true(Number.isInteger(stats.framesDecoded), "framesDecoded should be an integer");
assert_true(Number.isInteger(stats.qpSum), "inbound qpSum should be an integer");
+ assert_false(Number.isInteger(stats.timestamp), "timestamp should be a double");
+ assert_true(typeof stats.timestamp === "number", "timestamp should be a double");
statsSecondConnection = stats;
- return waitFor(300);
}).then(() => {
- return getOutboundRTPStats(firstConnection);
- }).then((stats) => {
- assert_true(stats.timestamp > statsFirstConnection.timestamp, "Timestamp for first connection should have increased");
- assert_true(stats.framesEncoded > statsFirstConnection.framesEncoded, "Number of encoded frames should have increased");
-
- return getInboundRTPStats(secondConnection);
- }).then((stats) => {
- assert_true(stats.timestamp > statsSecondConnection.timestamp, "Timestamp for second connection should have increased");
- assert_true(stats.framesDecoded > statsSecondConnection.framesDecoded, "Number of decoded frames should have increased");
+ return checkInboundFramesNumberIncreased(secondConnection, statsSecondConnection, 0);
+ }).then(() => {
+ return checkOutboundFramesNumberIncreased(firstConnection, statsFirstConnection, 0);
});
}, "Basic video stats");
</script>
Modified: trunk/Source/WebCore/ChangeLog (217518 => 217519)
--- trunk/Source/WebCore/ChangeLog 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/Source/WebCore/ChangeLog 2017-05-27 03:27:51 UTC (rev 217519)
@@ -1,3 +1,17 @@
+2017-05-26 Youenn Fablet <[email protected]>
+
+ WebRTC stats should be in milliseconds
+ https://bugs.webkit.org/show_bug.cgi?id=172644
+
+ Reviewed by Eric Carlson.
+
+ Covered by updated tests.
+
+ * Modules/mediastream/RTCStatsReport.h:
+ * Modules/mediastream/RTCStatsReport.idl:
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::fillRTCStats):
+
2017-05-26 Sam Weinig <[email protected]>
[WebIDL] Overloaded functions should throw this object check exception before argument check exception
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h (217518 => 217519)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h 2017-05-27 03:27:51 UTC (rev 217519)
@@ -53,7 +53,7 @@
Certificate
};
struct Stats {
- unsigned long long timestamp;
+ double timestamp;
Type type;
String id;
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl (217518 => 217519)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl 2017-05-27 03:27:51 UTC (rev 217519)
@@ -45,9 +45,10 @@
"certificate"
};
+typedef double DOMHighResTimeStamp;
+
dictionary RTCStats {
- // FIXME 169662: change type to DOMHighResTimeStamp
- unsigned long long timestamp;
+ DOMHighResTimeStamp timestamp;
RTCStatsType type;
DOMString id;
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (217518 => 217519)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-05-27 02:54:02 UTC (rev 217518)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-05-27 03:27:51 UTC (rev 217519)
@@ -239,7 +239,7 @@
static inline void fillRTCStats(RTCStatsReport::Stats& stats, const webrtc::RTCStats& rtcStats)
{
- stats.timestamp = rtcStats.timestamp_us();
+ stats.timestamp = rtcStats.timestamp_us() / 1000.0;
stats.id = fromStdString(rtcStats.id());
}