Few changes

This commit is contained in:
Vanilagy
2026-07-29 18:17:07 +02:00
parent 748c0eace4
commit 3a41b8dddd
3 changed files with 16 additions and 11 deletions
+4
View File
@@ -212,6 +212,8 @@ export class VideoDecoderWrapper extends DecoderWrapper<VideoSample> {
} }
decode(packet: EncodedPacket) { decode(packet: EncodedPacket) {
assert(!packet.isMetadataOnly);
if (this.codec === 'hevc' && this.currentPacketIndex > 0 && !this.raslSkipped) { if (this.codec === 'hevc' && this.currentPacketIndex > 0 && !this.raslSkipped) {
if (this.hasHevcRaslPicture(packet.data)) { if (this.hasHevcRaslPicture(packet.data)) {
return; // Drop return; // Drop
@@ -989,6 +991,8 @@ export class AudioDecoderWrapper extends DecoderWrapper<AudioSample> {
} }
decode(packet: EncodedPacket) { decode(packet: EncodedPacket) {
assert(!packet.isMetadataOnly);
if (this.customDecoder) { if (this.customDecoder) {
this.customDecoderQueueSize++; this.customDecoderQueueSize++;
void this.customDecoderCallSerializer void this.customDecoderCallSerializer
+1
View File
@@ -96,6 +96,7 @@ export {
SUBTITLE_CODECS, SUBTITLE_CODECS,
} from './codec'; } from './codec';
export { export {
VideoDecoderWrapper,
canDecode, canDecode,
canDecodeVideo, canDecodeVideo,
canDecodeAudio, canDecodeAudio,
+11 -11
View File
@@ -477,9 +477,9 @@ export class PacketReader<T extends InputTrack = InputTrack> {
return packet; return packet;
} }
getNext(from: EncodedPacket, options: PacketRetrievalOptions = {}): MaybePromise<EncodedPacket | null> { getNext(packet: EncodedPacket, options: PacketRetrievalOptions = {}): MaybePromise<EncodedPacket | null> {
if (!(from instanceof EncodedPacket)) { if (!(packet instanceof EncodedPacket)) {
throw new TypeError('from must be an EncodedPacket.'); throw new TypeError('packet must be an EncodedPacket.');
} }
validatePacketRetrievalOptions(options); validatePacketRetrievalOptions(options);
@@ -488,7 +488,7 @@ export class PacketReader<T extends InputTrack = InputTrack> {
} }
const result = new ResultValue<EncodedPacket | null>(); const result = new ResultValue<EncodedPacket | null>();
const promise = this.track._backing.getNextPacket(result, from, options); const promise = this.track._backing.getNextPacket(result, packet, options);
if (result.pending) { if (result.pending) {
return promise.then(() => this._maybeVerifyPacketType(result.value, options)); return promise.then(() => this._maybeVerifyPacketType(result.value, options));
@@ -497,9 +497,9 @@ export class PacketReader<T extends InputTrack = InputTrack> {
} }
} }
getNextKey(from: EncodedPacket, options: PacketRetrievalOptions = {}): MaybePromise<EncodedPacket | null> { getNextKey(packet: EncodedPacket, options: PacketRetrievalOptions = {}): MaybePromise<EncodedPacket | null> {
if (!(from instanceof EncodedPacket)) { if (!(packet instanceof EncodedPacket)) {
throw new TypeError('from must be an EncodedPacket.'); throw new TypeError('packet must be an EncodedPacket.');
} }
validatePacketRetrievalOptions(options); validatePacketRetrievalOptions(options);
@@ -508,11 +508,11 @@ export class PacketReader<T extends InputTrack = InputTrack> {
} }
if (options.verifyKeyPackets) { if (options.verifyKeyPackets) {
return this._getNextKeyVerified(from, options); return this._getNextKeyVerified(packet, options);
} }
const result = new ResultValue<EncodedPacket | null>(); const result = new ResultValue<EncodedPacket | null>();
const promise = this.track._backing.getNextKeyPacket(result, from, options); const promise = this.track._backing.getNextKeyPacket(result, packet, options);
if (result.pending) { if (result.pending) {
return promise.then(() => result.value); return promise.then(() => result.value);
@@ -522,11 +522,11 @@ export class PacketReader<T extends InputTrack = InputTrack> {
} }
private async _getNextKeyVerified( private async _getNextKeyVerified(
from: EncodedPacket, packet: EncodedPacket,
options: PacketRetrievalOptions, options: PacketRetrievalOptions,
): Promise<EncodedPacket | null> { ): Promise<EncodedPacket | null> {
const result = new ResultValue<EncodedPacket | null>(); const result = new ResultValue<EncodedPacket | null>();
const promise = this.track._backing.getNextKeyPacket(result, from, options); const promise = this.track._backing.getNextKeyPacket(result, packet, options);
if (result.pending) await promise; if (result.pending) await promise;
const nextPacket = result.value; const nextPacket = result.value;