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/muxer.d.ts
CHANGED
|
@@ -8,6 +8,20 @@ import type { BitStreamFilterAPI } from './bitstream-filter.js';
|
|
|
8
8
|
import type { Demuxer, RTPDemuxer } from './demuxer.js';
|
|
9
9
|
import type { IOOutputCallbacks } from './io-stream.js';
|
|
10
10
|
import type { ContextOptions } from './utilities/context-options.js';
|
|
11
|
+
/**
|
|
12
|
+
* Observer for the packets a Muxer accepts for writing.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export interface MuxerPacketObserver {
|
|
17
|
+
/** A packet with payload was accepted; throwing fails the write like a muxing error. */
|
|
18
|
+
onPacket(streamIndex: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* An accepted packet of this stream will not reach the output (dropped, or rejected by libavformat).
|
|
21
|
+
* A libavformat error for an earlier, buffered packet is reported against the packet submitted with it.
|
|
22
|
+
*/
|
|
23
|
+
onPacketRejected(streamIndex: number): void;
|
|
24
|
+
}
|
|
11
25
|
/**
|
|
12
26
|
* Options for Muxer creation.
|
|
13
27
|
*/
|
|
@@ -61,10 +75,57 @@ export interface MuxerOptions<F extends MuxerFormat | (string & {}) = MuxerForma
|
|
|
61
75
|
*
|
|
62
76
|
* When enabled, the muxer will terminate on the first write error.
|
|
63
77
|
* When disabled, errors are logged but processing continues.
|
|
78
|
+
* Timestamp discontinuities the muxer refuses to write (see
|
|
79
|
+
* {@link MuxerOptions.dtsBackwardThreshold} and
|
|
80
|
+
* {@link MuxerOptions.dtsForwardThreshold}) are thrown either way.
|
|
64
81
|
*
|
|
65
82
|
* @default true
|
|
66
83
|
*/
|
|
67
84
|
exitOnError?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Backward DTS jump in seconds above which writing a packet fails.
|
|
87
|
+
*
|
|
88
|
+
* Audio and video DTS must not decrease, so a packet behind the stream's last
|
|
89
|
+
* written DTS is clamped forward. After a large backward jump (a live source
|
|
90
|
+
* restarting its clock) every following packet is clamped to one tick past the
|
|
91
|
+
* previous one until the source catches up again, collapsing the timeline for
|
|
92
|
+
* as long as the jump. With a threshold set, such a packet is rejected with an
|
|
93
|
+
* error instead, so the owner can restart on a fresh timeline. Smaller jumps
|
|
94
|
+
* are still clamped. `0` disables the check.
|
|
95
|
+
*
|
|
96
|
+
* Independent of this option, MP4/MOV-family outputs always reject a DTS step
|
|
97
|
+
* or packet duration that their 32-bit sample durations cannot store (INT_MAX
|
|
98
|
+
* ticks or more), where movenc would otherwise collapse the step to one tick
|
|
99
|
+
* or abort the process. Without an edit list (fragmented output without
|
|
100
|
+
* `delay_moov`) they also reject the first packet of a stream that starts
|
|
101
|
+
* more than `max_interleave_delta` (10 s) after the others and ends before
|
|
102
|
+
* the output's start, which movenc cannot store either.
|
|
103
|
+
*
|
|
104
|
+
* @default 0
|
|
105
|
+
*/
|
|
106
|
+
dtsBackwardThreshold?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Forward DTS jump in seconds, beyond the real time that passed, above which
|
|
109
|
+
* writing a packet fails.
|
|
110
|
+
*
|
|
111
|
+
* For a source read in real time, timestamps advance with the clock: a gap
|
|
112
|
+
* in the stream comes with a matching wait for the packet after it. A packet
|
|
113
|
+
* whose DTS runs further ahead than the time that passed is a
|
|
114
|
+
* discontinuity (a live source restarting its clock behind a restreamer),
|
|
115
|
+
* and writing it would leave a sample spanning the jump. With a threshold
|
|
116
|
+
* set, such a packet is rejected with an error before it reaches the
|
|
117
|
+
* output, so the owner can restart on a fresh timeline. Real time is
|
|
118
|
+
* measured per audio/video stream from when its packets are passed to
|
|
119
|
+
* writePacket(), and a packet is compared with the stream's last 128 to 256
|
|
120
|
+
* packets, so frames a parser or encoder held back during a gap do not make
|
|
121
|
+
* the end of the gap look like a jump. A stream's first packet is not
|
|
122
|
+
* checked, and a packet without DTS is measured by its PTS. Use it only for
|
|
123
|
+
* sources read in real time: a file read faster than real time has its gaps
|
|
124
|
+
* without the wait. `0` disables the check.
|
|
125
|
+
*
|
|
126
|
+
* @default 0
|
|
127
|
+
*/
|
|
128
|
+
dtsForwardThreshold?: number;
|
|
68
129
|
/**
|
|
69
130
|
* Maximum number of packets to buffer per stream in the sync queue.
|
|
70
131
|
*
|
|
@@ -278,6 +339,7 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
278
339
|
private options;
|
|
279
340
|
private _streams;
|
|
280
341
|
private ioContext?;
|
|
342
|
+
private customIO;
|
|
281
343
|
private headerWritten;
|
|
282
344
|
private headerWritePromise?;
|
|
283
345
|
private trailerWritten;
|
|
@@ -287,10 +349,21 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
287
349
|
private containerMetadataCopied;
|
|
288
350
|
private writeQueue?;
|
|
289
351
|
private writeWorkerPromise?;
|
|
352
|
+
private writeWorkerError?;
|
|
290
353
|
private signal?;
|
|
354
|
+
private movSampleLimit;
|
|
355
|
+
private tsNonStrict;
|
|
356
|
+
private movZeroStart;
|
|
357
|
+
private interleaveDeltaUs;
|
|
358
|
+
private trailerDiscarded;
|
|
359
|
+
private forwardThresholdMs;
|
|
360
|
+
private clock;
|
|
361
|
+
private packetObserver?;
|
|
291
362
|
/**
|
|
292
363
|
* @param options - Media output options
|
|
293
364
|
*
|
|
365
|
+
* @throws {RangeError} If dtsBackwardThreshold or dtsForwardThreshold is not a finite number >= 0
|
|
366
|
+
*
|
|
294
367
|
* @internal
|
|
295
368
|
*/
|
|
296
369
|
private constructor();
|
|
@@ -311,6 +384,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
311
384
|
*
|
|
312
385
|
* @throws {Error} If format required for custom I/O
|
|
313
386
|
*
|
|
387
|
+
* @throws {RangeError} If dtsBackwardThreshold or dtsForwardThreshold is not a finite number >= 0
|
|
388
|
+
*
|
|
314
389
|
* @throws {FFmpegError} If allocation or opening fails
|
|
315
390
|
*
|
|
316
391
|
* @example
|
|
@@ -385,6 +460,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
385
460
|
*
|
|
386
461
|
* @throws {Error} If format required for custom I/O
|
|
387
462
|
*
|
|
463
|
+
* @throws {RangeError} If dtsBackwardThreshold or dtsForwardThreshold is not a finite number >= 0
|
|
464
|
+
*
|
|
388
465
|
* @throws {FFmpegError} If allocation or opening fails
|
|
389
466
|
*
|
|
390
467
|
* @example
|
|
@@ -697,6 +774,9 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
697
774
|
*
|
|
698
775
|
* @throws {Error} If stream invalid or encoder not initialized
|
|
699
776
|
*
|
|
777
|
+
* @throws {Error} On a timestamp discontinuity the output cannot take (see {@link MuxerOptions.dtsBackwardThreshold}).
|
|
778
|
+
* With the background write queue (more than one stream) it surfaces from a later writePacket() or close().
|
|
779
|
+
*
|
|
700
780
|
* @throws {FFmpegError} If write fails
|
|
701
781
|
*
|
|
702
782
|
* @example
|
|
@@ -753,6 +833,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
753
833
|
*
|
|
754
834
|
* @throws {Error} If stream invalid or encoder not initialized
|
|
755
835
|
*
|
|
836
|
+
* @throws {Error} On a timestamp discontinuity the output cannot take (see {@link MuxerOptions.dtsBackwardThreshold})
|
|
837
|
+
*
|
|
756
838
|
* @throws {FFmpegError} If write fails
|
|
757
839
|
*
|
|
758
840
|
* @example
|
|
@@ -797,6 +879,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
797
879
|
* }
|
|
798
880
|
* ```
|
|
799
881
|
*
|
|
882
|
+
* @throws {Error} If a background write failed and was not yet observed by the caller (resources are still released; a second close() is a no-op)
|
|
883
|
+
*
|
|
800
884
|
* @see {@link Symbol.asyncDispose} For automatic cleanup
|
|
801
885
|
*/
|
|
802
886
|
close(): Promise<void>;
|
|
@@ -832,6 +916,74 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
832
916
|
* @internal
|
|
833
917
|
*/
|
|
834
918
|
getFormatContext(): FormatContext;
|
|
919
|
+
/**
|
|
920
|
+
* Follow the packets this muxer accepts for writing.
|
|
921
|
+
*
|
|
922
|
+
* The observer hears about every packet with payload once it is accepted
|
|
923
|
+
* (before it waits in the pre-mux queue or reaches libavformat) and about
|
|
924
|
+
* every such packet that is dropped later, so together with the output it
|
|
925
|
+
* knows what the muxer holds. close() detaches it.
|
|
926
|
+
*
|
|
927
|
+
* @param observer - Observer, or undefined to detach
|
|
928
|
+
*
|
|
929
|
+
* @internal
|
|
930
|
+
*/
|
|
931
|
+
setPacketObserver(observer: MuxerPacketObserver | undefined): void;
|
|
932
|
+
/**
|
|
933
|
+
* Replace the clock that stamps packet arrival times for the dtsForwardThreshold check.
|
|
934
|
+
*
|
|
935
|
+
* Lets tests drive real time deterministically. Set it before the first packet.
|
|
936
|
+
*
|
|
937
|
+
* @param clock - Monotonic time in ms
|
|
938
|
+
*
|
|
939
|
+
* @internal
|
|
940
|
+
*/
|
|
941
|
+
setClock(clock: () => number): void;
|
|
942
|
+
/**
|
|
943
|
+
* Make close() skip the trailer.
|
|
944
|
+
*
|
|
945
|
+
* For owners that drop whatever the muxer still emits, such as FMP4Stream
|
|
946
|
+
* after a failed session: the trailer would only push libavformat's backlog
|
|
947
|
+
* into the void, and movenc asserts on some track states a failed session
|
|
948
|
+
* can leave behind. The backlog is freed with the format context instead.
|
|
949
|
+
*
|
|
950
|
+
* @internal
|
|
951
|
+
*/
|
|
952
|
+
discardOnClose(): void;
|
|
953
|
+
/**
|
|
954
|
+
* Announce a packet the muxer has accepted to the packet observer.
|
|
955
|
+
*
|
|
956
|
+
* @param pkt - The muxer's clone of the packet
|
|
957
|
+
*
|
|
958
|
+
* @param streamIndex - Output stream index
|
|
959
|
+
*
|
|
960
|
+
* @returns True when the observer now tracks the packet
|
|
961
|
+
*
|
|
962
|
+
* @throws {Error} If the observer fails the write (the clone is freed)
|
|
963
|
+
*
|
|
964
|
+
* @internal
|
|
965
|
+
*/
|
|
966
|
+
private announcePacket;
|
|
967
|
+
/**
|
|
968
|
+
* Apply shared pre-header setup for writePacket and writePacketSync.
|
|
969
|
+
*
|
|
970
|
+
* Configures sync queues, dispositions and container metadata, then applies
|
|
971
|
+
* user-provided context options and the configure callback. Must run
|
|
972
|
+
* immediately before writing the header so both variants stay in sync.
|
|
973
|
+
*
|
|
974
|
+
* @internal
|
|
975
|
+
*/
|
|
976
|
+
private prepareHeaderWrite;
|
|
977
|
+
/**
|
|
978
|
+
* Read the muxing setup libavformat settles while writing the header.
|
|
979
|
+
*
|
|
980
|
+
* movenc decides on edit lists only then: without one (fragmented output
|
|
981
|
+
* without delay_moov) it shifts the output to start at 0 and puts each
|
|
982
|
+
* track's first sample there, which {@link checkMovLateStart} guards.
|
|
983
|
+
*
|
|
984
|
+
* @internal
|
|
985
|
+
*/
|
|
986
|
+
private readHeaderSetup;
|
|
835
987
|
/**
|
|
836
988
|
* Setup sync queues based on stream configuration.
|
|
837
989
|
*
|
|
@@ -845,6 +997,14 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
845
997
|
* @internal
|
|
846
998
|
*/
|
|
847
999
|
private setupSyncQueues;
|
|
1000
|
+
/**
|
|
1001
|
+
* Whether any stream still holds packets (or an EOF marker) in its pre-mux queue.
|
|
1002
|
+
*
|
|
1003
|
+
* @returns True if a pre-mux queue is not empty
|
|
1004
|
+
*
|
|
1005
|
+
* @internal
|
|
1006
|
+
*/
|
|
1007
|
+
private hasPreMuxPackets;
|
|
848
1008
|
/**
|
|
849
1009
|
* Flush all PreMuxQueues in DTS-sorted order.
|
|
850
1010
|
*
|
|
@@ -878,6 +1038,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
878
1038
|
*
|
|
879
1039
|
* @param streamIndex - Stream index
|
|
880
1040
|
*
|
|
1041
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1042
|
+
*
|
|
881
1043
|
* @internal
|
|
882
1044
|
*/
|
|
883
1045
|
private write;
|
|
@@ -891,6 +1053,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
891
1053
|
*
|
|
892
1054
|
* @param streamIndex - Stream index
|
|
893
1055
|
*
|
|
1056
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1057
|
+
*
|
|
894
1058
|
* @internal
|
|
895
1059
|
*/
|
|
896
1060
|
private writeInternal;
|
|
@@ -911,6 +1075,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
911
1075
|
*
|
|
912
1076
|
* @param streamIndex - Stream index
|
|
913
1077
|
*
|
|
1078
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1079
|
+
*
|
|
914
1080
|
* @internal
|
|
915
1081
|
*/
|
|
916
1082
|
private writeSync;
|
|
@@ -940,11 +1106,12 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
940
1106
|
* Apply the configured `startTime` offset to an encoded packet, per stream.
|
|
941
1107
|
*
|
|
942
1108
|
* `startTime` exists to strip a device's boot-relative timestamp base (e.g. the
|
|
943
|
-
* mach uptime avfoundation reports). But
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
* players (QuickTime) reject. The
|
|
947
|
-
*
|
|
1109
|
+
* mach uptime avfoundation reports). But not every stream of an output carries
|
|
1110
|
+
* that base (e.g. zero-based audio next to device video), so subtracting a large
|
|
1111
|
+
* device startTime from such a stream would push its timestamps hugely negative and
|
|
1112
|
+
* produce a broken/overflowed edit list that strict players (QuickTime) reject. The
|
|
1113
|
+
* effective offset is therefore decided once on the stream's first packet and
|
|
1114
|
+
* clamped to what the stream actually carries —
|
|
948
1115
|
* `min(startTime, max(0, firstPts))`: boot-relative streams normalize to zero,
|
|
949
1116
|
* already-zero-based streams are left untouched.
|
|
950
1117
|
*
|
|
@@ -962,8 +1129,14 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
962
1129
|
* Performs timestamp corrections:
|
|
963
1130
|
* 1. Rescales timestamps to output timebase (av_rescale_delta for audio streamcopy)
|
|
964
1131
|
* 2. Sets pkt.timeBase to output stream timebase
|
|
965
|
-
* 3.
|
|
966
|
-
* 4.
|
|
1132
|
+
* 3. Rejects backward jumps beyond dtsBackwardThreshold
|
|
1133
|
+
* 4. Fixes invalid DTS > PTS relationships
|
|
1134
|
+
* 5. Enforces monotonic DTS (never decreasing), shrinking a clamped packet's duration to the clamped step
|
|
1135
|
+
* 6. Rejects forward jumps that run ahead of real time beyond dtsForwardThreshold
|
|
1136
|
+
* 7. Rejects DTS steps/durations a movenc output cannot store, and a late stream's first packet before its start
|
|
1137
|
+
*
|
|
1138
|
+
* The stream's last muxed DTS only advances when the packet is accepted and
|
|
1139
|
+
* carries a DTS.
|
|
967
1140
|
*
|
|
968
1141
|
* @param pkt - Packet to fix
|
|
969
1142
|
*
|
|
@@ -971,9 +1144,118 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
971
1144
|
*
|
|
972
1145
|
* @param streamIndex - Stream index
|
|
973
1146
|
*
|
|
1147
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1148
|
+
*
|
|
1149
|
+
* @throws {Error} On a rejected timestamp discontinuity
|
|
1150
|
+
*
|
|
974
1151
|
* @internal
|
|
975
1152
|
*/
|
|
976
1153
|
private muxFixupTs;
|
|
1154
|
+
/**
|
|
1155
|
+
* Reject a packet whose DTS lies further behind the stream's last muxed DTS
|
|
1156
|
+
* than the configured dtsBackwardThreshold.
|
|
1157
|
+
*
|
|
1158
|
+
* Expects the DTS already rescaled to the output stream time base. No-op when
|
|
1159
|
+
* the threshold is unset or 0.
|
|
1160
|
+
*
|
|
1161
|
+
* @param dts - Packet DTS in the output time base
|
|
1162
|
+
*
|
|
1163
|
+
* @param lastMuxDts - The stream's last muxed DTS
|
|
1164
|
+
*
|
|
1165
|
+
* @param timeBase - Output stream time base
|
|
1166
|
+
*
|
|
1167
|
+
* @param streamIndex - Stream index
|
|
1168
|
+
*
|
|
1169
|
+
* @throws {Error} If the backward jump exceeds the threshold
|
|
1170
|
+
*
|
|
1171
|
+
* @internal
|
|
1172
|
+
*/
|
|
1173
|
+
private checkBackwardDts;
|
|
1174
|
+
/**
|
|
1175
|
+
* Reject a packet whose DTS runs further ahead of real time than the
|
|
1176
|
+
* configured dtsForwardThreshold.
|
|
1177
|
+
*
|
|
1178
|
+
* Tracks per stream how real time and media time move apart (the offset) and
|
|
1179
|
+
* compares the packet's offset with the lowest one of the stream's recent
|
|
1180
|
+
* packets, see FORWARD_WINDOW_BUCKET. A gap in a live source leaves the
|
|
1181
|
+
* offset level, since the wait comes with it; a jump lowers it by the size
|
|
1182
|
+
* of the jump. The stream's first packet only sets the starting point.
|
|
1183
|
+
*
|
|
1184
|
+
* @param ts - Final packet DTS (PTS without DTS) in the output time base
|
|
1185
|
+
*
|
|
1186
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1187
|
+
*
|
|
1188
|
+
* @param streamInfo - Stream description
|
|
1189
|
+
*
|
|
1190
|
+
* @param streamIndex - Stream index
|
|
1191
|
+
*
|
|
1192
|
+
* @returns The packet's offset, for {@link recordForwardDts} once the packet is accepted
|
|
1193
|
+
*
|
|
1194
|
+
* @throws {Error} If the DTS runs ahead of real time by more than the threshold
|
|
1195
|
+
*
|
|
1196
|
+
* @internal
|
|
1197
|
+
*/
|
|
1198
|
+
private checkForwardDts;
|
|
1199
|
+
/**
|
|
1200
|
+
* Make an accepted packet the reference of the stream's next forward check.
|
|
1201
|
+
*
|
|
1202
|
+
* @param state - The stream's forward check state
|
|
1203
|
+
*
|
|
1204
|
+
* @param ts - The packet's DTS (PTS without DTS) in the output time base
|
|
1205
|
+
*
|
|
1206
|
+
* @param offset - The packet's offset from {@link checkForwardDts}
|
|
1207
|
+
*
|
|
1208
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1209
|
+
*
|
|
1210
|
+
* @internal
|
|
1211
|
+
*/
|
|
1212
|
+
private recordForwardDts;
|
|
1213
|
+
/**
|
|
1214
|
+
* Reject a packet whose DTS step or duration a movenc output cannot store.
|
|
1215
|
+
*
|
|
1216
|
+
* Runs after the monotonic clamp, on the DTS movenc will see. Steps are
|
|
1217
|
+
* measured against the stream's last muxed DTS.
|
|
1218
|
+
*
|
|
1219
|
+
* @param dts - Final packet DTS, or its PTS for a packet without DTS
|
|
1220
|
+
*
|
|
1221
|
+
* @param duration - Final packet duration
|
|
1222
|
+
*
|
|
1223
|
+
* @param lastMuxDts - The stream's last muxed DTS
|
|
1224
|
+
*
|
|
1225
|
+
* @param timeBase - Output stream time base
|
|
1226
|
+
*
|
|
1227
|
+
* @param streamIndex - Stream index
|
|
1228
|
+
*
|
|
1229
|
+
* @throws {Error} If the step or duration reaches INT_MAX ticks
|
|
1230
|
+
*
|
|
1231
|
+
* @internal
|
|
1232
|
+
*/
|
|
1233
|
+
private checkMovSampleDuration;
|
|
1234
|
+
/**
|
|
1235
|
+
* Reject a stream's first packet that ends before the output's start.
|
|
1236
|
+
*
|
|
1237
|
+
* Without an edit list movenc puts each track's first sample at the output's
|
|
1238
|
+
* start, so a first packet that ends before it becomes a sample of negative
|
|
1239
|
+
* duration, and movenc aborts the process (av_assert0 in
|
|
1240
|
+
* get_cluster_duration) at the next fragment or the trailer unless a second
|
|
1241
|
+
* sample reaches it first. libavformat sets that start from the lowest DTS
|
|
1242
|
+
* it holds when it writes its first packet. It holds every packet until each
|
|
1243
|
+
* stream has sent one or its queue spans max_interleave_delta, so only a
|
|
1244
|
+
* stream that starts that much later than the others can land before it.
|
|
1245
|
+
*
|
|
1246
|
+
* @param ts - Packet DTS (PTS without DTS) in the output time base
|
|
1247
|
+
*
|
|
1248
|
+
* @param duration - Packet duration
|
|
1249
|
+
*
|
|
1250
|
+
* @param timeBase - Output stream time base
|
|
1251
|
+
*
|
|
1252
|
+
* @param streamIndex - Stream index
|
|
1253
|
+
*
|
|
1254
|
+
* @throws {Error} If the packet ends before a start libavformat may already have set
|
|
1255
|
+
*
|
|
1256
|
+
* @internal
|
|
1257
|
+
*/
|
|
1258
|
+
private checkMovLateStart;
|
|
977
1259
|
/**
|
|
978
1260
|
* Copy container metadata from input to output.
|
|
979
1261
|
*
|