New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 774303 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Test and fire RTCPeerConnection.ontrack,onaddstream / MediaStream.onadd/removetrack / MediaStream.onmute/onunmute correctly

Project Member Reported by hbos@chromium.org, Oct 12 2017

Issue description

With the removal of the PCH mock, ontrack is no longer being tested:
https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-ontrack.html?q=RTCPeerConnection-ontrack.html&sq=package:chromium&dr
(Currently expected to time out, to be removed: https://chromium-review.googlesource.com/c/chromium/src/+/715597)

And we can't run the WPT for ontrack because it relies on transceiver support:
https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-ontrack.https.html?q=RTCPeerConnection-ontrack&sq=package:chromium&dr

And MediaStream.onadd/removetrack is not tested at all. removetrack does not fire correctly when tracks are removed with PC.setRemoteDescription.

Resolving this issue has two parts:
1. Add tests, e.g.
   ontrack fires for track and 0, 1 and 2 streams
   ontrack fires after (TODO: before) setRemoteDescription resolves
   onaddstream fires after (TODO: before) setRemoteDescription resolves
   ontrack and onaddstream fire in the expcted relative order
   ontrack and onaddstream fires in the same task
   ontrack's receiver matches getReceivers()
   ontrack's streams matches getRemoteStreams()  // non-spec
   ontrack fires twice for a stream containing two tracks

   onaddstream fires for tracks added to existing streams
   onremovestream fires for tracks being removed

   onmute fires for tracks being removed
   onunmute fires for tracks being re-added ... ? // https://crbug.com/777619

2. Pass tests

 

Comment 1 by hbos@chromium.org, Oct 12 2017

Title should say ... MediaStreamTrack.onmute,onunmute

Comment 2 by hbos@chromium.org, Oct 12 2017

Status: Started (was: Untriaged)

Comment 3 by hbos@chromium.org, Oct 13 2017

The TODO in "ontrack/onaddstream fires after (TODO: before) setRemoteDescription resolves" refers to the recent spec change to change the order:

setRemoteDescription and ontrack order of events: SRD before ontrack?
https://github.com/w3c/webrtc-pc/issues/1508

The -expected.txt file can simply PASS or FAIL with a comment saying before/after.

Comment 4 by hbos@chromium.org, Oct 13 2017

And more useful tests: The order of events WRT setRemoteDescription resolving and onaddstream/onremovestream/onmute/onunmute events.
Project Member

Comment 6 by bugdroid1@chromium.org, Oct 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb

commit 7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb
Author: Henrik Boström <hbos@chromium.org>
Date: Thu Oct 19 22:28:47 2017

WPT tests for setRemoteDescription for adding and removing tracks.

These are behavior-driven tests, each test testing a specific behavior:
- addTrack() with a track and no stream should fire ontrack with a
  remote track with the same ID and no streams.
- addTrack() with a track and a stream should fire ontrack with a
  remote track and stream with matching IDs.
- addTrack() with two tracks and a shared stream should fire ontrack
  twice with remote tracks and a shared remote stream, with matching
  IDs.
- addTrack() with a track and two streams should fire ontrack with a
  track and two streams with matching IDs.
- ontrack should fire before setRemoteDescription()'s promise resolves.
- ontrack's receiver should match getReceivers().
- removeTrack() should not result in a receiver being removed.

Unlike RTCPeerConnection-ontrack.https.html, these tests do not rely on
transceiver support. When testing a behavior like "fires an event with
a track" the test does not test unrelated things like the event being a
complete implementation of RTCTrackEvent with transceivers and all.

In a follow-up, I will add tests for other behavior associated with the
removal of a track, including onmute events firing and the track being
removed from the remote streams.

Bug:  774303 
Change-Id: I87d8a79d9e2e385610f749a9146b740cc649cf3f
Reviewed-on: https://chromium-review.googlesource.com/719615
Commit-Queue: Henrik Boström <hbos@chromium.org>
Reviewed-by: Taylor Brandstetter <deadbeef@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510241}
[modify] https://crrev.com/7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-helper.js
[add] https://crrev.com/7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https-expected.txt
[add] https://crrev.com/7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html

Project Member

