node-av 6.2.0-beta.9 → 6.2.0
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 +7 -19
- package/dist/api/audio-frame-buffer.d.ts +378 -19
- package/dist/api/audio-frame-buffer.js +715 -101
- package/dist/api/audio-frame-buffer.js.map +1 -1
- package/dist/api/data/test_av1.ivf +0 -0
- package/dist/api/data/test_hevc.h265 +0 -0
- package/dist/api/data/test_vp9.ivf +0 -0
- package/dist/api/decoder.d.ts +117 -2
- package/dist/api/decoder.js +290 -23
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/demuxer.d.ts +19 -3
- package/dist/api/demuxer.js +95 -29
- package/dist/api/demuxer.js.map +1 -1
- package/dist/api/encoder-pool.js +9 -1
- package/dist/api/encoder-pool.js.map +1 -1
- package/dist/api/encoder.d.ts +100 -6
- package/dist/api/encoder.js +249 -108
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +25 -1
- package/dist/api/filter-presets.js +63 -3
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +62 -3
- package/dist/api/filter.js +118 -36
- package/dist/api/filter.js.map +1 -1
- package/dist/api/fmp4-stream.d.ts +179 -15
- package/dist/api/fmp4-stream.js +341 -120
- package/dist/api/fmp4-stream.js.map +1 -1
- package/dist/api/hardware.d.ts +2 -0
- package/dist/api/hardware.js +33 -10
- 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 +23 -7
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/muxer.d.ts +276 -7
- package/dist/api/muxer.js +649 -116
- package/dist/api/muxer.js.map +1 -1
- package/dist/api/pipeline.d.ts +22 -0
- package/dist/api/pipeline.js +53 -0
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/rtp-stream.d.ts +54 -33
- package/dist/api/rtp-stream.js +232 -153
- package/dist/api/rtp-stream.js.map +1 -1
- package/dist/api/scaler.d.ts +39 -6
- package/dist/api/scaler.js +72 -18
- package/dist/api/scaler.js.map +1 -1
- package/dist/api/utilities/live-decoding.d.ts +15 -0
- package/dist/api/utilities/live-decoding.js +32 -0
- package/dist/api/utilities/live-decoding.js.map +1 -0
- 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/utilities/scale-size.d.ts +51 -0
- package/dist/api/utilities/scale-size.js +55 -0
- package/dist/api/utilities/scale-size.js.map +1 -0
- package/dist/api/utilities/video-transcode.d.ts +218 -0
- package/dist/api/utilities/video-transcode.js +624 -0
- package/dist/api/utilities/video-transcode.js.map +1 -0
- 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/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/filter-context.d.ts +3 -0
- package/dist/lib/filter-context.js +3 -0
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph-segment.d.ts +3 -2
- package/dist/lib/filter-graph-segment.js +3 -2
- package/dist/lib/filter-graph-segment.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +4 -4
- package/dist/lib/filter-graph.js +4 -4
- package/dist/lib/filter-inout.d.ts +4 -0
- package/dist/lib/filter-inout.js +4 -0
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/format-context.d.ts +27 -3
- package/dist/lib/format-context.js +30 -6
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +6 -2
- package/dist/lib/frame.js +11 -3
- package/dist/lib/frame.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 -3
- package/dist/lib/output-format.d.ts +42 -0
- package/dist/lib/output-format.js +46 -0
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/stream.d.ts +5 -0
- package/dist/lib/stream.js +5 -0
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/utilities.d.ts +26 -0
- package/dist/lib/utilities.js +28 -0
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +14 -16
- package/package.json +27 -44
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;
|
|
@@ -289,9 +351,19 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
289
351
|
private writeWorkerPromise?;
|
|
290
352
|
private writeWorkerError?;
|
|
291
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?;
|
|
292
362
|
/**
|
|
293
363
|
* @param options - Media output options
|
|
294
364
|
*
|
|
365
|
+
* @throws {RangeError} If dtsBackwardThreshold or dtsForwardThreshold is not a finite number >= 0
|
|
366
|
+
*
|
|
295
367
|
* @internal
|
|
296
368
|
*/
|
|
297
369
|
private constructor();
|
|
@@ -312,6 +384,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
312
384
|
*
|
|
313
385
|
* @throws {Error} If format required for custom I/O
|
|
314
386
|
*
|
|
387
|
+
* @throws {RangeError} If dtsBackwardThreshold or dtsForwardThreshold is not a finite number >= 0
|
|
388
|
+
*
|
|
315
389
|
* @throws {FFmpegError} If allocation or opening fails
|
|
316
390
|
*
|
|
317
391
|
* @example
|
|
@@ -386,6 +460,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
386
460
|
*
|
|
387
461
|
* @throws {Error} If format required for custom I/O
|
|
388
462
|
*
|
|
463
|
+
* @throws {RangeError} If dtsBackwardThreshold or dtsForwardThreshold is not a finite number >= 0
|
|
464
|
+
*
|
|
389
465
|
* @throws {FFmpegError} If allocation or opening fails
|
|
390
466
|
*
|
|
391
467
|
* @example
|
|
@@ -698,6 +774,9 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
698
774
|
*
|
|
699
775
|
* @throws {Error} If stream invalid or encoder not initialized
|
|
700
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
|
+
*
|
|
701
780
|
* @throws {FFmpegError} If write fails
|
|
702
781
|
*
|
|
703
782
|
* @example
|
|
@@ -754,6 +833,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
754
833
|
*
|
|
755
834
|
* @throws {Error} If stream invalid or encoder not initialized
|
|
756
835
|
*
|
|
836
|
+
* @throws {Error} On a timestamp discontinuity the output cannot take (see {@link MuxerOptions.dtsBackwardThreshold})
|
|
837
|
+
*
|
|
757
838
|
* @throws {FFmpegError} If write fails
|
|
758
839
|
*
|
|
759
840
|
* @example
|
|
@@ -835,6 +916,54 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
835
916
|
* @internal
|
|
836
917
|
*/
|
|
837
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;
|
|
838
967
|
/**
|
|
839
968
|
* Apply shared pre-header setup for writePacket and writePacketSync.
|
|
840
969
|
*
|
|
@@ -845,6 +974,16 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
845
974
|
* @internal
|
|
846
975
|
*/
|
|
847
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;
|
|
848
987
|
/**
|
|
849
988
|
* Setup sync queues based on stream configuration.
|
|
850
989
|
*
|
|
@@ -858,6 +997,14 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
858
997
|
* @internal
|
|
859
998
|
*/
|
|
860
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;
|
|
861
1008
|
/**
|
|
862
1009
|
* Flush all PreMuxQueues in DTS-sorted order.
|
|
863
1010
|
*
|
|
@@ -891,6 +1038,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
891
1038
|
*
|
|
892
1039
|
* @param streamIndex - Stream index
|
|
893
1040
|
*
|
|
1041
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1042
|
+
*
|
|
894
1043
|
* @internal
|
|
895
1044
|
*/
|
|
896
1045
|
private write;
|
|
@@ -904,6 +1053,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
904
1053
|
*
|
|
905
1054
|
* @param streamIndex - Stream index
|
|
906
1055
|
*
|
|
1056
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1057
|
+
*
|
|
907
1058
|
* @internal
|
|
908
1059
|
*/
|
|
909
1060
|
private writeInternal;
|
|
@@ -924,6 +1075,8 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
924
1075
|
*
|
|
925
1076
|
* @param streamIndex - Stream index
|
|
926
1077
|
*
|
|
1078
|
+
* @param arrival - When the packet reached the muxer (ms on the arrival clock)
|
|
1079
|
+
*
|
|
927
1080
|
* @internal
|
|
928
1081
|
*/
|
|
929
1082
|
private writeSync;
|
|
@@ -953,11 +1106,12 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
953
1106
|
* Apply the configured `startTime` offset to an encoded packet, per stream.
|
|
954
1107
|
*
|
|
955
1108
|
* `startTime` exists to strip a device's boot-relative timestamp base (e.g. the
|
|
956
|
-
* mach uptime avfoundation reports). But
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
* players (QuickTime) reject. The
|
|
960
|
-
*
|
|
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 —
|
|
961
1115
|
* `min(startTime, max(0, firstPts))`: boot-relative streams normalize to zero,
|
|
962
1116
|
* already-zero-based streams are left untouched.
|
|
963
1117
|
*
|
|
@@ -975,8 +1129,14 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
975
1129
|
* Performs timestamp corrections:
|
|
976
1130
|
* 1. Rescales timestamps to output timebase (av_rescale_delta for audio streamcopy)
|
|
977
1131
|
* 2. Sets pkt.timeBase to output stream timebase
|
|
978
|
-
* 3.
|
|
979
|
-
* 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.
|
|
980
1140
|
*
|
|
981
1141
|
* @param pkt - Packet to fix
|
|
982
1142
|
*
|
|
@@ -984,9 +1144,118 @@ export declare class Muxer implements AsyncDisposable, Disposable {
|
|
|
984
1144
|
*
|
|
985
1145
|
* @param streamIndex - Stream index
|
|
986
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
|
+
*
|
|
987
1151
|
* @internal
|
|
988
1152
|
*/
|
|
989
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;
|
|
990
1259
|
/**
|
|
991
1260
|
* Copy container metadata from input to output.
|
|
992
1261
|
*
|