22
22
'use strict' ;
23
23
24
24
function 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 ( ) ;
31
27
this . pc2 . ontrack = handler ;
32
28
stream . getTracks ( ) . forEach ( ( track ) => this . pc1 . addTrack ( track , stream ) ) ;
33
29
}
@@ -37,13 +33,10 @@ VideoPipe.prototype.negotiate = async function() {
37
33
this . pc2 . onicecandidate = e => this . pc1 . addIceCandidate ( e . candidate ) ;
38
34
39
35
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 ) ;
36
+ await this . pc1 . setLocalDescription ( ) ;
37
+ await this . pc2 . setRemoteDescription ( this . pc1 . localDescription ) ;
38
+ await this . pc2 . setLocalDescription ( ) ;
39
+ await this . pc1 . setRemoteDescription ( this . pc2 . localDescription ) ;
47
40
} ;
48
41
49
42
VideoPipe . prototype . close = function ( ) {
0 commit comments