Comment 7 by bugdroid1@chromium.org, Oct 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4e8a1ff7c4f07b2154a40f9ff50b418ecf6df0a9

commit 4e8a1ff7c4f07b2154a40f9ff50b418ecf6df0a9
Author: Mikel Astiz <mastiz@chromium.org>
Date: Fri Oct 20 11:43:53 2017

Revert "WPT tests for setRemoteDescription for adding and removing tracks."

This reverts commit 7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb.

Reason for revert: causes tests failures on mac, e.g. https://uberchromegw.corp.google.com/i/chromium.mac/builders/Mac10.11%20Tests/builds/19421

May or may not be related to an unrelated revert that followed this original patch, https://chromium-review.googlesource.com/729719 

Original change's description:
> WPT tests for setRemoteDescription for adding and removing tracks.
> 
> These are behavior-driven tests, each test testing a specific behavior:
> - addTrack() with a track and no stream should fire ontrack with a
>   remote track with the same ID and no streams.
> - addTrack() with a track and a stream should fire ontrack with a
>   remote track and stream with matching IDs.
> - addTrack() with two tracks and a shared stream should fire ontrack
>   twice with remote tracks and a shared remote stream, with matching
>   IDs.
> - addTrack() with a track and two streams should fire ontrack with a
>   track and two streams with matching IDs.
> - ontrack should fire before setRemoteDescription()'s promise resolves.
> - ontrack's receiver should match getReceivers().
> - removeTrack() should not result in a receiver being removed.
> 
> Unlike RTCPeerConnection-ontrack.https.html, these tests do not rely on
> transceiver support. When testing a behavior like "fires an event with
> a track" the test does not test unrelated things like the event being a
> complete implementation of RTCTrackEvent with transceivers and all.
> 
> In a follow-up, I will add tests for other behavior associated with the
> removal of a track, including onmute events firing and the track being
> removed from the remote streams.
> 
> Bug:  774303 
> Change-Id: I87d8a79d9e2e385610f749a9146b740cc649cf3f
> Reviewed-on: https://chromium-review.googlesource.com/719615
> Commit-Queue: Henrik Boström <hbos@chromium.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@chromium.org>
> Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#510241}

TBR=hbos@chromium.org,deadbeef@chromium.org,foolip@chromium.org

Change-Id: I8684d63e478a2ce63d760d9ec2a973b27f985729
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  774303 
Reviewed-on: https://chromium-review.googlesource.com/730723
Reviewed-by: Mikel Astiz <mastiz@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510404}
[modify] https://crrev.com/4e8a1ff7c4f07b2154a40f9ff50b418ecf6df0a9/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-helper.js
[delete] https://crrev.com/d9f27c4c5432140035553c9d06a7fd51ef9d76a6/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https-expected.txt
[delete] https://crrev.com/d9f27c4c5432140035553c9d06a7fd51ef9d76a6/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html

Project Member

Comment 8 by bugdroid1@chromium.org, Oct 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/219e92fdb9a87e87712f43a9d883aad160aceb8f

commit 219e92fdb9a87e87712f43a9d883aad160aceb8f
Author: Henrik Boström <hbos@chromium.org>
Date: Mon Oct 23 18:35:55 2017

Revert "Revert "WPT tests for setRemoteDescription for adding and removing tracks.""

This reverts commit 4e8a1ff7c4f07b2154a40f9ff50b418ecf6df0a9.

Reason for revert:
The original CL was reverted because the eventSequence keeping track of the order
of ontrack firing and setRemoteDescription resolving was not modified when ontrack
fired, rather upon a promise resolving that was resolved when ontrack fires. This
added a delay and the order of promise then() callbacks became indeterminate. In
this reland, ontrack has been modified to do eventSequence += 'ontrack;' instead.

The original CL was reverted because of expecting:
  FAIL ontrack fires before setRemoteDescription resolves. assert_equals: expected
  "ontrack;setRemoteDescription;" but got "setRemoteDescription;ontrack;"
But got:
  PASS ontrack fires before setRemoteDescription resolves.

