|
@@ -48,15 +48,23 @@ export class VDecoder extends EventEmitter {
|
|
|
switch (message.type) {
|
|
|
case "pictureReady":
|
|
|
// onPictureReady(message);
|
|
|
- // console.log(
|
|
|
- // "[VDecoder]::decodeData",
|
|
|
- // Object.assign(message, { clipId: this.decodingId })
|
|
|
- // );
|
|
|
+ console.log(
|
|
|
+ "[VDecoder]::decodeData",
|
|
|
+ Object.assign(message, { clipId: this.decodingId })
|
|
|
+ );
|
|
|
+ const { renderStateId } = e.data;
|
|
|
this.emit(
|
|
|
"decodeData",
|
|
|
Object.assign(message, { clipId: this.decodingId })
|
|
|
);
|
|
|
|
|
|
+ this.worker.postMessage({
|
|
|
+ type: "release",
|
|
|
+ renderStateId: renderStateId,
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log("[VDecoder]::decodeData:release",renderStateId);
|
|
|
+
|
|
|
if (this.decoding && this.decodingId) {
|
|
|
this.decodeNext(this.decodingId);
|
|
|
}
|
|
@@ -218,29 +226,30 @@ export class VDecoder extends EventEmitter {
|
|
|
if (nextFrame) {
|
|
|
this.decode(nextFrame, tempId);
|
|
|
} else {
|
|
|
- console.log("tempVideos", this.tempVideos.length);
|
|
|
- const clip = this.tempVideos.find(({ id }) => id === this.decodingId);
|
|
|
- if (clip) {
|
|
|
- const fps = (1000 / (Date.now() - this.start)) * clip.data.length;
|
|
|
- console.log(
|
|
|
- `Decoded ${clip.data.length} frames in ${
|
|
|
- Date.now() - this.start
|
|
|
- }ms @ ${fps >> 0}FPS`
|
|
|
- );
|
|
|
- } else {
|
|
|
- console.warn("不存在clip");
|
|
|
- }
|
|
|
+ // console.log("tempVideos", this.tempVideos.length);
|
|
|
+ // const clip = this.tempVideos.find(({ id }) => id === this.decodingId);
|
|
|
+ // if (clip) {
|
|
|
+ // const fps = (1000 / (Date.now() - this.start)) * clip.data.length;
|
|
|
+ // console.log(
|
|
|
+ // `Decoded ${clip.data.length} frames in ${
|
|
|
+ // Date.now() - this.start
|
|
|
+ // }ms @ ${fps >> 0}FPS`
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // console.warn("不存在clip");
|
|
|
+ // }
|
|
|
|
|
|
this.decoding = false;
|
|
|
// this.decodingId = null;
|
|
|
tempId = 0;
|
|
|
- clip && clip.id && this.emit("decodeDone", clip.id);
|
|
|
+ // clip && clip.id && this.emit("decodeDone", clip.id);
|
|
|
}
|
|
|
}
|
|
|
flush() {
|
|
|
this.tempVideos = [];
|
|
|
this.cacheBufferTotal = null;
|
|
|
- console.warn('flush')
|
|
|
+
|
|
|
+ console.warn("flush");
|
|
|
}
|
|
|
|
|
|
preloader(preload) {}
|