New issue
Advanced search Search tips

Issue 860853 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: 2018-07-23
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Calling removeTrack twice shouldn't throw an InvalidAccessError

Reported by markandr...@gmail.com, Jul 7

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce the problem:
Run the following code in Chrome, Firefox, and Safari:

    (() => {
      const ac = new (typeof AudioContext !== 'undefined'
        ? AudioContext
        : webkitAudioContext)();
      const { stream } = ac.createMediaStreamDestination();
      const [track] = stream.getTracks();
      const pc = new RTCPeerConnection({ sdpSemantics: 'unified-plan' });
      const sender = pc.addTrack(track, stream);
      console.log(pc.getSenders().includes(sender));
      pc.removeTrack(sender);
      console.log(pc.getSenders().includes(sender));
      try {
        pc.removeTrack(sender);
      } catch (error) {
        throw error;
      } finally {
        pc.close();
        ac.close();
      }
    })();

What is the expected behavior?
Firefox and Safari:

> true
> true

What went wrong?
Chrome:

> true
> false
> Uncaught DOMException: Failed to execute 'removeTrack' on 'RTCPeerConnection': The sender was not created by this peer connection.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 67.0.3396.99  Channel: stable
OS Version: OS X 10.12.6
Flash Version: 

Based on my reading of https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-removetrack, I think the second call to removeTrack should not throw, since the sender was in fact created by connection.

> ...
> 4. If sender was not created by connection, throw an InvalidAccessError.
> 5. Let senders be the result of executing the CollectSenders algorithm.
> 6. If sender is not in senders (which indicates that it was removed due to setting an RTCSessionDescription of type "rollback"), then abort these steps.
> ...
 
Components: -Blink>WebRTC Blink>WebRTC>PeerConnection
hbos, please take a look. There is also a still-failing test in adapter for this :-p
Labels: Needs-Triage-M67
Labels: Triaged-ET
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on 60.0.3072.0(M-60),reported version 67.0.3396.99 and latest chrome 69.0.3485.0 by following below steps.
1.Open Devtools.
2.Executed the given code.
3.Could observe an error is being occured- VM79:8 Uncaught TypeError: pc.addTrack is not a function at <anonymous>:8:25 at <anonymous>:20:7.

Attached screenshot for reference.

Hence, marking it as untriaged to get more inputs from dev team.

Thanks...!!

860853.png
263 KB View Download
Owner: hbos@chromium.org
Status: Assigned (was: Untriaged)
hbos@: Can you take a look?
NextAction: 2018-07-23
This will be fixed with RTCRtpTransceivers ( https://crbug.com/777617 ).

It would be a very simple thing to fix for the current sender/receiver-only behavior of Chrome though.

Reminder for myself to revisit next week.
The NextAction date has arrived: 2018-07-23
What's the status here?

Sign in to add a comment