Re: [webrtc-pc] Add paragraph about RtpContributingSources being updated simultaneously.

@jan-ivar Putting this in the form of an algorithm is probably a good idea since that's what we do in most places.

Would we be covered if I just replaced "when X happens, the relevant `RTCRtpContributingSource` objects are updated" with "when X happens, the user agent MUST queue a task to update the relevant `RTCRtpContributingSource` objects"? The actual implementation would still be allowed to do something different, due to this paragraph:

> Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)

Can you confirm that this is flexible enough to make Chrome's current implementation legal? Since queuing a task for each packet received is obviously bad for performance, it's doing the equivalent of this instead (code simplified for brevity):

RTCContributingSources RTCRtpReceiver::getContributingSources() {
  if (should_update_) {
    should_update_ = false;
  queueMicrotask([this] { should_update_ = true; });
  return contributing_sources_;

// Many, many layers of code deeper:
void InternalRtpReceiver::OnPacketReceived(Packet* p) {
  // ...

ContributingSources InternalRtpReceiver::GetContributingSources() {
  return contributing_sources_;

The full code can be seen [here](

Anyway, this ensures:

1. Within a single event loop task execution, the attributes of a given `RTCRtpContributingSource` will not change.
2. Within a single event loop task execution, all of the `RTCRtpContributingSource` objects for a given receiver will return information for the same point in the RTP stream.

Those are the requirements I really wanted to convey, but I was unsure how to phrase them in terminology that's consistent with the rest of the spec.

GitHub Notification of comment by taylor-b
Please view or discuss this issue at using your GitHub account

Received on Thursday, 4 May 2017 21:08:21 UTC