Add fix to ensure VideoFrames are output in timestamp order, fix atTimestamps iterator logic & leaks

This commit is contained in:
Vanilagy
2025-02-16 18:30:14 +01:00
parent 444770d4f8
commit a4c5ab4a8c
10 changed files with 154 additions and 104 deletions
+2 -26
View File
@@ -10,6 +10,7 @@ export class EncodedVideoSample {
public readonly type: SampleType,
public readonly timestamp: number,
public readonly duration: number,
public readonly sequenceNumber = -1,
public readonly byteLength = data.byteLength,
) {
if (!(data instanceof Uint8Array)) {
@@ -58,19 +59,6 @@ export class EncodedVideoSample {
});
}
is(otherSample: EncodedVideoSample) {
if (!(otherSample instanceof EncodedVideoSample)) {
throw new TypeError('otherSample must be an EncodedVideoSample.');
}
return (
this.type === otherSample.type
&& this.timestamp === otherSample.timestamp
&& this.duration === otherSample.duration
&& this.byteLength === otherSample.byteLength
);
}
clone(options?: {
timestamp?: number;
duration?: number;
@@ -118,6 +106,7 @@ export class EncodedAudioSample {
public readonly type: SampleType,
public readonly timestamp: number,
public readonly duration: number,
public readonly sequenceNumber = -1,
public readonly byteLength = data.byteLength,
) {
if (!(data instanceof Uint8Array)) {
@@ -166,19 +155,6 @@ export class EncodedAudioSample {
});
}
is(otherSample: EncodedAudioSample) {
if (!(otherSample instanceof EncodedAudioSample)) {
throw new TypeError('otherSample must be an EncodedAudioSample.');
}
return (
this.type === otherSample.type
&& this.timestamp === otherSample.timestamp
&& this.duration === otherSample.duration
&& this.byteLength === otherSample.byteLength
);
}
clone(options?: {
timestamp?: number;
duration?: number;