mediabunny 1.7.1 → 1.7.3
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/dist/bundles/mediabunny.cjs +18 -18
- package/dist/bundles/mediabunny.min.cjs +1 -1
- package/dist/bundles/mediabunny.min.mjs +1 -1
- package/dist/bundles/mediabunny.mjs +18 -18
- package/dist/mediabunny.d.ts +3 -2
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.js +5 -0
- package/dist/modules/src/media-sink.d.ts.map +1 -1
- package/dist/modules/src/media-sink.js +7 -1
- package/dist/modules/src/media-source.d.ts +3 -2
- package/dist/modules/src/media-source.d.ts.map +1 -1
- package/dist/modules/src/media-source.js +21 -22
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/isobmff/isobmff-demuxer.ts +6 -0
- package/src/media-sink.ts +7 -1
- package/src/media-source.ts +25 -24
|
@@ -9074,6 +9074,10 @@ ${cue.notes ?? ""}`;
|
|
|
9074
9074
|
this.customDecoderCallSerializer = new CallSerializer();
|
|
9075
9075
|
this.customDecoderQueueSize = 0;
|
|
9076
9076
|
const sampleHandler = (sample) => {
|
|
9077
|
+
if (sample.numberOfFrames === 0) {
|
|
9078
|
+
sample.close();
|
|
9079
|
+
return;
|
|
9080
|
+
}
|
|
9077
9081
|
const sampleRate = decoderConfig.sampleRate;
|
|
9078
9082
|
sample.setTimestamp(Math.round(sample.timestamp * sampleRate) / sampleRate);
|
|
9079
9083
|
onSample(sample);
|
|
@@ -10663,7 +10667,8 @@ ${cue.notes ?? ""}`;
|
|
|
10663
10667
|
super(codec);
|
|
10664
10668
|
}
|
|
10665
10669
|
/**
|
|
10666
|
-
* Adds an encoded packet to the output video track.
|
|
10670
|
+
* Adds an encoded packet to the output video track. Packets must be added in *decode order*, while a packet's
|
|
10671
|
+
* timestamp must be its *presentation timestamp*. B-frames are handled automatically.
|
|
10667
10672
|
*
|
|
10668
10673
|
* @param meta - Additional metadata from the encoder. You should pass this for the first call, including a valid
|
|
10669
10674
|
* decoder config.
|
|
@@ -10769,13 +10774,9 @@ ${cue.notes ?? ""}`;
|
|
|
10769
10774
|
this.lastMultipleOfKeyFrameInterval = multipleOfKeyFrameInterval;
|
|
10770
10775
|
if (this.customEncoder) {
|
|
10771
10776
|
this.customEncoderQueueSize++;
|
|
10772
|
-
const
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
videoSample.close();
|
|
10776
|
-
}
|
|
10777
|
-
}).catch((error) => {
|
|
10778
|
-
this.encoderError ??= error;
|
|
10777
|
+
const clonedSample = videoSample.clone();
|
|
10778
|
+
const promise = this.customEncoderCallSerializer.call(() => this.customEncoder.encode(clonedSample, finalEncodeOptions)).then(() => this.customEncoderQueueSize--).catch((error) => this.encoderError ??= error).finally(() => {
|
|
10779
|
+
clonedSample.close();
|
|
10779
10780
|
});
|
|
10780
10781
|
if (this.customEncoderQueueSize >= 4) {
|
|
10781
10782
|
await promise;
|
|
@@ -10858,6 +10859,7 @@ ${cue.notes ?? ""}`;
|
|
|
10858
10859
|
void this.muxer.addEncodedVideoPacket(this.source._connectedTrack, packet, meta);
|
|
10859
10860
|
},
|
|
10860
10861
|
error: (error) => {
|
|
10862
|
+
error.stack = new Error().stack;
|
|
10861
10863
|
this.encoderError ??= error;
|
|
10862
10864
|
}
|
|
10863
10865
|
});
|
|
@@ -10892,7 +10894,6 @@ ${cue.notes ?? ""}`;
|
|
|
10892
10894
|
}
|
|
10893
10895
|
checkForEncoderError() {
|
|
10894
10896
|
if (this.encoderError) {
|
|
10895
|
-
this.encoderError.stack = new Error().stack;
|
|
10896
10897
|
throw this.encoderError;
|
|
10897
10898
|
}
|
|
10898
10899
|
}
|
|
@@ -11100,7 +11101,7 @@ ${cue.notes ?? ""}`;
|
|
|
11100
11101
|
super(codec);
|
|
11101
11102
|
}
|
|
11102
11103
|
/**
|
|
11103
|
-
* Adds an encoded packet to the output audio track.
|
|
11104
|
+
* Adds an encoded packet to the output audio track. Packets must be added in *decode order*.
|
|
11104
11105
|
*
|
|
11105
11106
|
* @param meta - Additional metadata from the encoder. You should pass this for the first call, including a valid
|
|
11106
11107
|
* decoder config.
|
|
@@ -11198,13 +11199,9 @@ ${cue.notes ?? ""}`;
|
|
|
11198
11199
|
assert(this.encoderInitialized);
|
|
11199
11200
|
if (this.customEncoder) {
|
|
11200
11201
|
this.customEncoderQueueSize++;
|
|
11201
|
-
const
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
audioSample.close();
|
|
11205
|
-
}
|
|
11206
|
-
}).catch((error) => {
|
|
11207
|
-
this.encoderError ??= error;
|
|
11202
|
+
const clonedSample = audioSample.clone();
|
|
11203
|
+
const promise = this.customEncoderCallSerializer.call(() => this.customEncoder.encode(clonedSample)).then(() => this.customEncoderQueueSize--).catch((error) => this.encoderError ??= error).finally(() => {
|
|
11204
|
+
clonedSample.close();
|
|
11208
11205
|
});
|
|
11209
11206
|
if (this.customEncoderQueueSize >= 4) {
|
|
11210
11207
|
await promise;
|
|
@@ -11340,6 +11337,7 @@ ${cue.notes ?? ""}`;
|
|
|
11340
11337
|
void this.muxer.addEncodedAudioPacket(this.source._connectedTrack, packet, meta);
|
|
11341
11338
|
},
|
|
11342
11339
|
error: (error) => {
|
|
11340
|
+
error.stack = new Error().stack;
|
|
11343
11341
|
this.encoderError ??= error;
|
|
11344
11342
|
}
|
|
11345
11343
|
});
|
|
@@ -11471,7 +11469,6 @@ ${cue.notes ?? ""}`;
|
|
|
11471
11469
|
}
|
|
11472
11470
|
checkForEncoderError() {
|
|
11473
11471
|
if (this.encoderError) {
|
|
11474
|
-
this.encoderError.stack = new Error().stack;
|
|
11475
11472
|
throw this.encoderError;
|
|
11476
11473
|
}
|
|
11477
11474
|
}
|
|
@@ -13256,6 +13253,9 @@ ${cue.notes ?? ""}`;
|
|
|
13256
13253
|
const sampleIndex = this.metadataReader.readU32() - 1;
|
|
13257
13254
|
track.sampleTable.keySampleIndices.push(sampleIndex);
|
|
13258
13255
|
}
|
|
13256
|
+
if (track.sampleTable.keySampleIndices[0] !== 0) {
|
|
13257
|
+
track.sampleTable.keySampleIndices.unshift(0);
|
|
13258
|
+
}
|
|
13259
13259
|
}
|
|
13260
13260
|
;
|
|
13261
13261
|
break;
|