werift 0.18.0 → 0.18.2
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/ice/src/ice.js +58 -37
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/index.d.ts +3 -3
- package/lib/ice/src/index.js +3 -5
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/utils.d.ts +1 -1
- package/lib/ice/src/utils.js +3 -0
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/rtp/src/index.d.ts +1 -0
- package/lib/rtp/src/index.js +1 -0
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/processor/depacketizer.d.ts +8 -3
- package/lib/rtp/src/processor/depacketizer.js +18 -1
- package/lib/rtp/src/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/processor/depacketizerCallback.d.ts +2 -6
- package/lib/rtp/src/processor/depacketizerCallback.js.map +1 -1
- package/lib/rtp/src/processor/depacketizerTransformer.d.ts +2 -6
- package/lib/rtp/src/processor/depacketizerTransformer.js.map +1 -1
- package/lib/rtp/src/processor/index.d.ts +4 -0
- package/lib/rtp/src/processor/index.js +4 -0
- package/lib/rtp/src/processor/index.js.map +1 -1
- package/lib/rtp/src/processor/nack.d.ts +29 -0
- package/lib/rtp/src/processor/nack.js +183 -0
- package/lib/rtp/src/processor/nack.js.map +1 -0
- package/lib/rtp/src/processor/nackHandlerCallback.d.ts +8 -0
- package/lib/rtp/src/processor/nackHandlerCallback.js +36 -0
- package/lib/rtp/src/processor/nackHandlerCallback.js.map +1 -0
- package/lib/rtp/src/processor/ntpTime.js +2 -1
- package/lib/rtp/src/processor/ntpTime.js.map +1 -1
- package/lib/rtp/src/processor/rtpTime.d.ts +22 -0
- package/lib/rtp/src/processor/rtpTime.js +51 -0
- package/lib/rtp/src/processor/rtpTime.js.map +1 -0
- package/lib/rtp/src/processor/rtpTimeCallback.d.ts +7 -0
- package/lib/rtp/src/processor/rtpTimeCallback.js +36 -0
- package/lib/rtp/src/processor/rtpTimeCallback.js.map +1 -0
- package/lib/rtp/src/processor/source/rtcpCallback.d.ts +2 -1
- package/lib/rtp/src/processor/source/rtcpCallback.js +11 -0
- package/lib/rtp/src/processor/source/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/processor/source/rtpCallback.d.ts +2 -0
- package/lib/rtp/src/processor/source/rtpCallback.js +11 -0
- package/lib/rtp/src/processor/source/rtpCallback.js.map +1 -1
- package/lib/rtp/src/processor/webm.d.ts +8 -3
- package/lib/rtp/src/processor/webm.js +67 -10
- package/lib/rtp/src/processor/webm.js.map +1 -1
- package/lib/rtp/src/processor/webmCallback.js +2 -0
- package/lib/rtp/src/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.d.ts +1 -0
- package/lib/rtp/src/rtcp/rtcp.js +5 -1
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtp/rtp.d.ts +2 -2
- package/lib/rtp/src/rtp/rtp.js +2 -2
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/rtp/rtx.d.ts +3 -0
- package/lib/rtp/src/rtp/rtx.js +33 -0
- package/lib/rtp/src/rtp/rtx.js.map +1 -0
- package/lib/webrtc/src/media/receiver/nack.js +0 -1
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +0 -1
- package/lib/webrtc/src/media/rtpReceiver.js +2 -14
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +0 -1
- package/lib/webrtc/src/media/rtpSender.js +2 -18
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +2 -0
- package/lib/webrtc/src/nonstandard/recorder/index.js +15 -0
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.js +1 -1
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +0 -1
- package/lib/webrtc/src/utils.js +1 -5
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/media/receiver/nack.ts +1 -1
- package/src/media/rtpReceiver.ts +1 -16
- package/src/media/rtpSender.ts +1 -24
- package/src/nonstandard/recorder/index.ts +9 -0
- package/src/transport/dtls.ts +2 -1
- package/src/utils.ts +0 -4
package/src/media/rtpReceiver.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { debug } from "debug";
|
|
2
|
-
import { jspack } from "jspack";
|
|
3
2
|
import Event from "rx.mini";
|
|
4
3
|
import { setTimeout } from "timers/promises";
|
|
5
4
|
import { v4 as uuid } from "uuid";
|
|
@@ -14,8 +13,8 @@ import {
|
|
|
14
13
|
RtcpReceiverInfo,
|
|
15
14
|
RtcpRrPacket,
|
|
16
15
|
RtcpSrPacket,
|
|
17
|
-
RtpHeader,
|
|
18
16
|
RtpPacket,
|
|
17
|
+
unwrapRtx,
|
|
19
18
|
} from "../../../rtp/src";
|
|
20
19
|
import { codecParametersFromString, PeerConfig, usePLI, useTWCC } from "..";
|
|
21
20
|
import { RTCDtlsTransport } from "../transport/dtls";
|
|
@@ -345,17 +344,3 @@ export class RTCRtpReceiver {
|
|
|
345
344
|
this.runRtcp();
|
|
346
345
|
}
|
|
347
346
|
}
|
|
348
|
-
|
|
349
|
-
export function unwrapRtx(rtx: RtpPacket, payloadType: number, ssrc: number) {
|
|
350
|
-
const packet = new RtpPacket(
|
|
351
|
-
new RtpHeader({
|
|
352
|
-
payloadType,
|
|
353
|
-
marker: rtx.header.marker,
|
|
354
|
-
sequenceNumber: jspack.Unpack("!H", rtx.payload.subarray(0, 2))[0],
|
|
355
|
-
timestamp: rtx.header.timestamp,
|
|
356
|
-
ssrc,
|
|
357
|
-
}),
|
|
358
|
-
rtx.payload.subarray(2)
|
|
359
|
-
);
|
|
360
|
-
return packet;
|
|
361
|
-
}
|
package/src/media/rtpSender.ts
CHANGED
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
SourceDescriptionChunk,
|
|
52
52
|
SourceDescriptionItem,
|
|
53
53
|
TransportWideCC,
|
|
54
|
+
wrapRtx,
|
|
54
55
|
} from "../../../rtp/src";
|
|
55
56
|
import { codecParametersFromString } from "..";
|
|
56
57
|
import { RTCDtlsTransport } from "../transport/dtls";
|
|
@@ -491,27 +492,3 @@ export class RTCRtpSender {
|
|
|
491
492
|
this.onRtcp.execute(rtcpPacket);
|
|
492
493
|
}
|
|
493
494
|
}
|
|
494
|
-
|
|
495
|
-
export function wrapRtx(
|
|
496
|
-
packet: RtpPacket,
|
|
497
|
-
payloadType: number,
|
|
498
|
-
sequenceNumber: number,
|
|
499
|
-
ssrc: number
|
|
500
|
-
) {
|
|
501
|
-
const rtx = new RtpPacket(
|
|
502
|
-
new RtpHeader({
|
|
503
|
-
payloadType,
|
|
504
|
-
marker: packet.header.marker,
|
|
505
|
-
sequenceNumber,
|
|
506
|
-
timestamp: packet.header.timestamp,
|
|
507
|
-
ssrc,
|
|
508
|
-
csrc: packet.header.csrc,
|
|
509
|
-
extensions: packet.header.extensions,
|
|
510
|
-
}),
|
|
511
|
-
Buffer.concat([
|
|
512
|
-
Buffer.from(jspack.Pack("!H", [packet.header.sequenceNumber])),
|
|
513
|
-
packet.payload,
|
|
514
|
-
])
|
|
515
|
-
);
|
|
516
|
-
return rtx;
|
|
517
|
-
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Event from "rx.mini";
|
|
2
|
+
|
|
1
3
|
import { MediaStreamTrack } from "../../media/track";
|
|
2
4
|
import { MediaWriter } from "./writer";
|
|
3
5
|
import { WebmFactory } from "./writer/webm";
|
|
@@ -7,6 +9,7 @@ export class MediaRecorder {
|
|
|
7
9
|
ext: string;
|
|
8
10
|
tracks: MediaStreamTrack[] = [];
|
|
9
11
|
started = false;
|
|
12
|
+
onError = new Event<[Error]>();
|
|
10
13
|
|
|
11
14
|
constructor(
|
|
12
15
|
public path: string,
|
|
@@ -22,7 +25,13 @@ export class MediaRecorder {
|
|
|
22
25
|
throw new Error();
|
|
23
26
|
}
|
|
24
27
|
})();
|
|
28
|
+
|
|
25
29
|
this.tracks = options.tracks ?? this.tracks;
|
|
30
|
+
if (this.tracks.length === numOfTracks) {
|
|
31
|
+
this.start().catch((error) => {
|
|
32
|
+
this.onError.execute(error);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
async addTrack(track: MediaStreamTrack) {
|
package/src/transport/dtls.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { CipherContext } from "../../../dtls/src/context/cipher";
|
|
|
20
20
|
import { Profile } from "../../../dtls/src/context/srtp";
|
|
21
21
|
import { Connection } from "../../../ice/src";
|
|
22
22
|
import {
|
|
23
|
+
isRtcp,
|
|
23
24
|
RtcpPacket,
|
|
24
25
|
RtcpPacketConverter,
|
|
25
26
|
RtpHeader,
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
import { keyLength, saltLength } from "../../../rtp/src/srtp/const";
|
|
31
32
|
import { RtpRouter } from "../media/router";
|
|
32
33
|
import { PeerConfig } from "../peerConnection";
|
|
33
|
-
import { fingerprint, isDtls, isMedia
|
|
34
|
+
import { fingerprint, isDtls, isMedia } from "../utils";
|
|
34
35
|
import { RTCIceTransport } from "./ice";
|
|
35
36
|
|
|
36
37
|
const log = debug("werift:packages/webrtc/src/transport/dtls.ts");
|
package/src/utils.ts
CHANGED
|
@@ -39,10 +39,6 @@ export function isMedia(buf: Buffer) {
|
|
|
39
39
|
return firstByte > 127 && firstByte < 192;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function isRtcp(buf: Buffer) {
|
|
43
|
-
return buf.length >= 2 && buf[1] >= 192 && buf[1] <= 208;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
42
|
export function reverseSimulcastDirection(dir: "recv" | "send") {
|
|
47
43
|
if (dir === "recv") return "send";
|
|
48
44
|
return "recv";
|