mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-28 03:13:51 +02:00
Fix atTimestamps iterator
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ export const AUDIO_CODECS = [
|
||||
'vorbis',
|
||||
'flac',
|
||||
...PCM_CODECS,
|
||||
] as const; // TODO add the rest
|
||||
] as const;
|
||||
/** @public */
|
||||
export const SUBTITLE_CODECS = ['webvtt'] as const; // TODO add the rest
|
||||
|
||||
|
||||
+4
-1
@@ -392,7 +392,10 @@ export abstract class BaseMediaFrameSink<
|
||||
}
|
||||
|
||||
let frameUsed = false;
|
||||
while (samplesOfInterest.length > 0 && samplesOfInterest[0] === wrappedFrame.sample) {
|
||||
while (
|
||||
samplesOfInterest.length > 0
|
||||
&& samplesOfInterest[0]!.is(wrappedFrame.sample as EncodedVideoSample & EncodedAudioSample)
|
||||
) {
|
||||
pushToQueue(this._duplicateFrame(wrappedFrame));
|
||||
samplesOfInterest.shift();
|
||||
frameUsed = true;
|
||||
|
||||
@@ -42,6 +42,15 @@ export class EncodedVideoSample {
|
||||
});
|
||||
}
|
||||
|
||||
is(otherSample: EncodedVideoSample) {
|
||||
return (
|
||||
this.type === otherSample.type
|
||||
&& this.timestamp === otherSample.timestamp
|
||||
&& this.duration === otherSample.duration
|
||||
&& this.byteLength === otherSample.byteLength
|
||||
);
|
||||
}
|
||||
|
||||
static fromEncodedVideoChunk(chunk: EncodedVideoChunk) {
|
||||
if (typeof EncodedVideoChunk === 'undefined') {
|
||||
throw new Error('Your browser does not support EncodedVideoChunk.');
|
||||
@@ -98,6 +107,15 @@ export class EncodedAudioSample {
|
||||
});
|
||||
}
|
||||
|
||||
is(otherSample: EncodedAudioSample) {
|
||||
return (
|
||||
this.type === otherSample.type
|
||||
&& this.timestamp === otherSample.timestamp
|
||||
&& this.duration === otherSample.duration
|
||||
&& this.byteLength === otherSample.byteLength
|
||||
);
|
||||
}
|
||||
|
||||
static fromEncodedAudioChunk(chunk: EncodedAudioChunk) {
|
||||
if (typeof EncodedAudioChunk === 'undefined') {
|
||||
throw new Error('Your browser does not support EncodedAudioChunk.');
|
||||
|
||||
Reference in New Issue
Block a user