Original change's description:
> Revert "WPT tests for setRemoteDescription for adding and removing tracks."
> 
> This reverts commit 7224091bcdc52f1d9c7f6a8eecb3e7414f29aaeb.
> 
> Reason for revert: causes tests failures on mac, e.g. https://uberchromegw.corp.google.com/i/chromium.mac/builders/Mac10.11%20Tests/builds/19421
> 
> May or may not be related to an unrelated revert that followed this original patch, https://chromium-review.googlesource.com/729719 
> 
> Original change's description:
> > WPT tests for setRemoteDescription for adding and removing tracks.
> > 
> > These are behavior-driven tests, each test testing a specific behavior:
> > - addTrack() with a track and no stream should fire ontrack with a
> >   remote track with the same ID and no streams.
> > - addTrack() with a track and a stream should fire ontrack with a
> >   remote track and stream with matching IDs.
> > - addTrack() with two tracks and a shared stream should fire ontrack
> >   twice with remote tracks and a shared remote stream, with matching
> >   IDs.
> > - addTrack() with a track and two streams should fire ontrack with a
> >   track and two streams with matching IDs.
> > - ontrack should fire before setRemoteDescription()'s promise resolves.
> > - ontrack's receiver should match getReceivers().
> > - removeTrack() should not result in a receiver being removed.
> > 
> > Unlike RTCPeerConnection-ontrack.https.html, these tests do not rely on
> > transceiver support. When testing a behavior like "fires an event with
> > a track" the test does not test unrelated things like the event being a
> > complete implementation of RTCTrackEvent with transceivers and all.
> > 
> > In a follow-up, I will add tests for other behavior associated with the
> > removal of a track, including onmute events firing and the track being
> > removed from the remote streams.
> > 
> > Bug:  774303 
> > Change-Id: I87d8a79d9e2e385610f749a9146b740cc649cf3f
> > Reviewed-on: https://chromium-review.googlesource.com/719615
> > Commit-Queue: Henrik Boström <hbos@chromium.org>
> > Reviewed-by: Taylor Brandstetter <deadbeef@chromium.org>
> > Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#510241}
> 
> TBR=hbos@chromium.org,deadbeef@chromium.org,foolip@chromium.org
> 
> Change-Id: I8684d63e478a2ce63d760d9ec2a973b27f985729
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug:  774303 
> Reviewed-on: https://chromium-review.googlesource.com/730723
> Reviewed-by: Mikel Astiz <mastiz@chromium.org>
> Commit-Queue: Mikel Astiz <mastiz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#510404}

TBR=hbos@chromium.org,deadbeef@chromium.org,foolip@chromium.org,mastiz@chromium.org

Change-Id: I5f18c4426b9e39afbdf59537ad084c4ae461b54a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  774303 
Reviewed-on: https://chromium-review.googlesource.com/731245
Reviewed-by: Henrik Boström <hbos@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510858}
[modify] https://crrev.com/219e92fdb9a87e87712f43a9d883aad160aceb8f/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-helper.js
[add] https://crrev.com/219e92fdb9a87e87712f43a9d883aad160aceb8f/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https-expected.txt
[add] https://crrev.com/219e92fdb9a87e87712f43a9d883aad160aceb8f/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html

Comment 9 by hbos@chromium.org, Oct 23 2017

Note:

Testing the onmute event is currently untestable with the addTrack/removeTrack APIs because if you remove and re-add a track it creates a new sender (caller), receiver and remote track (callee) which does not result in the same track being unmuted.

To test we would have to do SDP munging or waiting for transceiver support where we could change the direction. That is not testing the APIs I want to test here, so I'm excluding onunmute coverage from this bug.

Comment 10 by hbos@chromium.org, Oct 23 2017

Description: Show this description

Comment 11 by hbos@chromium.org, Oct 23 2017

Filed https://crbug.com/777619 for onunmute.
Project Member

Comment 12 by bugdroid1@chromium.org, Nov 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e765c18bf7127ef44119f1aa593f9b0a0da188cb

commit e765c18bf7127ef44119f1aa593f9b0a0da188cb
Author: Henrik Boström <hbos@chromium.org>
Date: Fri Nov 10 11:36:15 2017

More WPT tests for setRemoteDescription for removing tracks.

