According to the spec, addTrack() and removeTrack() called by local JavaScript must not fire "addtrack" and "removetrack" events. The events must however fire if the track set is modified externally (e.g., a track is removed at the other peer in a p2p scenario).
Created attachment 190725 [details] Proposed patch I replaced the entire test since the old one was driven by the event dispatching removed by this patch.
@tommyw: Thoughts?
Since Adam is one of the main editors of the specification he very, very likely knows it better than me ;) This patch looks just dandy to me, but maybe the spec needs a little bit of clarification exactly when the add/removeTrack events are thrown (only for streams originating from an remote peer).
Comment on attachment 190725 [details] Proposed patch ok :)
Comment on attachment 190725 [details] Proposed patch Clearing flags on attachment: 190725 Committed r144610: <http://trac.webkit.org/changeset/144610>
All reviewed patches have been landed. Closing bug.
Thanks :) (In reply to comment #3) > This patch looks just dandy to me, but maybe the spec needs a little bit of clarification exactly when the add/removeTrack events are thrown (only for streams originating from an remote peer). I think the text describing these events suffered the most when we extracted the "Media Capture and Streams" stuff from the WebRTC spec. The events are defined in the "Media Capture" spec, but never used there; the usage is described in the WebRTC spec (Section "9.2.2 Events on MediaStream" [1]). Please provide some feedback if you think that section needs to be improved. There's an non-normative "Event Summary" section in the "Media Capture" spec with short descriptive text for each event. The current text says: "A new MediaStreamTrack has been added to this stream.". We could change the text to make it more clear that these events are used to notify the script about external modifications to the track lists. [1] http://dev.w3.org/2011/webrtc/editor/webrtc.html#events-on-mediastream