Fix things that broke in the merge

This commit is contained in:
Vanilagy
2026-05-04 17:58:05 +02:00
parent 2e933ee5fc
commit 6d9fb30c29
3 changed files with 19 additions and 5 deletions
+2 -1
View File
@@ -3,5 +3,6 @@
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },
"typescript.tsdk": "node_modules/typescript/lib" "typescript.tsdk": "node_modules/typescript/lib",
"js/ts.tsdk.path": "node_modules/typescript/lib"
} }
+9 -4
View File
@@ -102,6 +102,10 @@ export abstract class VideoSampleResource {
/** Returns the height of the frame in pixels. */ /** Returns the height of the frame in pixels. */
abstract getCodedHeight(): number; abstract getCodedHeight(): number;
abstract getSquarePixelWidth(): number;
abstract getSquarePixelHeight(): number;
/** Returns the color space of the frame. */ /** Returns the color space of the frame. */
abstract getColorSpace(): VideoSampleColorSpace; abstract getColorSpace(): VideoSampleColorSpace;
@@ -401,8 +405,8 @@ export class VideoSample implements Disposable {
this.squarePixelWidth = this.rotation % 180 === 0 ? init.displayWidth : init.displayHeight!; this.squarePixelWidth = this.rotation % 180 === 0 ? init.displayWidth : init.displayHeight!;
this.squarePixelHeight = this.rotation % 180 === 0 ? init.displayHeight! : init.displayWidth; this.squarePixelHeight = this.rotation % 180 === 0 ? init.displayHeight! : init.displayWidth;
} else { } else {
this.squarePixelWidth = this.codedWidth; this.squarePixelWidth = this.visibleRect.width;
this.squarePixelHeight = this.codedHeight; this.squarePixelHeight = this.visibleRect.height;
} }
} else if (typeof VideoFrame !== 'undefined' && data instanceof VideoFrame) { } else if (typeof VideoFrame !== 'undefined' && data instanceof VideoFrame) {
if (init?.rotation !== undefined && ![0, 90, 180, 270].includes(init.rotation)) { if (init?.rotation !== undefined && ![0, 90, 180, 270].includes(init.rotation)) {
@@ -533,8 +537,9 @@ export class VideoSample implements Disposable {
data._referenceCount++; data._referenceCount++;
this.format = data.getFormat(); this.format = data.getFormat();
this.codedWidth = data.getCodedWidth(); this.visibleRect = { left: 0, top: 0, width: data.getCodedWidth(), height: data.getCodedHeight() };
this.codedHeight = data.getCodedHeight(); this.squarePixelWidth = data.getSquarePixelWidth();
this.squarePixelHeight = data.getSquarePixelHeight();
this.rotation = init.rotation ?? 0; this.rotation = init.rotation ?? 0;
this.timestamp = init.timestamp!; this.timestamp = init.timestamp!;
this.duration = init.duration ?? 0; this.duration = init.duration ?? 0;
@@ -25,6 +25,14 @@ class ImageVideoSampleResource extends VideoSampleResource {
return this.image!.height; return this.image!.height;
} }
getSquarePixelWidth() {
return this.image!.width;
}
getSquarePixelHeight() {
return this.image!.height;
}
getColorSpace() { getColorSpace() {
return new VideoSampleColorSpace({ return new VideoSampleColorSpace({
matrix: 'rgb', matrix: 'rgb',