Added to RTCPeerConnection-setRemoteDescription-tracks.https.html:
- stream.onremovetrack should fire and the track removed from stream.

Added RTCPeerConnection-setRemoteDescription-remove-tracks.https.html:
- track.onmute should fire and the track be muted.

This is placed in a separate time for now due to being unable to
"-expected.txt"-expect a TIMEOUT in Chromium, see discussion in
https://crbug.com/777526. Left a TODO to merge the files when Chromium
supports this.

Bug:  774303 , 777526
Change-Id: I1ee56e99d7abbea25d11dccfef54d8fb89b78039
Reviewed-on: https://chromium-review.googlesource.com/729149
Commit-Queue: Henrik Boström <hbos@chromium.org>
Reviewed-by: Robert Ma <robertma@chromium.org>
Reviewed-by: Taylor Brandstetter <deadbeef@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515527}
[modify] https://crrev.com/e765c18bf7127ef44119f1aa593f9b0a0da188cb/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/e765c18bf7127ef44119f1aa593f9b0a0da188cb/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-remove-tracks.https.html
[modify] https://crrev.com/e765c18bf7127ef44119f1aa593f9b0a0da188cb/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https-expected.txt
[modify] https://crrev.com/e765c18bf7127ef44119f1aa593f9b0a0da188cb/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html

Project Member

Comment 13 by bugdroid1@chromium.org, Nov 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fd687b32f27fff4d634fa780d44eacd35670aff7

commit fd687b32f27fff4d634fa780d44eacd35670aff7
Author: Henrik Boström <hbos@chromium.org>
Date: Mon Nov 13 10:17:18 2017

WPT tests for MediaStream.onaddtrack firing for remote tracks.

Test added and passed.

Bug:  774303 
Change-Id: I5b8d9a5494aacf8dad3b014788f5c9b5b4ca1f5d
Reviewed-on: https://chromium-review.googlesource.com/734332
Commit-Queue: Henrik Boström <hbos@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515914}
[modify] https://crrev.com/fd687b32f27fff4d634fa780d44eacd35670aff7/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https-expected.txt
[modify] https://crrev.com/fd687b32f27fff4d634fa780d44eacd35670aff7/third_party/WebKit/LayoutTests/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html

Comment 14 by hbos@chromium.org, Nov 13 2017

Status: Verified (was: Started)
Here's status:

FAIL addTrack() with a track and no stream makes ontrack fire with a track and no stream. assert_equals: Expected remote track not to belong to a stream. expected 0 but got 1
PASS addTrack() with a track and a stream makes ontrack fire with a track and a stream.
PASS addTrack() with two tracks and one stream makes ontrack fire twice with the tracks and shared stream.
PASS addTrack() for an existing stream makes stream.onaddtrack fire.
FAIL addTrack() with a track and two streams makes ontrack fire with a track and two streams. Failed to execute 'addTrack' on 'RTCPeerConnection': Adding a track to multiple streams is not supported.
FAIL ontrack fires before setRemoteDescription resolves. assert_equals: expected "ontrack;setRemoteDescription;" but got "setRemoteDescription;ontrack;"
PASS ontrack's receiver matches getReceivers().
FAIL removeTrack() does not remove the receiver. assert_array_equals: Expected the set of receivers to remain the same. lengths differ, expected 1 got 0
PASS removeTrack() causes onremovetrack and the track to be removed from the stream.
PASS removeTrack() causes onmute and the track to be muted.

Failures tracked elsewhere:
- onunmute is not tested or supported: https://crbug.com/777619.
- order of events is failing and is flaky:  https://crbug.com/777999 ,  https://crbug.com/777777 
- addTrack() with no stream should make ontrack fire without a stream:  https://crbug.com/webrtc/7933 
- addTrack() with multiple streams:  https://crbug.com/webrtc/7932 
- removeTrack() not causing receivers to be removed should be part of transceiver/unified plan work:  https://crbug.com/webrtc/7600 

With that, I'm closing this bug as Verified to let the other work be tracked separately.

Comment 15 by hbos@chromium.org, Nov 27 2017

Cc: hbos@chromium.org
 Issue 739104  has been merged into this issue.

Sign in to add a comment