Commit c9dad9ca authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Correct validation of the WebRTC stats

- Allow codecType to be missing in CodecStats
- Allow address to be null (not missing) in iceCandidateStats
- Allow url to be missing (it is only supposed to be present for
  STUN and TURN generated candidates)

Exceptionally allow address to be missing in order to work around a bug.

Bug: chromium:1092721
Change-Id: Ib6d290a177b3c1be4c6238d346cba17ac0c18ca3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236477Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776866}
parent e0fd3165
......@@ -6738,9 +6738,6 @@ crbug.com/1091250 [ Win10 ] virtual/cors/http/tests/misc/resource-timing-sizes-m
crbug.com/1091948 [ Linux ] external/wpt/html/canvas/element/manual/fill-and-stroke-styles/canvas_colorsandstyles_createlineargradient_001.htm [ Pass Timeout ]
crbug.com/1092091 [ Mac ] virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-open.html [ Pass Failure ]
# Test giving differing results on different build bots
crbug.com/1092721 external/wpt/webrtc/RTCPeerConnection-getStats.https.html [ Pass Failure ]
# Sheriff 2020-06-06
crbug.com/1091843 fast/canvas/color-space/canvas-createImageBitmap-p3.html [ Pass Failure ]
......
......@@ -9,8 +9,8 @@ PASS getStats() with track associated with both sender and receiver should rejec
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.senderId to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.sdpFmtpLine to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL sender.getStats() via addTransceiver should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL sender.getStats() via addTrack should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL sender.getStats() via addTransceiver should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.senderId to be string expected "string" but got "undefined"
FAIL sender.getStats() via addTrack should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.senderId to be string expected "string" but got "undefined"
Harness: the test ran to completion.
......@@ -178,10 +178,10 @@ function validateRtpStreamStats(statsReport, stats) {
[webrtc-stats]
7.2. RTCCodecStats dictionary
dictionary RTCCodecStats : RTCStats {
unsigned long payloadType;
required unsigned long payloadType;
RTCCodecType codecType;
DOMString transportId;
DOMString mimeType;
required DOMString transportId;
required DOMString mimeType;
unsigned long clockRate;
unsigned long channels;
DOMString sdpFmtpLine;
......@@ -201,7 +201,7 @@ function validateCodecStats(statsReport, stats) {
validateRtcStats(statsReport, stats);
assert_unsigned_int_field(stats, 'payloadType');
assert_enum_field(stats, 'codecType', ['encode', 'decode']);
assert_optional_enum_field(stats, 'codecType', ['encode', 'decode']);
validateOptionalIdField(statsReport, stats, 'transportId', 'transport');
......@@ -435,7 +435,6 @@ function validateSentRtpStreamStats(statsReport, stats) {
[webrtc-stats]
7.7. RTCOutboundRtpStreamStats dictionary
dictionary RTCOutboundRtpStreamStats : RTCSentRtpStreamStats {
DOMString trackId;
DOMString mediaSourceId;
DOMString senderId;
DOMString remoteId;
......@@ -476,7 +475,10 @@ function validateSentRtpStreamStats(statsReport, stats) {
unsigned long sliCount;
DOMString encoderImplementation;
};
Obsolete members:
partial dictionary RTCOutboundStreamStats {
DOMString trackId;
};
[webrtc-pc]
8.6. Mandatory To Implement Stats
- RTCOutboundRtpStreamStats, with all required attributes from its
......@@ -485,7 +487,6 @@ function validateSentRtpStreamStats(statsReport, stats) {
function validateOutboundRtpStreamStats(statsReport, stats) {
validateSentRtpStreamStats(statsReport, stats)
validateOptionalIdField(statsReport, stats, 'trackId', 'track');
validateOptionalIdField(statsReport, stats, 'mediaSourceId', 'media-source');
validateIdField(statsReport, stats, 'senderId', 'sender');
validateIdField(statsReport, stats, 'remoteId', 'remote-inbound-rtp');
......@@ -556,6 +557,8 @@ function validateOutboundRtpStreamStats(statsReport, stats) {
assert_optional_unsigned_int_field(stats, 'pliCount');
assert_optional_unsigned_int_field(stats, 'sliCount');
assert_optional_string_field(stats, 'encoderImplementation');
// Obsolete stats
validateOptionalIdField(statsReport, stats, 'trackId', 'track');
}
/*
......@@ -883,8 +886,8 @@ function validateTransportStats(statsReport, stats) {
[webrtc-stats]
7.15. RTCIceCandidateStats dictionary
dictionary RTCIceCandidateStats : RTCStats {
DOMString transportId;
DOMString address;
required DOMString transportId;
DOMString? address;
long port;
DOMString protocol;
RTCIceCandidateType candidateType;
......@@ -908,9 +911,16 @@ function validateTransportStats(statsReport, stats) {
function validateIceCandidateStats(statsReport, stats) {
validateRtcStats(statsReport, stats);
validateOptionalIdField(statsReport, stats, 'transportId', 'transport');
assert_string_field(stats, 'address');
validateIdField(statsReport, stats, 'transportId', 'transport');
// The address is mandatory to implement, but is allowed to be null
// when hidden for privacy reasons.
if (stats.address != null) {
// Departure from strict spec reading:
// This field is populated in a racy manner in Chrome.
// We allow it to be present or not present for the time being.
// TODO(https://bugs.chromium.org/1092721): Become consistent.
assert_optional_string_field(stats, 'address');
}
assert_unsigned_int_field(stats, 'port');
assert_string_field(stats, 'protocol');
......@@ -918,7 +928,10 @@ function validateIceCandidateStats(statsReport, stats) {
['host', 'srflx', 'prflx', 'relay']);
assert_optional_int_field(stats, 'priority');
assert_string_field(stats, 'url');
// The url field is mandatory for local candidates gathered from
// a STUN or TURN server, and MUST NOT be present otherwise.
// TODO(hta): Improve checking.
assert_optional_string_field(stats, 'url');
assert_optional_string_field(stats, 'relayProtocol');
}
......
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
PASS getStats() with track added via addTransceiver should succeed
PASS getStats() with track associated with more than one sender should reject with InvalidAccessError
PASS getStats() with track associated with both sender and receiver should reject with InvalidAccessError
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
FAIL getStats() with track added via addTransceiver should succeed promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
FAIL getStats() with track added via addTransceiver should succeed promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.address to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
PASS getStats() with track added via addTransceiver should succeed
PASS getStats() with track associated with more than one sender should reject with InvalidAccessError
PASS getStats() with track associated with both sender and receiver should reject with InvalidAccessError
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.address to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
FAIL getStats() with track added via addTransceiver should succeed promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
FAIL getStats() with track added via addTransceiver should succeed promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.address to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS getStats() with no argument should succeed
PASS getStats(null) should succeed
PASS getStats() with track not added to connection should reject with InvalidAccessError
PASS getStats() with track added via addTrack should succeed
FAIL getStats() with track added via addTransceiver should succeed promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'.
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.address to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
......@@ -9,8 +9,8 @@ FAIL getStats() with track associated with both sender and receiver should rejec
PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC
FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
FAIL getStats() with no argument should return stats for no-stream tracks assert_equals: Expect dictionary.totalAudioEnergy to be number expected "number" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.senderId to be string expected "string" but got "undefined"
FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined" Reached unreachable code
FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_equals: Expect dictionary.sdpFmtpLine to be string expected "string" but got "undefined" Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL sender.getStats() via addTransceiver should return stats report containing outbound-rtp stats promise_test: Unhandled rejection with value: object "InvalidStateError: Failed to execute 'addTransceiver' on 'RTCPeerConnection': This operation is only supported in 'unified-plan'."
FAIL sender.getStats() via addTrack should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.codecType to be string expected "string" but got "undefined"
FAIL sender.getStats() via addTrack should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.senderId to be string expected "string" but got "undefined"
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment