fix: fix review comments

This commit is contained in:
Simon Chan 2025-08-28 14:14:30 +08:00
parent 956693c1f6
commit 72bf025804
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
4 changed files with 54 additions and 121 deletions

View file

@ -1,118 +0,0 @@
# Change Log - @yume-chan/event
## 2.0.0
### Minor Changes
- 05c01ad: Make `DeviceObserver#onListChange` sticky
## 1.0.1
### Patch Changes
- 53688d3: Use PNPM workspace and Changesets to manage the monorepo.
Because Changesets doesn't support alpha versions (`0.x.x`), this version is `1.0.0`. Future versions will follow SemVer rules, for example, breaking API changes will introduce a new major version.
This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
## 0.0.24
Tue, 18 Jun 2024 02:49:43 GMT
_Version update only_
## 0.0.23
Thu, 21 Mar 2024 03:15:10 GMT
_Version update only_
## 0.0.22
Wed, 13 Dec 2023 05:57:27 GMT
_Version update only_
## 0.0.21
Fri, 25 Aug 2023 14:05:18 GMT
_Version update only_
## 0.0.20
Mon, 05 Jun 2023 02:51:41 GMT
_Version update only_
## 0.0.19
Sun, 09 Apr 2023 05:55:33 GMT
_Version update only_
## 0.0.18
Wed, 25 Jan 2023 21:33:49 GMT
_Version update only_
## 0.0.17
Tue, 18 Oct 2022 09:32:30 GMT
_Version update only_
## 0.0.16
Sat, 28 May 2022 03:56:37 GMT
### Updates
- Upgrade TypeScript to 4.7.2 to enable Node.js ESM
## 0.0.15
Mon, 02 May 2022 04:18:01 GMT
_Version update only_
## 0.0.14
Sat, 30 Apr 2022 14:05:48 GMT
_Version update only_
## 0.0.13
Thu, 28 Apr 2022 01:23:53 GMT
_Version update only_
## 0.0.12
Sun, 03 Apr 2022 11:18:47 GMT
_Version update only_
## 0.0.11
Sun, 03 Apr 2022 11:18:11 GMT
### Updates
- Improve compatibility with Node.js 12 ESM format
- Update license year
## 0.0.10
Sun, 09 Jan 2022 15:52:20 GMT
_Version update only_
## 0.0.9
Sun, 09 Jan 2022 15:50:20 GMT
_Initial release_

View file

@ -200,6 +200,13 @@ export class Av1 extends BitReader {
static TransferCharacteristics = TransferCharacteristics;
static MatrixCoefficients = MatrixCoefficients;
/**
* Generate a codec string from an AV1 sequence header
* per Section 5 of AV1 Codec ISO Media File Format Binding
* https://aomediacodec.github.io/av1-isobmff/#codecsparam
* @param sequenceHeader The parsed AV1 sequence header
* @returns A codec string
*/
static toCodecString(sequenceHeader: Av1.SequenceHeaderObu) {
const {
seq_profile: seqProfile,

View file

@ -1,11 +1,53 @@
export function hexDigits(value: number) {
if (value % 1 !== 0) {
// This also checks NaN and Infinity
throw new Error("Value must be an integer");
}
if (value < 0) {
throw new Error("Value must be positive");
}
return value.toString(16).toUpperCase();
}
export function hexTwoDigits(value: number) {
return value.toString(16).toUpperCase().padStart(2, "0");
if (value % 1 !== 0) {
// This also checks NaN and Infinity
throw new Error("Value must be an integer");
}
if (value < 0) {
throw new Error("Value must be positive");
}
if (value >= 256) {
throw new Error("Value must be less than 256");
}
// Small optimization
if (value < 16) {
return "0" + value.toString(16).toUpperCase();
}
return value.toString(16).toUpperCase();
}
export function decimalTwoDigits(value: number) {
return value.toString(10).padStart(2, "0");
if (value % 1 !== 0) {
// This also checks NaN and Infinity
throw new Error("Value must be an integer");
}
if (value < 0) {
throw new Error("Value must be positive");
}
if (value >= 100) {
throw new Error("Value must be less than 256");
}
if (value < 10) {
return "0" + value.toString(10);
}
return value.toString(10);
}

View file

@ -25,7 +25,9 @@ export class H265Decoder extends H26xDecoder {
this.#decoder.configure({
codec: H265.toCodecString(configuration),
// Microsoft Edge requires explicit size to work
// Microsoft Edge on Windows requires explicit size,
// otherwise it returns frames in incorrect size.
// And it needs cropped size, as opposed to the option name.
codedWidth: configuration.croppedWidth,
codedHeight: configuration.croppedHeight,
optimizeForLatency: true,