node-av 6.2.0-beta.3 → 6.2.0-beta.30
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/README.md +13 -8
- package/dist/api/audio-frame-buffer.d.ts +438 -7
- package/dist/api/audio-frame-buffer.js +792 -52
- package/dist/api/audio-frame-buffer.js.map +1 -1
- package/dist/api/bitstream-filter.d.ts +82 -4
- package/dist/api/bitstream-filter.js +197 -100
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +5 -0
- package/dist/api/decoder.js +13 -6
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/demuxer.d.ts +29 -4
- package/dist/api/demuxer.js +209 -60
- package/dist/api/demuxer.js.map +1 -1
- package/dist/api/encoder-pool.d.ts +43 -1
- package/dist/api/encoder-pool.js +121 -9
- package/dist/api/encoder-pool.js.map +1 -1
- package/dist/api/encoder.d.ts +58 -2
- package/dist/api/encoder.js +173 -57
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter.js +15 -6
- package/dist/api/filter.js.map +1 -1
- package/dist/api/fmp4-stream.d.ts +327 -8
- package/dist/api/fmp4-stream.js +663 -123
- package/dist/api/fmp4-stream.js.map +1 -1
- package/dist/api/hardware.d.ts +2 -0
- package/dist/api/hardware.js +25 -4
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +3 -2
- package/dist/api/io-stream.js +76 -5
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/muxer.d.ts +289 -7
- package/dist/api/muxer.js +696 -109
- package/dist/api/muxer.js.map +1 -1
- package/dist/api/pipeline.d.ts +24 -0
- package/dist/api/pipeline.js +76 -5
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/rtp-stream.d.ts +77 -8
- package/dist/api/rtp-stream.js +316 -88
- package/dist/api/rtp-stream.js.map +1 -1
- package/dist/api/scaler.d.ts +124 -21
- package/dist/api/scaler.js +347 -114
- package/dist/api/scaler.js.map +1 -1
- package/dist/api/utilities/async-queue.d.ts +3 -0
- package/dist/api/utilities/async-queue.js +8 -0
- package/dist/api/utilities/async-queue.js.map +1 -1
- package/dist/api/utilities/packet-age-watchdog.d.ts +198 -0
- package/dist/api/utilities/packet-age-watchdog.js +594 -0
- package/dist/api/utilities/packet-age-watchdog.js.map +1 -0
- package/dist/api/webrtc-stream.d.ts +2 -0
- package/dist/api/webrtc-stream.js +46 -12
- package/dist/api/webrtc-stream.js.map +1 -1
- package/dist/api/whisper.d.ts +2 -0
- package/dist/api/whisper.js +63 -23
- package/dist/api/whisper.js.map +1 -1
- package/dist/constants/constants.d.ts +1 -0
- package/dist/constants/constants.js +1 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/constants/filter-options.d.ts +2 -0
- package/dist/ffmpeg/install.js +104 -26
- package/dist/ffmpeg/install.js.map +1 -1
- package/dist/ffmpeg/utils.js +7 -4
- package/dist/ffmpeg/utils.js.map +1 -1
- package/dist/lib/binding.d.ts +10 -1
- package/dist/lib/binding.js +25 -16
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +2 -0
- package/dist/lib/bitstream-filter-context.js +2 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/codec-context.d.ts +0 -2
- package/dist/lib/codec-context.js +4 -22
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/filter-context.d.ts +0 -1
- package/dist/lib/filter-context.js +2 -11
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/format-context.d.ts +70 -7
- package/dist/lib/format-context.js +77 -21
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +17 -13
- package/dist/lib/frame.js +24 -23
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +0 -1
- package/dist/lib/hardware-frames-context.js +2 -8
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/io-context.d.ts +4 -2
- package/dist/lib/io-context.js +4 -2
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/native-types.d.ts +7 -5
- package/dist/lib/option.d.ts +26 -0
- package/dist/lib/option.js +42 -18
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/packet.d.ts +5 -0
- package/dist/lib/packet.js +5 -0
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/stream.d.ts +8 -4
- package/dist/lib/stream.js +22 -24
- package/dist/lib/stream.js.map +1 -1
- package/install/check.js +40 -79
- package/package.json +45 -34
- package/build_mac_local.sh +0 -69
package/dist/api/rtp-stream.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export interface RTPStreamOptions {
|
|
|
25
25
|
/**
|
|
26
26
|
* Callback invoked when the stream is closed or encounters an error.
|
|
27
27
|
*
|
|
28
|
+
* Called once per started session. On an error the stream has already been
|
|
29
|
+
* stopped and its resources (including the input connection) released.
|
|
30
|
+
* Exceptions thrown by the callback are logged and do not propagate.
|
|
31
|
+
*
|
|
28
32
|
* @param error - Optional error if stream closed due to an error
|
|
29
33
|
*/
|
|
30
34
|
onClose?: (error?: Error) => void;
|
|
@@ -67,6 +71,8 @@ export interface RTPStreamOptions {
|
|
|
67
71
|
fps?: number;
|
|
68
72
|
width?: number;
|
|
69
73
|
height?: number;
|
|
74
|
+
bitrate?: number;
|
|
75
|
+
dumpExtra?: boolean;
|
|
70
76
|
encoderOptions?: EncoderOptions['options'];
|
|
71
77
|
};
|
|
72
78
|
/**
|
|
@@ -143,6 +149,7 @@ export declare class RTPStream {
|
|
|
143
149
|
private videoDecoder?;
|
|
144
150
|
private videoFilter?;
|
|
145
151
|
private videoEncoder?;
|
|
152
|
+
private videoBitstreamFilter?;
|
|
146
153
|
private audioDecoder?;
|
|
147
154
|
private audioFilter?;
|
|
148
155
|
private audioEncoder?;
|
|
@@ -152,6 +159,11 @@ export declare class RTPStream {
|
|
|
152
159
|
private supportedVideoCodecs;
|
|
153
160
|
private supportedAudioCodecs;
|
|
154
161
|
private videoKeyframeRequested;
|
|
162
|
+
private abortHandler?;
|
|
163
|
+
private stopRequested;
|
|
164
|
+
private stopPromise?;
|
|
165
|
+
private startAbort?;
|
|
166
|
+
private stopSignal;
|
|
155
167
|
/**
|
|
156
168
|
* @param input - Media input URL or pre-opened Demuxer
|
|
157
169
|
*
|
|
@@ -206,6 +218,10 @@ export declare class RTPStream {
|
|
|
206
218
|
/**
|
|
207
219
|
* Check if the stream is active.
|
|
208
220
|
*
|
|
221
|
+
* Stays true while a requested stop is still unwinding: the pipeline reports
|
|
222
|
+
* itself stopped as soon as stop() is called, but its packets keep flowing
|
|
223
|
+
* and its native resources stay open until completion settles.
|
|
224
|
+
*
|
|
209
225
|
* @returns True if the stream is active, false otherwise
|
|
210
226
|
*/
|
|
211
227
|
get isStreamActive(): boolean;
|
|
@@ -293,17 +309,65 @@ export declare class RTPStream {
|
|
|
293
309
|
* @internal
|
|
294
310
|
*/
|
|
295
311
|
private doStart;
|
|
312
|
+
/**
|
|
313
|
+
* Abort an in-flight startup once stop() was requested.
|
|
314
|
+
*
|
|
315
|
+
* Checked after every await in the startup path: the resources created so
|
|
316
|
+
* far are all assigned to instance fields, so the stop() that is waiting on
|
|
317
|
+
* this startup tears them down the moment it unwinds.
|
|
318
|
+
*
|
|
319
|
+
* @throws {Error} If stop() was called while starting
|
|
320
|
+
*
|
|
321
|
+
* @internal
|
|
322
|
+
*/
|
|
323
|
+
private throwIfStopRequested;
|
|
324
|
+
/**
|
|
325
|
+
* Cap the video bitrate on the encoder context.
|
|
326
|
+
*
|
|
327
|
+
* Sets the target bitrate together with a VBV cap (maxrate + a 1s buffer).
|
|
328
|
+
* Encoder.create() always seeds a default target bitrate (1 Mbps for video),
|
|
329
|
+
* so the target MUST be lowered along with the cap.
|
|
330
|
+
*
|
|
331
|
+
* @param ctx - Encoder codec context
|
|
332
|
+
*
|
|
333
|
+
* @param bitrate - Maximum bitrate in bits per second, or undefined
|
|
334
|
+
*
|
|
335
|
+
* @internal
|
|
336
|
+
*/
|
|
337
|
+
private applyBitrate;
|
|
296
338
|
/**
|
|
297
339
|
* Wire the pipeline completion to the onClose/error callbacks.
|
|
298
340
|
*
|
|
299
341
|
* On success invokes `onClose()`; on error stops the stream and invokes
|
|
300
|
-
* `onClose(error)`.
|
|
342
|
+
* `onClose(error)`. Either way `onClose` runs exactly once and the detached
|
|
343
|
+
* chain never rejects. Runs in the background (not awaited).
|
|
301
344
|
*
|
|
302
345
|
* @param completion - The pipeline completion promise
|
|
303
346
|
*
|
|
304
347
|
* @internal
|
|
305
348
|
*/
|
|
306
349
|
private attachCompletion;
|
|
350
|
+
/**
|
|
351
|
+
* Invoke the owner's onClose callback.
|
|
352
|
+
*
|
|
353
|
+
* The completion chain runs detached, so an exception from the callback
|
|
354
|
+
* could only surface as an unhandled rejection - it is logged instead.
|
|
355
|
+
*
|
|
356
|
+
* @param error - Pipeline error, or undefined for a clean end
|
|
357
|
+
*
|
|
358
|
+
* @internal
|
|
359
|
+
*/
|
|
360
|
+
private emitClose;
|
|
361
|
+
/**
|
|
362
|
+
* Whether a pipeline rejection was caused by an intentional shutdown.
|
|
363
|
+
*
|
|
364
|
+
* @param error - The pipeline rejection reason
|
|
365
|
+
*
|
|
366
|
+
* @returns True when stop() is in flight or the owner's signal aborted
|
|
367
|
+
*
|
|
368
|
+
* @internal
|
|
369
|
+
*/
|
|
370
|
+
private isDeliberateStop;
|
|
307
371
|
/**
|
|
308
372
|
* Set up encoders and RTP outputs for a pre-composited frame source and start
|
|
309
373
|
* encoding. No demuxer or decoder is involved - the provided frames are encoded
|
|
@@ -318,12 +382,10 @@ export declare class RTPStream {
|
|
|
318
382
|
/**
|
|
319
383
|
* Create the RTP video output muxer.
|
|
320
384
|
*
|
|
321
|
-
* Rewrites RTP sequence numbers (continuous) and
|
|
322
|
-
*
|
|
323
|
-
* `onVideoPacket`. Uses `this.input` when present
|
|
324
|
-
* for the frame-source path.
|
|
325
|
-
*
|
|
326
|
-
* @param fps - Frame rate used for the RTP timestamp increment
|
|
385
|
+
* Rewrites RTP sequence numbers (continuous) and rebases the PTS-derived
|
|
386
|
+
* timestamps (90 kHz) onto a random initial value in the write callback, then
|
|
387
|
+
* forwards each packet to `onVideoPacket`. Uses `this.input` when present
|
|
388
|
+
* (demuxer path) and no input for the frame-source path.
|
|
327
389
|
*
|
|
328
390
|
* @returns The configured video muxer
|
|
329
391
|
*
|
|
@@ -353,7 +415,8 @@ export declare class RTPStream {
|
|
|
353
415
|
*
|
|
354
416
|
* Stops the pipeline, closes output, and releases all FFmpeg resources.
|
|
355
417
|
* Safe to call multiple times. After stopping, you can call start() again
|
|
356
|
-
* to restart the stream.
|
|
418
|
+
* to restart the stream. Resolves even if the pipeline had failed; that
|
|
419
|
+
* error is reported through `onClose(error)`.
|
|
357
420
|
*
|
|
358
421
|
* @example
|
|
359
422
|
* ```typescript
|
|
@@ -367,6 +430,12 @@ export declare class RTPStream {
|
|
|
367
430
|
* ```
|
|
368
431
|
*/
|
|
369
432
|
stop(): Promise<void>;
|
|
433
|
+
/**
|
|
434
|
+
* Perform the actual teardown (see {@link stop}).
|
|
435
|
+
*
|
|
436
|
+
* @internal
|
|
437
|
+
*/
|
|
438
|
+
private doStop;
|
|
370
439
|
/**
|
|
371
440
|
* Check if the given audio codec is supported.
|
|
372
441
|
*
|