@apocaliss92/nodelink-js 0.6.1 → 0.6.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/dist/{DiagnosticsTools-K4MF2VXZ.js → DiagnosticsTools-QJ3CRYGA.js} +2 -2
- package/dist/{chunk-EAHRVNEX.js → chunk-D4TKRGUP.js} +64 -10
- package/dist/chunk-D4TKRGUP.js.map +1 -0
- package/dist/{chunk-XDVBNZGR.js → chunk-IQVVVSXO.js} +48 -16
- package/dist/{chunk-XDVBNZGR.js.map → chunk-IQVVVSXO.js.map} +1 -1
- package/dist/cli/rtsp-server.cjs +108 -22
- package/dist/cli/rtsp-server.cjs.map +1 -1
- package/dist/cli/rtsp-server.js +2 -2
- package/dist/index.cjs +108 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-EAHRVNEX.js.map +0 -1
- /package/dist/{DiagnosticsTools-K4MF2VXZ.js.map → DiagnosticsTools-QJ3CRYGA.js.map} +0 -0
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
sampleStreams,
|
|
13
13
|
sanitizeFixtureData,
|
|
14
14
|
testChannelStreams
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IQVVVSXO.js";
|
|
16
16
|
import "./chunk-MZUSWKF3.js";
|
|
17
17
|
export {
|
|
18
18
|
captureModelFixtures,
|
|
@@ -29,4 +29,4 @@ export {
|
|
|
29
29
|
sanitizeFixtureData,
|
|
30
30
|
testChannelStreams
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=DiagnosticsTools-
|
|
32
|
+
//# sourceMappingURL=DiagnosticsTools-QJ3CRYGA.js.map
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
runAllDiagnosticsConsecutively,
|
|
31
31
|
runMultifocalDiagnosticsConsecutively,
|
|
32
32
|
xmlEscape
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-IQVVVSXO.js";
|
|
34
34
|
import {
|
|
35
35
|
BC_CLASS_FILE_DOWNLOAD,
|
|
36
36
|
BC_CLASS_LEGACY,
|
|
@@ -232,35 +232,88 @@ function decodeHeader(buf) {
|
|
|
232
232
|
return { header, headerLen, messageKey };
|
|
233
233
|
}
|
|
234
234
|
var BaichuanFrameParser = class {
|
|
235
|
+
/** Retained-but-unconsumed contiguous bytes from previous push() calls. */
|
|
235
236
|
buffer = Buffer.alloc(0);
|
|
237
|
+
/** Chunks received since the last materialization, not yet concatenated. */
|
|
238
|
+
pending = [];
|
|
239
|
+
/** Total bytes held in `pending` (kept in sync to avoid re-summing). */
|
|
240
|
+
pendingLen = 0;
|
|
241
|
+
/**
|
|
242
|
+
* Total contiguous bytes (`buffer` + `pending`) required before the next
|
|
243
|
+
* parse attempt can make progress. While buffered bytes stay below this,
|
|
244
|
+
* incoming chunks are merely stashed in `pending` with no copy. This is
|
|
245
|
+
* the mechanism that turns the worst case (a large frame fragmented over
|
|
246
|
+
* many small TCP chunks) from O(n²) into O(n): we concatenate once, when
|
|
247
|
+
* enough bytes have arrived, instead of on every chunk.
|
|
248
|
+
*
|
|
249
|
+
* Starts at 4 — the minimum needed to inspect the magic header.
|
|
250
|
+
*/
|
|
251
|
+
needed = 4;
|
|
252
|
+
/**
|
|
253
|
+
* Collapse `this.buffer` + all `pending` chunks into a single contiguous
|
|
254
|
+
* buffer. The retained leftover is copied at most once per materialize(),
|
|
255
|
+
* and materialize() only runs when `needed` bytes are available — so a
|
|
256
|
+
* fragmented frame is assembled with a single concat, not one per chunk.
|
|
257
|
+
*/
|
|
258
|
+
materialize() {
|
|
259
|
+
if (this.pendingLen === 0) return;
|
|
260
|
+
if (this.buffer.length === 0 && this.pending.length === 1) {
|
|
261
|
+
this.buffer = this.pending[0];
|
|
262
|
+
} else {
|
|
263
|
+
const parts = this.buffer.length === 0 ? this.pending : [this.buffer, ...this.pending];
|
|
264
|
+
this.buffer = Buffer.concat(parts);
|
|
265
|
+
}
|
|
266
|
+
this.pending = [];
|
|
267
|
+
this.pendingLen = 0;
|
|
268
|
+
}
|
|
269
|
+
/** Total buffered bytes, whether materialized or still pending. */
|
|
270
|
+
get available() {
|
|
271
|
+
return this.buffer.length + this.pendingLen;
|
|
272
|
+
}
|
|
236
273
|
push(chunk) {
|
|
237
274
|
if (chunk.length === 0) return [];
|
|
238
|
-
|
|
239
|
-
this.
|
|
275
|
+
this.pending.push(chunk);
|
|
276
|
+
this.pendingLen += chunk.length;
|
|
277
|
+
if (this.available < this.needed) return [];
|
|
278
|
+
this.materialize();
|
|
240
279
|
const out = [];
|
|
241
280
|
while (true) {
|
|
242
|
-
if (this.buffer.length < 4)
|
|
281
|
+
if (this.buffer.length < 4) {
|
|
282
|
+
this.needed = 4;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
243
285
|
if (!this.buffer.subarray(0, 4).equals(BC_MAGIC) && !this.buffer.subarray(0, 4).equals(BC_MAGIC_REV)) {
|
|
244
286
|
const idx = this.buffer.indexOf(BC_MAGIC);
|
|
245
287
|
const idxRev = this.buffer.indexOf(BC_MAGIC_REV);
|
|
246
288
|
const next = idx === -1 ? idxRev : idxRev === -1 ? idx : Math.min(idx, idxRev);
|
|
247
289
|
if (next === -1) {
|
|
248
290
|
this.buffer = this.buffer.subarray(Math.max(0, this.buffer.length - 3));
|
|
291
|
+
this.needed = 4;
|
|
249
292
|
break;
|
|
250
293
|
}
|
|
251
294
|
this.buffer = this.buffer.subarray(next);
|
|
252
|
-
if (this.buffer.length < 20)
|
|
295
|
+
if (this.buffer.length < 20) {
|
|
296
|
+
this.needed = 20;
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (this.buffer.length < 20) {
|
|
301
|
+
this.needed = 20;
|
|
302
|
+
break;
|
|
253
303
|
}
|
|
254
|
-
if (this.buffer.length < 20) break;
|
|
255
304
|
let headerInfo;
|
|
256
305
|
try {
|
|
257
306
|
headerInfo = decodeHeader(this.buffer);
|
|
258
307
|
} catch {
|
|
308
|
+
this.needed = 24;
|
|
259
309
|
break;
|
|
260
310
|
}
|
|
261
311
|
const { header, headerLen, messageKey } = headerInfo;
|
|
262
312
|
const frameLen = headerLen + header.bodyLen;
|
|
263
|
-
if (this.buffer.length < frameLen)
|
|
313
|
+
if (this.buffer.length < frameLen) {
|
|
314
|
+
this.needed = frameLen;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
264
317
|
const raw = this.buffer.subarray(0, frameLen);
|
|
265
318
|
const body = raw.subarray(headerLen);
|
|
266
319
|
let extLen = 0;
|
|
@@ -272,6 +325,7 @@ var BaichuanFrameParser = class {
|
|
|
272
325
|
const payload = body.subarray(extLen);
|
|
273
326
|
out.push({ header, body, extension, payload, messageKey, raw });
|
|
274
327
|
this.buffer = this.buffer.subarray(frameLen);
|
|
328
|
+
this.needed = 4;
|
|
275
329
|
}
|
|
276
330
|
return out;
|
|
277
331
|
}
|
|
@@ -20517,7 +20571,7 @@ ${xml}`
|
|
|
20517
20571
|
* @returns Test results for all stream types and profiles
|
|
20518
20572
|
*/
|
|
20519
20573
|
async testChannelStreams(channel, logger) {
|
|
20520
|
-
const { testChannelStreams } = await import("./DiagnosticsTools-
|
|
20574
|
+
const { testChannelStreams } = await import("./DiagnosticsTools-QJ3CRYGA.js");
|
|
20521
20575
|
return await testChannelStreams({
|
|
20522
20576
|
api: this,
|
|
20523
20577
|
channel: this.normalizeChannel(channel),
|
|
@@ -20533,7 +20587,7 @@ ${xml}`
|
|
|
20533
20587
|
* @returns Complete diagnostics for all channels and streams
|
|
20534
20588
|
*/
|
|
20535
20589
|
async collectMultifocalDiagnostics(logger) {
|
|
20536
|
-
const { collectMultifocalDiagnostics } = await import("./DiagnosticsTools-
|
|
20590
|
+
const { collectMultifocalDiagnostics } = await import("./DiagnosticsTools-QJ3CRYGA.js");
|
|
20537
20591
|
return await collectMultifocalDiagnostics({
|
|
20538
20592
|
api: this,
|
|
20539
20593
|
logger
|
|
@@ -25318,4 +25372,4 @@ export {
|
|
|
25318
25372
|
tcpReachabilityProbe,
|
|
25319
25373
|
autoDetectDeviceType
|
|
25320
25374
|
};
|
|
25321
|
-
//# sourceMappingURL=chunk-
|
|
25375
|
+
//# sourceMappingURL=chunk-D4TKRGUP.js.map
|