werift 0.19.9 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/src/event.d.ts +45 -0
- package/lib/common/src/event.js +232 -0
- package/lib/common/src/event.js.map +1 -0
- package/lib/common/src/index.d.ts +1 -0
- package/lib/common/src/index.js +1 -0
- package/lib/common/src/index.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +6 -1
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/imports/common.d.ts +1 -0
- package/lib/dtls/src/imports/common.js +18 -0
- package/lib/dtls/src/imports/common.js.map +1 -0
- package/lib/dtls/src/socket.d.ts +1 -1
- package/lib/dtls/src/socket.js +5 -5
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidate.d.ts +1 -1
- package/lib/ice/src/candidate.js +2 -1
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/helper.js +2 -2
- package/lib/ice/src/helper.js.map +1 -1
- package/lib/ice/src/ice.d.ts +10 -5
- package/lib/ice/src/ice.js +46 -16
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/imports/common.d.ts +1 -0
- package/lib/ice/src/imports/common.js +18 -0
- package/lib/ice/src/imports/common.js.map +1 -0
- package/lib/ice/src/index.d.ts +4 -0
- package/lib/ice/src/index.js +4 -0
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/stun/message.d.ts +1 -0
- package/lib/ice/src/stun/message.js +16 -6
- package/lib/ice/src/stun/message.js.map +1 -1
- package/lib/ice/src/stun/protocol.d.ts +3 -2
- package/lib/ice/src/stun/protocol.js +13 -7
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.js +4 -3
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/transport.d.ts +21 -4
- package/lib/ice/src/transport.js +115 -7
- package/lib/ice/src/transport.js.map +1 -1
- package/lib/ice/src/turn/protocol.d.ts +52 -36
- package/lib/ice/src/turn/protocol.js +183 -76
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +5 -5
- package/lib/ice/src/types/model.js.map +1 -1
- package/lib/ice/src/utils.d.ts +1 -0
- package/lib/ice/src/utils.js +15 -16
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/container.d.ts +1 -1
- package/lib/rtp/src/extra/container/mp4/container.js +2 -5
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.js +2 -2
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.d.ts +1 -1
- package/lib/rtp/src/extra/processor/mp4.js +2 -5
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.d.ts +1 -1
- package/lib/rtp/src/extra/processor/nack.js +3 -3
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.js +2 -5
- package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js +2 -5
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/webm.d.ts +1 -1
- package/lib/rtp/src/extra/processor/webm.js +2 -5
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/imports/common.d.ts +1 -0
- package/lib/rtp/src/imports/common.js +18 -0
- package/lib/rtp/src/imports/common.js.map +1 -0
- package/lib/sctp/src/helper.js +2 -5
- package/lib/sctp/src/helper.js.map +1 -1
- package/lib/sctp/src/imports/common.d.ts +1 -0
- package/lib/sctp/src/imports/common.js +18 -0
- package/lib/sctp/src/imports/common.js.map +1 -0
- package/lib/sctp/src/sctp.d.ts +1 -1
- package/lib/sctp/src/sctp.js +3 -3
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/webrtc/src/dataChannel.d.ts +1 -1
- package/lib/webrtc/src/dataChannel.js +5 -5
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/imports/common.d.ts +1 -0
- package/lib/webrtc/src/imports/common.js +18 -0
- package/lib/webrtc/src/imports/common.js.map +1 -0
- package/lib/webrtc/src/media/receiver/nack.d.ts +1 -1
- package/lib/webrtc/src/media/receiver/nack.js +2 -2
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +2 -2
- package/lib/webrtc/src/media/rtpReceiver.js +2 -5
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +1 -1
- package/lib/webrtc/src/media/rtpSender.js +5 -5
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.js +2 -5
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.js +4 -7
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/track.d.ts +1 -1
- package/lib/webrtc/src/media/track.js +4 -7
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +2 -1
- package/lib/webrtc/src/nonstandard/recorder/index.js +2 -5
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +9 -6
- package/lib/webrtc/src/peerConnection.js +31 -18
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +1 -1
- package/lib/webrtc/src/transport/dtls.js +12 -8
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +3 -3
- package/lib/webrtc/src/transport/ice.js +14 -8
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +1 -1
- package/lib/webrtc/src/transport/sctp.js +2 -2
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/package.json +1 -1
- package/src/dataChannel.ts +1 -1
- package/src/imports/common.ts +1 -0
- package/src/media/receiver/nack.ts +1 -1
- package/src/media/rtpReceiver.ts +1 -1
- package/src/media/rtpSender.ts +1 -1
- package/src/media/rtpTransceiver.ts +1 -1
- package/src/media/sender/senderBWE.ts +1 -1
- package/src/media/track.ts +1 -1
- package/src/nonstandard/recorder/index.ts +3 -1
- package/src/nonstandard/recorder/writer/index.ts +1 -1
- package/src/nonstandard/recorder/writer/webm.ts +1 -1
- package/src/peerConnection.ts +30 -15
- package/src/transport/dtls.ts +11 -5
- package/src/transport/ice.ts +14 -8
- package/src/transport/sctp.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webm.js","sourceRoot":"","sources":["../../../../../../src/nonstandard/recorder/writer/webm.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"webm.js","sourceRoot":"","sources":["../../../../../../src/nonstandard/recorder/writer/webm.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AACrC,oDAAwD;AAExD,wBAAgC;AAChC,gCAA8D;AAC9D,wDAWsC;AAEtC,MAAM,UA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AAE,KAAK,EAAE,MAAM,CAAU,CAAC","sourcesContent":["import { unlink } from \"fs/promises\";\nimport { EventDisposer } from \"../../../imports/common\";\n\nimport { MediaWriter } from \".\";\nimport { type MediaStreamTrack, WeriftError } from \"../../..\";\nimport {\n DepacketizeCallback,\n JitterBufferCallback,\n LipsyncCallback,\n NtpTimeCallback,\n RtcpSourceCallback,\n RtpSourceCallback,\n RtpTimeCallback,\n type SupportedCodec,\n WebmCallback,\n saveToFileSystem,\n} from \"../../../../../rtp/src/extra\";\n\nconst sourcePath = \"packages/webrtc/src/nonstandard/recorder/writer/webm.ts\";\n\nexport class WebmFactory extends MediaWriter {\n rtpSources: RtpSourceCallback[] = [];\n\n unSubscribers = new EventDisposer();\n\n async start(tracks: MediaStreamTrack[]) {\n if (this.props.path) {\n await unlink(this.props.path).catch((e) => e);\n }\n\n const inputTracks = tracks.map((track, i) => {\n const trackNumber = i + 1;\n const payloadType = track.codec!.payloadType;\n\n if (track.kind === \"video\") {\n const codec = ((): SupportedCodec => {\n switch (track.codec?.name.toLowerCase() as SupportedVideoCodec) {\n case \"vp8\":\n return \"VP8\";\n case \"vp9\":\n return \"VP9\";\n case \"h264\":\n return \"MPEG4/ISO/AVC\";\n case \"av1x\":\n return \"AV1\";\n default:\n throw new WeriftError({\n message: \"unsupported codec\",\n payload: { track, path: sourcePath },\n });\n }\n })();\n return {\n kind: \"video\" as const,\n codec,\n clockRate: 90000,\n trackNumber,\n width: this.props.width ?? 640,\n height: this.props.height ?? 360,\n payloadType,\n track,\n };\n } else {\n return {\n kind: \"audio\" as const,\n codec: \"OPUS\" as const,\n clockRate: 48000,\n trackNumber,\n payloadType,\n track,\n };\n }\n });\n\n const webm = new WebmCallback(inputTracks, {\n duration: this.props.defaultDuration ?? 1000 * 60 * 60 * 24,\n });\n const lipsync = new LipsyncCallback();\n\n if (inputTracks.length === 1 || this.props.disableNtp) {\n this.props.disableLipSync = true;\n }\n\n this.rtpSources = inputTracks.map(({ track, clockRate, codec }) => {\n const rtpSource = new RtpSourceCallback();\n const rtcpSource = new RtcpSourceCallback();\n track.onReceiveRtp\n .subscribe((rtp) => {\n rtpSource.input(rtp.clone());\n })\n .disposer(this.unSubscribers);\n track.onReceiveRtcp\n .subscribe((rtcp) => {\n rtcpSource.input(rtcp);\n })\n .disposer(this.unSubscribers);\n const time = this.props.disableNtp\n ? new RtpTimeCallback(clockRate)\n : new NtpTimeCallback(clockRate);\n\n if (track.kind === \"video\") {\n const depacketizer = new DepacketizeCallback(codec, {\n isFinalPacketInSequence: (h) => h.marker,\n });\n const jitterBuffer = new JitterBufferCallback(clockRate, {\n bufferSize: this.props.jitterBufferSize,\n latency: this.props.jitterBufferLatency,\n });\n\n rtpSource.pipe(jitterBuffer.input);\n rtcpSource.pipe(time.input);\n\n jitterBuffer.pipe(time.input);\n time.pipe(depacketizer.input);\n if (this.props.disableLipSync) {\n depacketizer.pipe(webm.inputVideo);\n } else {\n depacketizer.pipe(lipsync.inputVideo);\n lipsync.pipeVideo(webm.inputVideo);\n }\n } else {\n const depacketizer = new DepacketizeCallback(codec);\n\n rtpSource.pipe(time.input);\n rtcpSource.pipe(time.input);\n\n time.pipe(depacketizer.input);\n if (this.props.disableLipSync) {\n depacketizer.pipe(webm.inputAudio);\n } else {\n depacketizer.pipe(lipsync.inputAudio);\n lipsync.pipeAudio(webm.inputAudio);\n }\n }\n\n return rtpSource;\n });\n if (this.props.path) {\n webm.pipe(saveToFileSystem(this.props.path));\n } else if (this.props.stream) {\n webm.pipe(async (o) => {\n this.props.stream.execute(o);\n });\n }\n }\n\n async stop() {\n await Promise.all(this.rtpSources.map((r) => r.stop()));\n this.unSubscribers.dispose();\n }\n}\n\nconst supportedVideoCodecs = [\"h264\", \"vp8\", \"vp9\", \"av1x\"] as const;\ntype SupportedVideoCodec = (typeof supportedVideoCodecs)[number];\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Event from "
|
|
1
|
+
import { Event } from "./imports/common";
|
|
2
2
|
import { type Address, type CandidatePair, type InterfaceAddresses } from ".";
|
|
3
3
|
import { type DtlsKeys } from ".";
|
|
4
4
|
import type { Message } from "../../ice/src/stun/message";
|
|
@@ -30,14 +30,14 @@ export declare class RTCPeerConnection extends EventTarget {
|
|
|
30
30
|
private pushTransceiver;
|
|
31
31
|
private replaceTransceiver;
|
|
32
32
|
candidatesSent: Set<string>;
|
|
33
|
-
readonly iceGatheringStateChange: Event<["
|
|
33
|
+
readonly iceGatheringStateChange: Event<["complete" | "new" | "gathering"]>;
|
|
34
34
|
readonly iceConnectionStateChange: Event<["disconnected" | "closed" | "completed" | "new" | "connected" | "failed" | "checking"]>;
|
|
35
35
|
readonly signalingStateChange: Event<["closed" | "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer"]>;
|
|
36
36
|
readonly connectionStateChange: Event<["disconnected" | "closed" | "new" | "connected" | "connecting" | "failed"]>;
|
|
37
37
|
readonly onDataChannel: Event<[RTCDataChannel]>;
|
|
38
38
|
readonly onRemoteTransceiverAdded: Event<[RTCRtpTransceiver]>;
|
|
39
39
|
readonly onTransceiverAdded: Event<[RTCRtpTransceiver]>;
|
|
40
|
-
readonly onIceCandidate: Event<[RTCIceCandidate]>;
|
|
40
|
+
readonly onIceCandidate: Event<[RTCIceCandidate | undefined]>;
|
|
41
41
|
readonly onNegotiationneeded: Event<[]>;
|
|
42
42
|
readonly onTrack: Event<[MediaStreamTrack]>;
|
|
43
43
|
ondatachannel?: CallbackWithValue<RTCDataChannelEvent>;
|
|
@@ -64,8 +64,10 @@ export declare class RTCPeerConnection extends EventTarget {
|
|
|
64
64
|
constructor(config?: Partial<PeerConfig>);
|
|
65
65
|
get localDescription(): import("./sdp").RTCSessionDescription | undefined;
|
|
66
66
|
get remoteDescription(): import("./sdp").RTCSessionDescription | undefined;
|
|
67
|
-
private
|
|
68
|
-
|
|
67
|
+
/**@private */
|
|
68
|
+
get _localDescription(): SessionDescription | undefined;
|
|
69
|
+
/**@private */
|
|
70
|
+
get _remoteDescription(): SessionDescription | undefined;
|
|
69
71
|
private getTransceiverByMid;
|
|
70
72
|
private getTransceiverByMLineIndex;
|
|
71
73
|
getConfiguration(): Required<PeerConfig>;
|
|
@@ -149,6 +151,7 @@ export interface PeerConfig {
|
|
|
149
151
|
iceAdditionalHostAddresses: string[] | undefined;
|
|
150
152
|
iceUseIpv4: boolean;
|
|
151
153
|
iceUseIpv6: boolean;
|
|
154
|
+
forceTurnTCP: boolean;
|
|
152
155
|
/** If provided, is called on each STUN request.
|
|
153
156
|
* Return `true` if a STUN response should be sent, false if it should be skipped. */
|
|
154
157
|
iceFilterStunResponse: ((message: Message, addr: Address, protocol: Protocol) => boolean) | undefined;
|
|
@@ -186,7 +189,7 @@ export interface RTCDataChannelEvent {
|
|
|
186
189
|
channel: RTCDataChannel;
|
|
187
190
|
}
|
|
188
191
|
export interface RTCPeerConnectionIceEvent {
|
|
189
|
-
candidate
|
|
192
|
+
candidate?: RTCIceCandidate;
|
|
190
193
|
}
|
|
191
194
|
export interface RTCSessionDescriptionInit {
|
|
192
195
|
sdp?: string;
|
|
@@ -34,8 +34,8 @@ exports.allocateMid = allocateMid;
|
|
|
34
34
|
const debug_1 = __importDefault(require("debug"));
|
|
35
35
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
36
36
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
37
|
-
const rx_mini_1 = __importDefault(require("rx.mini"));
|
|
38
37
|
const uuid = __importStar(require("uuid"));
|
|
38
|
+
const common_1 = require("./imports/common");
|
|
39
39
|
const _1 = require(".");
|
|
40
40
|
const _2 = require(".");
|
|
41
41
|
const const_1 = require("./const");
|
|
@@ -150,61 +150,61 @@ class RTCPeerConnection extends helper_1.EventTarget {
|
|
|
150
150
|
enumerable: true,
|
|
151
151
|
configurable: true,
|
|
152
152
|
writable: true,
|
|
153
|
-
value: new
|
|
153
|
+
value: new common_1.Event()
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(this, "iceConnectionStateChange", {
|
|
156
156
|
enumerable: true,
|
|
157
157
|
configurable: true,
|
|
158
158
|
writable: true,
|
|
159
|
-
value: new
|
|
159
|
+
value: new common_1.Event()
|
|
160
160
|
});
|
|
161
161
|
Object.defineProperty(this, "signalingStateChange", {
|
|
162
162
|
enumerable: true,
|
|
163
163
|
configurable: true,
|
|
164
164
|
writable: true,
|
|
165
|
-
value: new
|
|
165
|
+
value: new common_1.Event()
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(this, "connectionStateChange", {
|
|
168
168
|
enumerable: true,
|
|
169
169
|
configurable: true,
|
|
170
170
|
writable: true,
|
|
171
|
-
value: new
|
|
171
|
+
value: new common_1.Event()
|
|
172
172
|
});
|
|
173
173
|
Object.defineProperty(this, "onDataChannel", {
|
|
174
174
|
enumerable: true,
|
|
175
175
|
configurable: true,
|
|
176
176
|
writable: true,
|
|
177
|
-
value: new
|
|
177
|
+
value: new common_1.Event()
|
|
178
178
|
});
|
|
179
179
|
Object.defineProperty(this, "onRemoteTransceiverAdded", {
|
|
180
180
|
enumerable: true,
|
|
181
181
|
configurable: true,
|
|
182
182
|
writable: true,
|
|
183
|
-
value: new
|
|
183
|
+
value: new common_1.Event()
|
|
184
184
|
});
|
|
185
185
|
Object.defineProperty(this, "onTransceiverAdded", {
|
|
186
186
|
enumerable: true,
|
|
187
187
|
configurable: true,
|
|
188
188
|
writable: true,
|
|
189
|
-
value: new
|
|
189
|
+
value: new common_1.Event()
|
|
190
190
|
});
|
|
191
191
|
Object.defineProperty(this, "onIceCandidate", {
|
|
192
192
|
enumerable: true,
|
|
193
193
|
configurable: true,
|
|
194
194
|
writable: true,
|
|
195
|
-
value: new
|
|
195
|
+
value: new common_1.Event()
|
|
196
196
|
});
|
|
197
197
|
Object.defineProperty(this, "onNegotiationneeded", {
|
|
198
198
|
enumerable: true,
|
|
199
199
|
configurable: true,
|
|
200
200
|
writable: true,
|
|
201
|
-
value: new
|
|
201
|
+
value: new common_1.Event()
|
|
202
202
|
});
|
|
203
203
|
Object.defineProperty(this, "onTrack", {
|
|
204
204
|
enumerable: true,
|
|
205
205
|
configurable: true,
|
|
206
206
|
writable: true,
|
|
207
|
-
value: new
|
|
207
|
+
value: new common_1.Event()
|
|
208
208
|
});
|
|
209
209
|
Object.defineProperty(this, "ondatachannel", {
|
|
210
210
|
enumerable: true,
|
|
@@ -387,9 +387,11 @@ class RTCPeerConnection extends helper_1.EventTarget {
|
|
|
387
387
|
}
|
|
388
388
|
return this._remoteDescription.toJSON();
|
|
389
389
|
}
|
|
390
|
+
/**@private */
|
|
390
391
|
get _localDescription() {
|
|
391
392
|
return this.pendingLocalDescription || this.currentLocalDescription;
|
|
392
393
|
}
|
|
394
|
+
/**@private */
|
|
393
395
|
get _remoteDescription() {
|
|
394
396
|
return this.pendingRemoteDescription || this.currentRemoteDescription;
|
|
395
397
|
}
|
|
@@ -584,6 +586,7 @@ class RTCPeerConnection extends helper_1.EventTarget {
|
|
|
584
586
|
filterCandidatePair: this.config.iceFilterCandidatePair,
|
|
585
587
|
useIpv4: this.config.iceUseIpv4,
|
|
586
588
|
useIpv6: this.config.iceUseIpv6,
|
|
589
|
+
turnTransport: this.config.forceTurnTCP === true ? "tcp" : "udp",
|
|
587
590
|
});
|
|
588
591
|
if (existing) {
|
|
589
592
|
iceGatherer.connection.localUserName = existing.connection.localUserName;
|
|
@@ -602,6 +605,15 @@ class RTCPeerConnection extends helper_1.EventTarget {
|
|
|
602
605
|
log("localDescription not found when ice candidate was gathered");
|
|
603
606
|
return;
|
|
604
607
|
}
|
|
608
|
+
if (!candidate) {
|
|
609
|
+
this.setLocal(this._localDescription);
|
|
610
|
+
this.onIceCandidate.execute(undefined);
|
|
611
|
+
if (this.onicecandidate) {
|
|
612
|
+
this.onicecandidate({ candidate: undefined });
|
|
613
|
+
}
|
|
614
|
+
this.emit("icecandidate", { candidate: undefined });
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
605
617
|
if (this.config.bundlePolicy === "max-bundle" || this.remoteIsBundled) {
|
|
606
618
|
candidate.sdpMLineIndex = 0;
|
|
607
619
|
const media = this._localDescription?.media[0];
|
|
@@ -733,6 +745,13 @@ class RTCPeerConnection extends helper_1.EventTarget {
|
|
|
733
745
|
this.setConnectionState("failed");
|
|
734
746
|
});
|
|
735
747
|
}
|
|
748
|
+
this.setLocal(description);
|
|
749
|
+
if (this.shouldNegotiationneeded) {
|
|
750
|
+
this.needNegotiation();
|
|
751
|
+
}
|
|
752
|
+
return description;
|
|
753
|
+
}
|
|
754
|
+
setLocal(description) {
|
|
736
755
|
description.media
|
|
737
756
|
.filter((m) => ["audio", "video"].includes(m.kind))
|
|
738
757
|
.forEach((m, i) => {
|
|
@@ -742,13 +761,6 @@ class RTCPeerConnection extends helper_1.EventTarget {
|
|
|
742
761
|
if (this.sctpTransport && sctpMedia) {
|
|
743
762
|
addTransportDescription(sctpMedia, this.sctpTransport.dtlsTransport);
|
|
744
763
|
}
|
|
745
|
-
this.setLocal(description);
|
|
746
|
-
if (this.shouldNegotiationneeded) {
|
|
747
|
-
this.needNegotiation();
|
|
748
|
-
}
|
|
749
|
-
return description;
|
|
750
|
-
}
|
|
751
|
-
setLocal(description) {
|
|
752
764
|
if (description.type === "answer") {
|
|
753
765
|
this.currentLocalDescription = description;
|
|
754
766
|
this.pendingLocalDescription = undefined;
|
|
@@ -1514,5 +1526,6 @@ exports.defaultPeerConfig = {
|
|
|
1514
1526
|
bundlePolicy: "max-compat",
|
|
1515
1527
|
debug: {},
|
|
1516
1528
|
midSuffix: false,
|
|
1529
|
+
forceTurnTCP: false,
|
|
1517
1530
|
};
|
|
1518
1531
|
//# sourceMappingURL=peerConnection.js.map
|