I am trying to test/run/learn some WebRTC code and am having problem understanding this code from Mozilla:
...
var pc = new RTCPeerConnection();
...
pc.createOffer(function(offer) {
pc.setLocalDescription(new RTCSessionDescription(offer), function() {
// send the offer
}, error);
}, error);
The problem I have in understanding this is that pc.createOffer already returns an "offer" object with two properties: type and sdp. So, why is "new RTCSessionDescription(offer)" passed as an argument to pc.setLocalDescription and not "offer" itself as returned by pc.createOffer?
I read on RTCSessionDescription interface here. What did I miss?