@yume-chan/scrcpy-decoder-webcodecs 2.5.3 → 3.0.0-beta.1
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/LICENSE +1 -1
- package/README.md +1 -1
- package/esm/video/codec/av1.d.ts +4 -6
- package/esm/video/codec/av1.d.ts.map +1 -1
- package/esm/video/codec/av1.js +29 -95
- package/esm/video/codec/av1.js.map +1 -1
- package/esm/video/codec/h264.d.ts +4 -6
- package/esm/video/codec/h264.d.ts.map +1 -1
- package/esm/video/codec/h264.js +11 -21
- package/esm/video/codec/h264.js.map +1 -1
- package/esm/video/codec/h265.d.ts +4 -6
- package/esm/video/codec/h265.d.ts.map +1 -1
- package/esm/video/codec/h265.js +13 -27
- package/esm/video/codec/h265.js.map +1 -1
- package/esm/video/codec/h26x.d.ts +9 -6
- package/esm/video/codec/h26x.d.ts.map +1 -1
- package/esm/video/codec/h26x.js +25 -69
- package/esm/video/codec/h26x.js.map +1 -1
- package/esm/video/codec/index.d.ts +2 -1
- package/esm/video/codec/index.d.ts.map +1 -1
- package/esm/video/codec/index.js +2 -1
- package/esm/video/codec/index.js.map +1 -1
- package/esm/video/codec/type.d.ts +23 -8
- package/esm/video/codec/type.d.ts.map +1 -1
- package/esm/video/codec/vp8.d.ts +7 -0
- package/esm/video/codec/vp8.d.ts.map +1 -0
- package/esm/video/codec/vp8.js +36 -0
- package/esm/video/codec/vp8.js.map +1 -0
- package/esm/video/codec/vp9.d.ts +7 -0
- package/esm/video/codec/vp9.d.ts.map +1 -0
- package/esm/video/codec/vp9.js +40 -0
- package/esm/video/codec/vp9.js.map +1 -0
- package/esm/video/decoder.d.ts +60 -16
- package/esm/video/decoder.d.ts.map +1 -1
- package/esm/video/decoder.js +178 -136
- package/esm/video/decoder.js.map +1 -1
- package/esm/video/index.d.ts +1 -0
- package/esm/video/index.d.ts.map +1 -1
- package/esm/video/index.js +1 -0
- package/esm/video/index.js.map +1 -1
- package/esm/video/render/auto-canvas.d.ts +26 -0
- package/esm/video/render/auto-canvas.d.ts.map +1 -0
- package/esm/video/render/auto-canvas.js +80 -0
- package/esm/video/render/auto-canvas.js.map +1 -0
- package/esm/video/render/bitmap.d.ts +2 -2
- package/esm/video/render/bitmap.d.ts.map +1 -1
- package/esm/video/render/bitmap.js +18 -8
- package/esm/video/render/bitmap.js.map +1 -1
- package/esm/video/render/canvas.d.ts +38 -4
- package/esm/video/render/canvas.d.ts.map +1 -1
- package/esm/video/render/canvas.js +97 -10
- package/esm/video/render/canvas.js.map +1 -1
- package/esm/video/render/flow-control.d.ts +32 -0
- package/esm/video/render/flow-control.d.ts.map +1 -0
- package/esm/video/render/flow-control.js +139 -0
- package/esm/video/render/flow-control.js.map +1 -0
- package/esm/video/render/index.d.ts +2 -0
- package/esm/video/render/index.d.ts.map +1 -1
- package/esm/video/render/index.js +2 -0
- package/esm/video/render/index.js.map +1 -1
- package/esm/video/render/insertable-stream.d.ts +15 -3
- package/esm/video/render/insertable-stream.d.ts.map +1 -1
- package/esm/video/render/insertable-stream.js +29 -11
- package/esm/video/render/insertable-stream.js.map +1 -1
- package/esm/video/render/redraw.d.ts +31 -0
- package/esm/video/render/redraw.d.ts.map +1 -0
- package/esm/video/render/redraw.js +75 -0
- package/esm/video/render/redraw.js.map +1 -0
- package/esm/video/render/type.d.ts +8 -2
- package/esm/video/render/type.d.ts.map +1 -1
- package/esm/video/render/webgl.d.ts +38 -5
- package/esm/video/render/webgl.d.ts.map +1 -1
- package/esm/video/render/webgl.js +228 -59
- package/esm/video/render/webgl.js.map +1 -1
- package/esm/video/utils/index.d.ts +4 -0
- package/esm/video/utils/index.d.ts.map +1 -0
- package/esm/video/utils/index.js +4 -0
- package/esm/video/utils/index.js.map +1 -0
- package/esm/video/utils/snapshot.d.ts +2 -0
- package/esm/video/utils/snapshot.d.ts.map +1 -0
- package/esm/video/utils/snapshot.js +18 -0
- package/esm/video/utils/snapshot.js.map +1 -0
- package/esm/video/utils/timestamp.d.ts +19 -0
- package/esm/video/utils/timestamp.d.ts.map +1 -0
- package/esm/video/utils/timestamp.js +87 -0
- package/esm/video/utils/timestamp.js.map +1 -0
- package/esm/video/utils/video-decoder-stream.d.ts +30 -0
- package/esm/video/utils/video-decoder-stream.d.ts.map +1 -0
- package/esm/video/utils/video-decoder-stream.js +289 -0
- package/esm/video/utils/video-decoder-stream.js.map +1 -0
- package/package.json +12 -11
- package/src/video/codec/av1.ts +41 -131
- package/src/video/codec/h264.ts +15 -37
- package/src/video/codec/h265.ts +16 -45
- package/src/video/codec/h26x.ts +45 -96
- package/src/video/codec/index.ts +2 -1
- package/src/video/codec/type.ts +32 -12
- package/src/video/codec/vp8.ts +52 -0
- package/src/video/codec/vp9.ts +55 -0
- package/src/video/decoder.ts +212 -166
- package/src/video/index.ts +1 -0
- package/src/video/render/auto-canvas.ts +105 -0
- package/src/video/render/bitmap.ts +23 -9
- package/src/video/render/canvas.ts +157 -12
- package/src/video/render/flow-control.ts +182 -0
- package/src/video/render/index.ts +2 -0
- package/src/video/render/insertable-stream.ts +50 -10
- package/src/video/render/redraw.ts +88 -0
- package/src/video/render/type.ts +10 -2
- package/src/video/render/webgl.ts +316 -80
- package/src/video/utils/index.ts +3 -0
- package/src/video/utils/snapshot.ts +22 -0
- package/src/video/utils/timestamp.ts +108 -0
- package/src/video/utils/video-decoder-stream.ts +413 -0
- package/tsconfig.build.json +0 -14
- package/CHANGELOG.md +0 -140
- package/esm/video/codec/utils.d.ts +0 -4
- package/esm/video/codec/utils.d.ts.map +0 -1
- package/esm/video/codec/utils.js +0 -10
- package/esm/video/codec/utils.js.map +0 -1
- package/esm/video/snapshot.d.ts +0 -6
- package/esm/video/snapshot.d.ts.map +0 -1
- package/esm/video/snapshot.js +0 -41
- package/esm/video/snapshot.js.map +0 -1
- package/src/video/codec/utils.ts +0 -11
- package/src/video/snapshot.ts +0 -41
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl.js","sourceRoot":"","sources":["../../../src/video/render/webgl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"webgl.js","sourceRoot":"","sources":["../../../src/video/render/webgl.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,yBAAyB;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACH,eAAe,EACf,aAAa,EACb,aAAa,GAChB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,SAAS,YAAY,CAAC,EAAyB,EAAE,IAAY,EAAE,MAAc;IACzE,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAE,CAAC;IACtC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,aAAa,CAClB,EAAyB,EACzB,kBAA0B,EAC1B,oBAA4B;IAE5B,MAAM,YAAY,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IAC5E,MAAM,cAAc,GAAG,YAAY,CAC/B,EAAE,EACF,EAAE,CAAC,eAAe,EAClB,oBAAoB,CACvB,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;IACnC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACvC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACzC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAExB,IAAI,CAAC;QACD,IAAI,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;YAClD,OAAO,OAAO,CAAC;QAC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9B,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;YACjC,wBAAwB;YACxB,wGAAwG;YACxG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAED,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/video/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/video/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/video/utils/snapshot.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CACxB,MAAM,EAAE,iBAAiB,GAAG,eAAe,EAC3C,OAAO,CAAC,EAAE,kBAAkB,iBAmB/B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function canvasToBlob(canvas, options) {
|
|
2
|
+
if (canvas instanceof OffscreenCanvas) {
|
|
3
|
+
return canvas.convertToBlob(options);
|
|
4
|
+
}
|
|
5
|
+
else {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
canvas.toBlob((blob) => {
|
|
8
|
+
if (!blob) {
|
|
9
|
+
reject(new Error("Failed to convert canvas to blob"));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
resolve(blob);
|
|
13
|
+
}
|
|
14
|
+
}, options?.type, options?.quality);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/video/utils/snapshot.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CACxB,MAA2C,EAC3C,OAA4B;IAE5B,IAAI,MAAM,YAAY,eAAe,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACJ,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,CAAC,MAAM,CACT,CAAC,IAAI,EAAE,EAAE;gBACL,IAAI,CAAC,IAAI,EAAE,CAAC;oBACR,MAAM,CAAC,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC,CAAC;gBAC1D,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC;YACL,CAAC,EACD,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,OAAO,CACnB,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ScrcpyVideoDecoderPauseController } from "@yume-chan/scrcpy-decoder-shared";
|
|
2
|
+
import { TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
+
import type { CodecTransformStream } from "../codec/type.js";
|
|
4
|
+
/**
|
|
5
|
+
* Gets current time.
|
|
6
|
+
*
|
|
7
|
+
* The returned value is guaranteed to be monotonically increasing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function increasingNow(): number;
|
|
10
|
+
export declare class TimestampTransforms {
|
|
11
|
+
#private;
|
|
12
|
+
get addTimestamp(): TransformStream<ScrcpyVideoDecoderPauseController.Output, CodecTransformStream.Input>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the total time spent processing and decoding frames in milliseconds.
|
|
15
|
+
*/
|
|
16
|
+
get totalDecodeTime(): number;
|
|
17
|
+
get consumeTimestamp(): TransformStream<VideoFrame, VideoFrame>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=timestamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../../src/video/utils/timestamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA0B7D;;;;GAIG;AACH,wBAAgB,aAAa,WAO5B;AAED,qBAAa,mBAAmB;;IA8B5B,IAAI,YAAY,0FAEf;IAQD;;OAEG;IACH,IAAI,eAAe,WAElB;IAgBD,IAAI,gBAAgB,4CAEnB;CACJ"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { TransformStream } from "@yume-chan/stream-extra";
|
|
2
|
+
const view = new DataView(new ArrayBuffer(8));
|
|
3
|
+
/**
|
|
4
|
+
* Gets the next presentable double-precision floating point value greater than x
|
|
5
|
+
* @param x A number. The caller must ensure that x is not NaN or Infinity
|
|
6
|
+
* @returns The next presentable double-precision floating point value
|
|
7
|
+
*/
|
|
8
|
+
function nextUp(x) {
|
|
9
|
+
if (x === 0)
|
|
10
|
+
return Number.MIN_VALUE;
|
|
11
|
+
// Write the number as a float64
|
|
12
|
+
view.setFloat64(0, x, false);
|
|
13
|
+
let bits = view.getBigUint64(0, false);
|
|
14
|
+
// If x > 0, increment bits; if x < 0, decrement bits
|
|
15
|
+
bits += x > 0 ? 1n : -1n;
|
|
16
|
+
view.setBigUint64(0, bits, false);
|
|
17
|
+
return view.getFloat64(0, false);
|
|
18
|
+
}
|
|
19
|
+
let prevValue = 0;
|
|
20
|
+
/**
|
|
21
|
+
* Gets current time.
|
|
22
|
+
*
|
|
23
|
+
* The returned value is guaranteed to be monotonically increasing.
|
|
24
|
+
*/
|
|
25
|
+
export function increasingNow() {
|
|
26
|
+
let now = performance.now();
|
|
27
|
+
if (now <= prevValue) {
|
|
28
|
+
now = nextUp(prevValue);
|
|
29
|
+
}
|
|
30
|
+
prevValue = now;
|
|
31
|
+
return now;
|
|
32
|
+
}
|
|
33
|
+
export class TimestampTransforms {
|
|
34
|
+
/**
|
|
35
|
+
* Timestamp of the last frame to be skipped by pause controller.
|
|
36
|
+
*/
|
|
37
|
+
#skipFramesUntil = -1;
|
|
38
|
+
#addTimestamp = new TransformStream({
|
|
39
|
+
transform: (packet, controller) => {
|
|
40
|
+
if (packet.type === "configuration") {
|
|
41
|
+
controller.enqueue(packet);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Use `timestamp` to convey `skipRendering` to later step
|
|
45
|
+
// and track total decoding time
|
|
46
|
+
const timestamp = increasingNow();
|
|
47
|
+
if (packet.skipRendering) {
|
|
48
|
+
this.#skipFramesUntil = timestamp;
|
|
49
|
+
}
|
|
50
|
+
controller.enqueue({
|
|
51
|
+
...packet,
|
|
52
|
+
timestamp,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
get addTimestamp() {
|
|
57
|
+
return this.#addTimestamp;
|
|
58
|
+
}
|
|
59
|
+
// This is not in `VideoDecoderStream` because
|
|
60
|
+
// this time includes all pre-processing time,
|
|
61
|
+
// and requires `EncodedVideoChunk.timestamp` to contain
|
|
62
|
+
// local time of when the frame is received,
|
|
63
|
+
// which is set by this class.
|
|
64
|
+
#totalDecodeTime = 0;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the total time spent processing and decoding frames in milliseconds.
|
|
67
|
+
*/
|
|
68
|
+
get totalDecodeTime() {
|
|
69
|
+
return this.#totalDecodeTime;
|
|
70
|
+
}
|
|
71
|
+
#consumeTimestamp = new TransformStream({
|
|
72
|
+
transform: (frame, controller) => {
|
|
73
|
+
// `frame.timestamp` is the same `EncodedVideoChunk.timestamp` set above
|
|
74
|
+
this.#totalDecodeTime += performance.now() - frame.timestamp;
|
|
75
|
+
// Don't count these frames as skipped rendering
|
|
76
|
+
if (frame.timestamp <= this.#skipFramesUntil) {
|
|
77
|
+
frame.close();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
controller.enqueue(frame);
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
get consumeTimestamp() {
|
|
84
|
+
return this.#consumeTimestamp;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=timestamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../../src/video/utils/timestamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9C;;;;GAIG;AACH,SAAS,MAAM,CAAC,CAAS;IACrB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC;IAErC,gCAAgC;IAChC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IAE7B,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAEvC,qDAAqD;IACrD,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEzB,IAAI,CAAC,YAAY,C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CAAC;IACjC,CAAC;IAED,iBAAiB,GAAG,IAAI,eAAe,CAAyB;QAC5D,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YAC7B,wEAAwE;YACxE,IAAI,CAAC,gBAAgB,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;YAE7D,gDAAgD;YAChD,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC3C,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,OAAO;YACX,CAAC;YAED,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;KACJ,CAAC,CAAC;IACH,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ScrcpyVideoDecoderPerformanceCounterInterface } from "@yume-chan/scrcpy-decoder-shared";
|
|
2
|
+
import { TransformStream } from "@yume-chan/stream-extra";
|
|
3
|
+
import type { CodecTransformStream } from "../codec/type.js";
|
|
4
|
+
export declare class VideoDecoderStream extends TransformStream<CodecTransformStream.Config | CodecTransformStream.VideoChunk, VideoFrame> implements ScrcpyVideoDecoderPerformanceCounterInterface {
|
|
5
|
+
#private;
|
|
6
|
+
get hardwareAcceleration(): HardwareAcceleration;
|
|
7
|
+
get onHardwareAccelerationChange(): import("@yume-chan/event").Event<HardwareAcceleration>;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the number of frames waiting to be decoded.
|
|
10
|
+
*/
|
|
11
|
+
get decodeQueueSize(): number;
|
|
12
|
+
/**
|
|
13
|
+
* Gets an event when a frame is dequeued (either decoded or discarded).
|
|
14
|
+
*/
|
|
15
|
+
get onDequeue(): import("@yume-chan/event").Event<undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the number of frames decoded by the decoder.
|
|
18
|
+
*/
|
|
19
|
+
get framesDecoded(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the number of frames skipped by the decoder.
|
|
22
|
+
*/
|
|
23
|
+
get framesSkippedDecoding(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the number of times the decoder has been reset to catch up new keyframes.
|
|
26
|
+
*/
|
|
27
|
+
get decoderResetCount(): number;
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=video-decoder-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-decoder-stream.d.ts","sourceRoot":"","sources":["../../../src/video/utils/video-decoder-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,kCAAkC,CAAC;AAEtG,OAAO,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAyE7D,qBAAa,kBACT,SAAQ,eAAe,CACnB,oBAAoB,CAAC,MAAM,GAAG,oBAAoB,CAAC,UAAU,EAC7D,UAAU,CAEd,YAAW,6CAA6C;;IAYxD,IAAI,oBAAoB,yBAEvB;IACD,IAAI,4BAA4B,2DAE/B;IAED;;OAEG;IACH,IAAI,eAAe,WAMlB;IAGD;;OAEG;IACH,IAAI,SAAS,gDAEZ;IAGD;;OAEG;IACH,IAAI,aAAa,WAEhB;IACD;;OAEG;IACH,IAAI,qBAAqB,WAExB;IACD;;OAEG;IACH,IAAI,iBAAiB,WAEpB;;CAiRJ"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { EventEmitter, StickyEventEmitter } from "@yume-chan/event";
|
|
2
|
+
import { ScrcpyVideoDecoderPerformanceCounter } from "@yume-chan/scrcpy-decoder-shared";
|
|
3
|
+
import { concatBuffers, TransformStream } from "@yume-chan/stream-extra";
|
|
4
|
+
function decodeFirstKeyFrame(decoder, config, chunk) {
|
|
5
|
+
decoder.decode(new EncodedVideoChunk({
|
|
6
|
+
type: "key",
|
|
7
|
+
timestamp: chunk.timestamp,
|
|
8
|
+
// `lib.dom.d.ts` doesn't allow `duration` to be undefined.
|
|
9
|
+
duration: chunk.duration,
|
|
10
|
+
data: config.raw
|
|
11
|
+
? concatBuffers([config.raw, chunk.data])
|
|
12
|
+
: chunk.data,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
function decodeFrame(decoder, chunk) {
|
|
16
|
+
decoder.decode(new EncodedVideoChunk({
|
|
17
|
+
type: chunk.type,
|
|
18
|
+
timestamp: chunk.timestamp,
|
|
19
|
+
// `lib.dom.d.ts` doesn't allow `duration` to be undefined.
|
|
20
|
+
duration: chunk.duration,
|
|
21
|
+
data: chunk.data,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
export class VideoDecoderStream extends TransformStream {
|
|
25
|
+
#controller;
|
|
26
|
+
#state = { type: "unconfigured" };
|
|
27
|
+
#hardwareAcceleration = new StickyEventEmitter({
|
|
28
|
+
initialValue: "no-preference",
|
|
29
|
+
equals: (a, b) => a === b,
|
|
30
|
+
});
|
|
31
|
+
get hardwareAcceleration() {
|
|
32
|
+
return this.#hardwareAcceleration.value;
|
|
33
|
+
}
|
|
34
|
+
get onHardwareAccelerationChange() {
|
|
35
|
+
return this.#hardwareAcceleration.event;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the number of frames waiting to be decoded.
|
|
39
|
+
*/
|
|
40
|
+
get decodeQueueSize() {
|
|
41
|
+
if ("decoder" in this.#state) {
|
|
42
|
+
return this.#state.decoder.decodeQueueSize;
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
#onDequeue = new EventEmitter();
|
|
47
|
+
/**
|
|
48
|
+
* Gets an event when a frame is dequeued (either decoded or discarded).
|
|
49
|
+
*/
|
|
50
|
+
get onDequeue() {
|
|
51
|
+
return this.#onDequeue.event;
|
|
52
|
+
}
|
|
53
|
+
#counter = new ScrcpyVideoDecoderPerformanceCounter();
|
|
54
|
+
/**
|
|
55
|
+
* Gets the number of frames decoded by the decoder.
|
|
56
|
+
*/
|
|
57
|
+
get framesDecoded() {
|
|
58
|
+
return this.#counter.framesDecoded;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the number of frames skipped by the decoder.
|
|
62
|
+
*/
|
|
63
|
+
get framesSkippedDecoding() {
|
|
64
|
+
return this.#counter.framesSkippedDecoding;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Gets the number of times the decoder has been reset to catch up new keyframes.
|
|
68
|
+
*/
|
|
69
|
+
get decoderResetCount() {
|
|
70
|
+
return this.#counter.decoderResetCount;
|
|
71
|
+
}
|
|
72
|
+
#abortController = new AbortController();
|
|
73
|
+
#skipFramesBefore = -1;
|
|
74
|
+
constructor() {
|
|
75
|
+
let controller;
|
|
76
|
+
super({
|
|
77
|
+
start: (controller_) => {
|
|
78
|
+
// WARN: can't use `this` here
|
|
79
|
+
controller = controller_;
|
|
80
|
+
},
|
|
81
|
+
transform: async (chunk) => {
|
|
82
|
+
if ("codec" in chunk) {
|
|
83
|
+
this.#hardwareAcceleration.fire(chunk.hardwareAcceleration ?? "no-preference");
|
|
84
|
+
// Validate the config by creating decoder right away
|
|
85
|
+
switch (this.#state.type) {
|
|
86
|
+
case "unconfigured":
|
|
87
|
+
case "reclaimed":
|
|
88
|
+
this.#state = {
|
|
89
|
+
type: "configured",
|
|
90
|
+
decoder: this.#createDecoder(chunk),
|
|
91
|
+
config: chunk,
|
|
92
|
+
};
|
|
93
|
+
break;
|
|
94
|
+
// @ts-expect-error: intentional case fallthrough
|
|
95
|
+
case "decoding":
|
|
96
|
+
await this.#state.decoder.flush();
|
|
97
|
+
// fallthrough
|
|
98
|
+
case "configured":
|
|
99
|
+
// Reuse the existing decoder.
|
|
100
|
+
// `decoder` is definitely in "configured" state,
|
|
101
|
+
// otherwise the stream is in error state
|
|
102
|
+
// and no `transform` callbacks will be called.
|
|
103
|
+
this.#state.decoder.configure(chunk);
|
|
104
|
+
this.#state = {
|
|
105
|
+
type: "configured",
|
|
106
|
+
decoder: this.#state.decoder,
|
|
107
|
+
config: chunk,
|
|
108
|
+
};
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.#handleVideoChunk(chunk);
|
|
114
|
+
},
|
|
115
|
+
flush: async () => {
|
|
116
|
+
// only call `flush` when `decoder.state` is "configured".
|
|
117
|
+
if ("decoder" in this.#state &&
|
|
118
|
+
this.#state.decoder.state === "configured") {
|
|
119
|
+
// This also delays closing `readable` and `writable` streams
|
|
120
|
+
// (if they are not in error state) until all frames are decoded.
|
|
121
|
+
await this.#state.decoder.flush();
|
|
122
|
+
}
|
|
123
|
+
this.#dispose();
|
|
124
|
+
},
|
|
125
|
+
cancel: () => {
|
|
126
|
+
// Immediately close the decoder on stream cancel/error
|
|
127
|
+
this.#dispose();
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
this.#controller = controller;
|
|
131
|
+
}
|
|
132
|
+
#handleVideoChunk(chunk) {
|
|
133
|
+
switch (this.#state.type) {
|
|
134
|
+
case "unconfigured":
|
|
135
|
+
throw new Error("Decoder not configured");
|
|
136
|
+
case "configured": {
|
|
137
|
+
if (chunk.type === "delta") {
|
|
138
|
+
throw new Error("Expect a keyframe but got a delta frame");
|
|
139
|
+
}
|
|
140
|
+
decodeFirstKeyFrame(this.#state.decoder, this.#state.config, chunk);
|
|
141
|
+
this.#state = {
|
|
142
|
+
type: "decoding",
|
|
143
|
+
decoder: this.#state.decoder,
|
|
144
|
+
config: this.#state.config,
|
|
145
|
+
frames: [chunk],
|
|
146
|
+
};
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "decoding":
|
|
150
|
+
if (chunk.type === "key") {
|
|
151
|
+
this.#state.frames.length = 0;
|
|
152
|
+
}
|
|
153
|
+
this.#state.frames.push(chunk);
|
|
154
|
+
decodeFrame(this.#state.decoder, chunk);
|
|
155
|
+
break;
|
|
156
|
+
case "reclaimed": {
|
|
157
|
+
const decoder = this.#createDecoder(this.#state.config);
|
|
158
|
+
if (chunk.type === "key") {
|
|
159
|
+
decodeFirstKeyFrame(decoder, this.#state.config, chunk);
|
|
160
|
+
this.#state = {
|
|
161
|
+
type: "decoding",
|
|
162
|
+
decoder: decoder,
|
|
163
|
+
config: this.#state.config,
|
|
164
|
+
frames: [chunk],
|
|
165
|
+
};
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!this.#state.frames) {
|
|
169
|
+
// Reclaimed when configured but no frames have been decoded yet,
|
|
170
|
+
// so a keyframe is required to start decoding.
|
|
171
|
+
throw new Error("Expect a keyframe but got a delta frame");
|
|
172
|
+
}
|
|
173
|
+
decodeFirstKeyFrame(decoder, this.#state.config, this.#state.frames[0]);
|
|
174
|
+
// `chunk`s must have monotonic timestamps, so we can skip all frames before `chunk`.
|
|
175
|
+
this.#skipFramesBefore = chunk.timestamp;
|
|
176
|
+
this.#state.frames.push(chunk);
|
|
177
|
+
for (const frame of this.#state.frames.slice(1)) {
|
|
178
|
+
decodeFrame(decoder, frame);
|
|
179
|
+
}
|
|
180
|
+
this.#state = {
|
|
181
|
+
type: "decoding",
|
|
182
|
+
decoder: decoder,
|
|
183
|
+
config: this.#state.config,
|
|
184
|
+
frames: this.#state.frames,
|
|
185
|
+
};
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
#createDecoder(config) {
|
|
191
|
+
const decoder = new VideoDecoder({
|
|
192
|
+
output: (frame) => {
|
|
193
|
+
if (frame.timestamp < this.#skipFramesBefore) {
|
|
194
|
+
frame.close();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this.#counter.increaseFramesDecoded();
|
|
198
|
+
try {
|
|
199
|
+
this.#controller.enqueue(frame);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// `controller` is closed
|
|
203
|
+
frame.close();
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
207
|
+
error: async (error) => {
|
|
208
|
+
if (error.name === "QuotaExceededError") {
|
|
209
|
+
// Chrome reclaims inactive `VideoDecoder`'s after 90 seconds
|
|
210
|
+
// (for example due to pausing decoding when the document is hidden).
|
|
211
|
+
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webcodecs/reclaimable_codec.cc;l=181;drc=aba14550ed0b4620deb59e7c5f551cbde8970fb3
|
|
212
|
+
// Reset states, it will be recreated in next `transform` call.
|
|
213
|
+
switch (this.#state.type) {
|
|
214
|
+
case "unconfigured":
|
|
215
|
+
case "reclaimed":
|
|
216
|
+
// Don't throw, report errors to stream
|
|
217
|
+
this.#controller.error(new Error("Unexpected state when reclaiming decoder"));
|
|
218
|
+
this.#dispose();
|
|
219
|
+
return;
|
|
220
|
+
case "configured":
|
|
221
|
+
// Unlike `transform` callback,
|
|
222
|
+
// this doesn't re-create the decoder immediately,
|
|
223
|
+
// because the config has already been validated,
|
|
224
|
+
// and since browser reclaims the decoder to save hardware resources,
|
|
225
|
+
// we don't want to undo that by creating a new decoder immediately.
|
|
226
|
+
this.#state = {
|
|
227
|
+
type: "reclaimed",
|
|
228
|
+
config,
|
|
229
|
+
frames: undefined,
|
|
230
|
+
};
|
|
231
|
+
break;
|
|
232
|
+
case "decoding":
|
|
233
|
+
this.#state = {
|
|
234
|
+
type: "reclaimed",
|
|
235
|
+
config,
|
|
236
|
+
frames: this.#state.frames,
|
|
237
|
+
};
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// Maybe the decoder is hardware accelerated but the hardware has an issue,
|
|
243
|
+
// retry with software decoder.
|
|
244
|
+
if (error.name === "EncodingError" &&
|
|
245
|
+
this.#state.type === "decoding" &&
|
|
246
|
+
config.hardwareAcceleration !== "prefer-software") {
|
|
247
|
+
config.hardwareAcceleration = "prefer-software";
|
|
248
|
+
// Codecs like H.265 only support hardware acceleration,
|
|
249
|
+
// so we need to check if the software decoder is supported.
|
|
250
|
+
const support = await VideoDecoder.isConfigSupported(config);
|
|
251
|
+
if (support.supported) {
|
|
252
|
+
const decoder = this.#createDecoder(config);
|
|
253
|
+
// Replay frames with rendering skipping
|
|
254
|
+
this.#skipFramesBefore =
|
|
255
|
+
this.#state.frames.at(-1).timestamp;
|
|
256
|
+
decodeFirstKeyFrame(decoder, config, this.#state.frames[0]);
|
|
257
|
+
for (const frame of this.#state.frames.slice(1)) {
|
|
258
|
+
decodeFrame(decoder, frame);
|
|
259
|
+
}
|
|
260
|
+
// Update state
|
|
261
|
+
this.#hardwareAcceleration.fire("prefer-software");
|
|
262
|
+
this.#state.decoder = decoder;
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// Propagate other decoder errors to stream.
|
|
267
|
+
this.#controller.error(error);
|
|
268
|
+
this.#dispose();
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
// `dequeue` event added in Chrome 106,
|
|
272
|
+
// before that `VideoDecoder` is not a `EventTarget`
|
|
273
|
+
if (typeof decoder.addEventListener === "function") {
|
|
274
|
+
decoder.addEventListener("dequeue", () => this.#onDequeue.fire(undefined), { signal: this.#abortController.signal });
|
|
275
|
+
}
|
|
276
|
+
decoder.configure(config);
|
|
277
|
+
return decoder;
|
|
278
|
+
}
|
|
279
|
+
#dispose() {
|
|
280
|
+
this.#abortController.abort();
|
|
281
|
+
this.#onDequeue.dispose();
|
|
282
|
+
if ("decoder" in this.#state &&
|
|
283
|
+
this.#state.decoder.state !== "closed") {
|
|
284
|
+
this.#state.decoder.close();
|
|
285
|
+
}
|
|
286
|
+
this.#state = { type: "unconfigured" };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=video-decoder-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-dec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YACjD,OAAO,CAAC,gBAAgB,CACpB,SAAS,EACT,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EACrC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAC3C,CAAC;QACN,CAAC;QAED,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAE1B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAE1B,IACI,SAAS,IAAI,IAAI,CAAC,MAAM;YACxB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ,EACxC,CAAC;YACC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAC3C,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yume-chan/scrcpy-decoder-webcodecs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"description": "Raw H.264 stream decoder and renderer using WebCodecs API (requires modern browser).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adb",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"email": "cnsimonchan@live.com",
|
|
15
15
|
"url": "https://chensi.moe/blog"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "https://github.com/yume-chan/ya-webadb/tree/main/
|
|
17
|
+
"homepage": "https://github.com/yume-chan/ya-webadb/tree/main/libraries/scrcpy-decoder-webcodecs#readme",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/yume-chan/ya-webadb.git",
|
|
21
|
-
"directory": "
|
|
21
|
+
"directory": "libraries/scrcpy-decoder-webcodecs"
|
|
22
22
|
},
|
|
23
23
|
"bugs": {
|
|
24
24
|
"url": "https://github.com/yume-chan/ya-webadb/issues"
|
|
@@ -29,20 +29,21 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@yume-chan/async": "^4.1.3",
|
|
32
|
-
"@yume-chan/
|
|
33
|
-
"@yume-chan/
|
|
34
|
-
"@yume-chan/
|
|
35
|
-
"@yume-chan/
|
|
36
|
-
"@yume-chan/
|
|
32
|
+
"@yume-chan/scrcpy": "3.0.0-beta.1",
|
|
33
|
+
"@yume-chan/no-data-view": "3.0.0-beta.1",
|
|
34
|
+
"@yume-chan/scrcpy-decoder-shared": "3.0.0-beta.1",
|
|
35
|
+
"@yume-chan/event": "3.0.0-beta.1",
|
|
36
|
+
"@yume-chan/media-codec": "3.0.0-beta.1",
|
|
37
|
+
"@yume-chan/stream-extra": "3.0.0-beta.1"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"prettier": "^3.6
|
|
40
|
-
"typescript": "^
|
|
40
|
+
"prettier": "^3.9.6",
|
|
41
|
+
"typescript": "^6.0.3",
|
|
41
42
|
"@yume-chan/eslint-config": "^1.0.0",
|
|
42
43
|
"@yume-chan/tsconfig": "^1.0.0"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
|
-
"build": "tsc -
|
|
46
|
+
"build": "tsc -p tsconfig.build.json",
|
|
46
47
|
"lint": "run-eslint && prettier src/**/*.ts --write --tab-width 4"
|
|
47
48
|
}
|
|
48
49
|
}
|