Bug 183308

Summary: Calling removeTrack with RTCRtpSender does not set SenderTrack to null
Product: WebKit Reporter: Thomas Mullen <thomasmullendesign>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: Mac   
OS: macOS 10.13   
Attachments:
Description Flags
Patch none

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>