Trying to remove RTCIceTransport.createAssociatedTransport(component)... #209

Closed
robin-raymond opened this Issue May 26, 2015 · 4 comments

Projects

None yet

3 participants

@robin-raymond
Contributor

Trying to remove RTCIceTransport.createAssociatedTransport(component) in favour of RTCIceGatherer.createAssociatedGatherer(component). Bit of an issue, not sure how we can associate RTP to RTCP for transports (especially in forking) for the sake of freezing RTCP against RTP... Needs more research before we remove this method.

@robin-raymond
Contributor

Related to #188

@aboba
Contributor
aboba commented May 26, 2015

Taking a look at sample code below, I think the issue comes down to the following lines:

// Create the ICE RTP and RTCP transports
var iceRtpTransport = new RTCIceTransport(iceRtpGatherer);
// Would iceRtcpTransport = new RTCIceTransport(iceRtcpGatherer); work just as well?
var iceRtcpTransport = iceRtpTransport.createAssociatedTransport();
// Create the ICE Transport Controller object and add the RTP Ice Transport to it
var controller = new RTCIceTransportController();
controller.addTransport(iceRtpTransport);

[BA] In the above example, without iceRtpTransport.createAssociatedTransport() we can still construct iceRtcpTransport from the iceRtcpGatherer.

However, the problem comes in calling controller.addTransport(iceRtpTransport) because the IceTransportController would no longer be able to determine that iceRtcpTransport is the RTCP IceTransport associated with iceRtpTransport. This information is available to the RtpSender/RtpReceiver objects once they are constructed, but those objects are not arguments to IceTransportController.

Example

// Example to demonstrate forking when RTP and RTCP are not multiplexed,
// so that both RTP and RTCP IceGatherer and IceTransport objects are needed.
// Create ICE gather options
var gatherOptions = new RTCIceGatherOptions();
gatherOptions.gatherPolicy = RTCIceGatherPolicy.relay;
gatherOptions.iceservers = ... ;
// Create ICE gatherer objects
var iceRtpGatherer = new RTCIceGatherer(gatherOptions);
var iceRtcpGatherer = iceRtpGatherer.createAssociatedGatherer();
// Prepare to signal local candidates
iceRtpGatherer.onlocalcandidate = function (event) {mySendLocalCandidate(RTCIceComponent.RTP, event.candidate)};
iceRtcpGatherer.onlocalcandidate = function (event) {mySendLocalCandidate(RTCIceComponent.RTCP, event.candidate)};

mySendInitiate({
"icertp": iceRtpGatherer.getLocalParameters(),
"icertcp": iceRtcpGatherer.getLocalParameters()
},
function(response) {
// We may get N responses
//
// Create the ICE RTP and RTCP transports
var iceRtpTransport = new RTCIceTransport(iceRtpGatherer);
// Would iceRtcpTransport = new RTCIceTransport(iceRtcpGatherer); work just as well?
var iceRtcpTransport = iceRtpTransport.createAssociatedTransport();
// Create the ICE Transport Controller object and add the RTP Ice Transport to it
var controller = new RTCIceTransportController();
controller.addTransport(iceRtpTransport);
// Start the RTP and RTCP ICE transports so that outgoing ICE connectivity checks can begin
iceRtpTransport.start(iceRtpGatherer, response.icertp, RTCIceRole.controlling);
iceRtcpTransport.start(iceRtcpGatherer, response.icertcp, RTCIceRole.controlling);
// Prepare to add ICE candidates signalled by the remote peer
mySignaller.onRemoteCandidate = function(remote) {
if (remote.component == RTCIceComponent.RTP){
iceRtpTransport.addRemoteCandidate(remote.candidate);
} else {
iceRtcpTransport.addRemoteCandidate(remote.candidate);
};
}

// ... setup DTLS, RTP, SCTP, etc.
});

function mySendLocalCandidate(component, candidate){
mySignaller.mySendLocalCandidate({
"candidate": candidate,
"component": component
});
}

@aboba aboba added the 1.1 label May 26, 2015
@pthatcherg

I think the line of code "var iceRtcpTransport = new RTCIceTransport(iceRtcpGatherer);" should work. The IceController can know that the IceTransport is for RTCP because the gatherer is for RTCP.

But note that this means that when the IceTransport restarts (with a new IceGatherer), it could potentially change from RTCP to RTP. While strange, I don't see a problem with this. The implementation of IceController would just need to know that the IceTransport was restarted, which it probably should anyway, and then know to look at the IceTransport.gatherer.component again.

@aboba
Contributor
aboba commented Sep 12, 2015

"var iceRtcpTransport = new RTCIceTransport(iceRtcpGatherer);" creates an RTCP IceTransport. However, in the case of forking, there can be multiple potential RTP IceTransports that it could be associated with (created via: "var iceRtpTransport = new RTCIceTransport(iceRtpGatherer); ") and the browser will not necessarily know which is which.

Another complication created by forking.

@aboba aboba added the wontfix label Sep 16, 2015
@aboba aboba closed this Oct 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment