refactor: code cleanup

This commit is contained in:
Simon Chan 2024-06-02 01:55:26 +08:00
parent c440e83828
commit 721b6c0da6
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
68 changed files with 1161 additions and 1036 deletions

View file

@ -45,8 +45,8 @@
"@yume-chan/tsconfig": "workspace:^1.0.0",
"cross-env": "^7.0.3",
"jest": "^30.0.0-alpha.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"prettier": "^3.3.0",
"ts-jest": "^29.1.4",
"typescript": "^5.4.5"
}
}

View file

@ -339,11 +339,9 @@ export class WebCodecsVideoDecoder implements ScrcpyVideoDecoder {
// AV1 doesn't need to do this, the handling code also doesn't set `#config`.
let data: Uint8Array;
if (this.#config !== undefined) {
data = new Uint8Array(
this.#config.byteLength + packet.data.byteLength,
);
data = new Uint8Array(this.#config.length + packet.data.length);
data.set(this.#config, 0);
data.set(packet.data, this.#config.byteLength);
data.set(packet.data, this.#config.length);
this.#config = undefined;
} else {
data = packet.data;