Re: [webrtc-pc] Unable to figure out which receivers are "active".

To summarize:
- [[Direction]] is whatever we want to negotiate. This does not work for either offerer or answerer because the notion of "active" implies some negotiation has taken place.
- [[CurrentDirection]] is defined as _the last applied answer_. This works for the offerer, but not the answerer until answerer does SLD(answer). The notion of "active" includes the "ontrack"-transceivers, but SLD(answer) happens after "ontrack".
- [[FiredDirection]] is defined as the last applied SDP direction, regardless if it is an offer or answer. This works for the answerer, but for the offerer this would include non-"ontrack"-transceivers that have not been confirmed by the remote endpoint yet.

This gets trickier. For early media, a receiver might become "active" either by applying a remote description, or by early media arriving to unmute the track.

**Proposal**

I think if _any_ of the following is true the receiver is "active":
- `transceiver.currentDirection == 'sendrecv' || transceiver.currentDirection == 'recvonly'`: This covers any case where answer has been applied (such as when we are in a stable state, or when we have setLocalDescription(answer) and rejected transceivers that were previously offered by the remote endpoint).
- `transceiver.receiver.track.muted == false`: This covers case where media has arrived, even if answer has not been applied yet, such as when receiving _early media_ from the answerer to the offerer.
- `pc.signalingState == 'have-remote-offer' && (transceiver.[[FiredDirection]] == 'sendrecv' || transceiver.[[FiredDirection]] == 'recvonly')`: This covers "ontrack"-transceivers that were fired by setRemoteDescription(offer), but whose currentDirection does not reflect this because we have not done setLocalDescription(answer) yet.

We should add:
```
partial interface RTCRtpReceiver {
    readonly attribute boolean isActive;
}
```
That is defined as any of the above criteria being true. This is not applicable to ORTC since it is dependent on RTCPeerConnection and the state of SDP offer/answer.

-- 
GitHub Notification of comment by henbos
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1920#issuecomment-402706696 using your GitHub account

Received on Thursday, 5 July 2018 12:32:15 UTC