Bug 183308 - Calling removeTrack with RTCRtpSender does not set SenderTrack to null
Summary: Calling removeTrack with RTCRtpSender does not set SenderTrack to null
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 11
Hardware: Mac macOS 10.13
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-02 18:07 PST by Thomas Mullen
Modified: 2018-03-13 14:15 PDT (History)
5 users (show)

See Also:


Attachments
Patch (4.57 KB, patch)
2018-03-12 14:42 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Mullen 2018-03-02 18:07:57 PST
Calling RTCPeerConnection.removeTrack with a RTCRtpSender does not set the sender's "track" attribute to null.

This is against the the specification: https://www.w3.org/TR/webrtc/#removeTrack

Both Chrome and Firefox do this and it is important to determining if a sender has been removed after renegotiation.
Comment 1 Thomas Mullen 2018-03-02 18:08:46 PST
Simple way to reproduce:

```
var config = {
  "iceTransports": 'all',
  "iceServers": [{
    "urls": "stun:global.stun.twilio.com:3478?transport=udp"
  }]
}

var pc = new RTCPeerConnection(config)
var getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia).bind(navigator)

getUserMedia({
  video: true,
  audio: true
}, function(stream) {
  var track = stream.getTracks()[0]
  var sender = pc.addTrack(track, stream)
  pc.removeTrack(sender)
  console.log(sender.track) // should be null
}, function(err) {
  throw err
})
```
Comment 2 youenn fablet 2018-03-12 14:42:20 PDT
Created attachment 335641 [details]
Patch
Comment 3 WebKit Commit Bot 2018-03-13 14:14:18 PDT
Comment on attachment 335641 [details]
Patch

Clearing flags on attachment: 335641

Committed r229587: <https://trac.webkit.org/changeset/229587>
Comment 4 WebKit Commit Bot 2018-03-13 14:14:19 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2018-03-13 14:15:35 PDT
<rdar://problem/38431087>