2222'use strict' ;
2323
2424function VideoPipe ( stream , forceSend , forceReceive , handler ) {
25- this . pc1 = new RTCPeerConnection ( {
26- encodedInsertableStreams : forceSend ,
27- } ) ;
28- this . pc2 = new RTCPeerConnection ( {
29- encodedInsertableStreams : forceReceive ,
30- } ) ;
25+ this . pc1 = new RTCPeerConnection ( ) ;
26+ this . pc2 = new RTCPeerConnection ( ) ;
3127 this . pc2 . ontrack = handler ;
3228 stream . getTracks ( ) . forEach ( ( track ) => this . pc1 . addTrack ( track , stream ) ) ;
3329}
@@ -36,14 +32,10 @@ VideoPipe.prototype.negotiate = async function() {
3632 this . pc1 . onicecandidate = e => this . pc2 . addIceCandidate ( e . candidate ) ;
3733 this . pc2 . onicecandidate = e => this . pc1 . addIceCandidate ( e . candidate ) ;
3834
39- const offer = await this . pc1 . createOffer ( ) ;
40- // Disable video/red to allow for easier inspection in Wireshark.
41- await this . pc2 . setRemoteDescription ( { type : 'offer' , sdp : offer . sdp . replace ( 'red/90000' , 'green/90000' ) } ) ;
42- await this . pc1 . setLocalDescription ( offer ) ;
43-
44- const answer = await this . pc2 . createAnswer ( ) ;
45- await this . pc1 . setRemoteDescription ( answer ) ;
46- await this . pc2 . setLocalDescription ( answer ) ;
35+ await this . pc1 . setLocalDescription ( ) ;
36+ await this . pc2 . setRemoteDescription ( this . pc1 . localDescription ) ;
37+ await this . pc2 . setLocalDescription ( ) ;
38+ await this . pc1 . setRemoteDescription ( this . pc2 . localDescription ) ;
4739} ;
4840
4941VideoPipe . prototype . close = function ( ) {
0 commit comments