werift 0.22.0 → 0.22.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/nonstandard/index.mjs +25 -19
- package/lib/rtp/src/extra/processor/webmCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/webmCallback.js +23 -17
- package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6530,25 +6530,31 @@ var WebmCallback = class extends WebmBase {
|
|
|
6530
6530
|
this.queue.cancel();
|
|
6531
6531
|
};
|
|
6532
6532
|
};
|
|
6533
|
-
var saveToFileSystem = (path2) =>
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
return
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6533
|
+
var saveToFileSystem = (path2) => {
|
|
6534
|
+
const queue = new PromiseQueue();
|
|
6535
|
+
return async (value) => {
|
|
6536
|
+
return await queue.push(async () => {
|
|
6537
|
+
if (value.saveToFile) {
|
|
6538
|
+
await appendFile2(path2, value.saveToFile);
|
|
6539
|
+
return false;
|
|
6540
|
+
} else if (value.eol) {
|
|
6541
|
+
const { durationElement } = value.eol;
|
|
6542
|
+
const handler = await open(path2, "r+");
|
|
6543
|
+
await handler.write(
|
|
6544
|
+
durationElement,
|
|
6545
|
+
0,
|
|
6546
|
+
durationElement.length,
|
|
6547
|
+
DurationPosition
|
|
6548
|
+
);
|
|
6549
|
+
const meta = await stat(path2);
|
|
6550
|
+
const resize = replaceSegmentSize(meta.size);
|
|
6551
|
+
await handler.write(resize, 0, resize.length, SegmentSizePosition);
|
|
6552
|
+
await handler.close();
|
|
6553
|
+
return true;
|
|
6554
|
+
}
|
|
6555
|
+
return false;
|
|
6556
|
+
});
|
|
6557
|
+
};
|
|
6552
6558
|
};
|
|
6553
6559
|
|
|
6554
6560
|
// ../rtp/src/extra/processor/webmStream.ts
|
|
@@ -13,4 +13,4 @@ export declare class WebmCallback extends WebmBase {
|
|
|
13
13
|
* @param path
|
|
14
14
|
* @returns eol
|
|
15
15
|
*/
|
|
16
|
-
export declare const saveToFileSystem: (path: string) => (value: WebmOutput) => Promise<boolean
|
|
16
|
+
export declare const saveToFileSystem: (path: string) => (value: WebmOutput) => Promise<boolean>;
|
|
@@ -66,23 +66,29 @@ exports.WebmCallback = WebmCallback;
|
|
|
66
66
|
* @param path
|
|
67
67
|
* @returns eol
|
|
68
68
|
*/
|
|
69
|
-
const saveToFileSystem = (path) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
69
|
+
const saveToFileSystem = (path) => {
|
|
70
|
+
const queue = new __1.PromiseQueue();
|
|
71
|
+
return async (value) => {
|
|
72
|
+
return await queue.push(async () => {
|
|
73
|
+
if (value.saveToFile) {
|
|
74
|
+
await (0, promises_1.appendFile)(path, value.saveToFile);
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
else if (value.eol) {
|
|
78
|
+
const { durationElement } = value.eol;
|
|
79
|
+
const handler = await (0, promises_1.open)(path, "r+");
|
|
80
|
+
// set duration
|
|
81
|
+
await handler.write(durationElement, 0, durationElement.length, webm_1.DurationPosition);
|
|
82
|
+
// set size
|
|
83
|
+
const meta = await (0, promises_1.stat)(path);
|
|
84
|
+
const resize = (0, webm_1.replaceSegmentSize)(meta.size);
|
|
85
|
+
await handler.write(resize, 0, resize.length, webm_1.SegmentSizePosition);
|
|
86
|
+
await handler.close();
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
});
|
|
91
|
+
};
|
|
86
92
|
};
|
|
87
93
|
exports.saveToFileSystem = saveToFileSystem;
|
|
88
94
|
//# sourceMappingURL=webmCallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webmCallback.js","sourceRoot":"","sources":["../../../../../../rtp/src/extra/processor/webmCallback.ts"],"names":[],"mappings":";;;AAAA,0CAAqD;AAErD,6BAAqC;AACrC,iCASgB;AAEhB,MAAa,YAAa,SAAQ,eAAQ;IAGxC,YAAY,MAAmB,EAAE,UAAsB,EAAE;QACvD,KAAK,CACH,MAAM,EACN,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YACnB,IAAI,EAAE,EAAE,CAAC;gBACP,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC,EACD,OAAO,CACR,CAAC;QAZI;;;;;WAA0C;QAC1C;;;;mBAAQ,IAAI,gBAAY,EAAE;WAAC;QAcnC;;;;mBAAO,CAAC,EAAuC,EAAE,EAAE;gBACjD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC;WAAC;QAEF;;;;mBAAa,CAAC,KAAgB,EAAE,EAAE;gBAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;WAAC;QACF;;;;mBAAa,CAAC,KAAgB,EAAE,EAAE;gBAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;WAAC;QAEF;;;;mBAAU,GAAG,EAAE;gBACb,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACtB,CAAC;WAAC;IAjBF,CAAC;CAkBF;AAhCD,oCAgCC;AAED;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,EAAE,KAAiB,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"webmCallback.js","sourceRoot":"","sources":["../../../../../../rtp/src/extra/processor/webmCallback.ts"],"names":[],"mappings":";;;AAAA,0CAAqD;AAErD,6BAAqC;AACrC,iCASgB;AAEhB,MAAa,YAAa,SAAQ,eAAQ;IAGxC,YAAY,MAAmB,EAAE,UAAsB,EAAE;QACvD,KAAK,CACH,MAAM,EACN,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YACnB,IAAI,EAAE,EAAE,CAAC;gBACP,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC,EACD,OAAO,CACR,CAAC;QAZI;;;;;WAA0C;QAC1C;;;;mBAAQ,IAAI,gBAAY,EAAE;WAAC;QAcnC;;;;mBAAO,CAAC,EAAuC,EAAE,EAAE;gBACjD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC;WAAC;QAEF;;;;mBAAa,CAAC,KAAgB,EAAE,EAAE;gBAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;WAAC;QACF;;;;mBAAa,CAAC,KAAgB,EAAE,EAAE;gBAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;WAAC;QAEF;;;;mBAAU,GAAG,EAAE;gBACb,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACtB,CAAC;WAAC;IAj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{\n DurationPosition,\n SegmentSizePosition,\n WebmBase,\n type WebmInput,\n type WebmOption,\n type WebmOutput,\n type WebmTrack,\n replaceSegmentSize,\n} from \"./webm\";\n\nexport class WebmCallback extends WebmBase {\n private cb?: (input: WebmOutput) => Promise<void>;\n private queue = new PromiseQueue();\n constructor(tracks: WebmTrack[], options: WebmOption = {}) {\n super(\n tracks,\n async (output) => {\n const cb = this.cb;\n if (cb) {\n await this.queue.push(() => cb(output));\n }\n },\n options,\n );\n }\n\n pipe = (cb: (input: WebmOutput) => Promise<any>) => {\n this.cb = cb;\n this.start();\n };\n\n inputAudio = (input: WebmInput) => {\n this.processAudioInput(input);\n };\n inputVideo = (input: WebmInput) => {\n this.processVideoInput(input);\n };\n\n destroy = () => {\n this.cb = undefined;\n this.queue.cancel();\n };\n}\n\n/**\n *\n * @param path\n * @returns eol\n */\nexport const saveToFileSystem = (path: string) => {\n const queue = new PromiseQueue();\n return async (value: WebmOutput): Promise<boolean> => {\n return await queue.push<boolean>(async () => {\n if (value.saveToFile) {\n await appendFile(path, value.saveToFile);\n\n return false;\n } else if (value.eol) {\n const { durationElement } = value.eol;\n const handler = await open(path, \"r+\");\n\n // set duration\n await handler.write(\n durationElement,\n 0,\n durationElement.length,\n DurationPosition,\n );\n\n // set size\n const meta = await stat(path);\n const resize = replaceSegmentSize(meta.size);\n await handler.write(resize, 0, resize.length, SegmentSizePosition);\n\n await handler.close();\n\n return true;\n }\n\n return false;\n });\n };\n};\n"]}
|
|
@@ -34,7 +34,7 @@ export declare class RTCRtpReceiver {
|
|
|
34
34
|
readonly receiveLastSRTimestamp: {
|
|
35
35
|
[ssrc: number]: number;
|
|
36
36
|
};
|
|
37
|
-
readonly onPacketLost: Event<[import("
|
|
37
|
+
readonly onPacketLost: Event<[import("werift-rtp/src/rtcp/rtpfb/nack").GenericNack]>;
|
|
38
38
|
readonly onRtcp: Event<[RtcpPacket]>;
|
|
39
39
|
dtlsTransport: RTCDtlsTransport;
|
|
40
40
|
sdesMid?: string;
|