mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-02 05:13:50 +02:00
Fix some bugs & polish edge cases
This commit is contained in:
+1
-1
@@ -1726,7 +1726,7 @@ const colorAlphaMergerWorkerCode = () => {
|
||||
|
||||
const format = alpha.format;
|
||||
if (format === 'RGBA' || format === 'BGRA' || format === 'RGBX' || format === 'BGRX') {
|
||||
// Pack alpha data tightly
|
||||
// Pack alpha data tightly. Assume alpha is stored in RGB, so sample just from R for simplicity.
|
||||
const rOffset = (format === 'RGBA' || format === 'RGBX') ? 0 : 2;
|
||||
const pixelCount = width * height;
|
||||
for (let i = 0; i < pixelCount; i++) {
|
||||
|
||||
+3
-2
@@ -1245,8 +1245,9 @@ export class VideoSample implements Disposable {
|
||||
? [this.squarePixelWidth, this.squarePixelHeight]
|
||||
: [this.squarePixelHeight, this.squarePixelWidth];
|
||||
|
||||
if (options.crop) {
|
||||
clampCropRectangle(options.crop, rotatedWidth, rotatedHeight);
|
||||
let finalCrop = options.crop;
|
||||
if (finalCrop) {
|
||||
finalCrop = clampCropRectangle(finalCrop, rotatedWidth, rotatedHeight);
|
||||
}
|
||||
|
||||
// These variables specify where the final sample will be drawn on the canvas
|
||||
|
||||
+7
-5
@@ -591,11 +591,13 @@ const DEFAULT_RETRY_DELAY
|
||||
// Check if this could be a CORS error. If so, we cannot recover from it and
|
||||
// should not attempt to retry.
|
||||
// CORS errors are intentionally not opaque, so we need to rely on heuristics.
|
||||
const couldBeCorsError = error instanceof Error && (
|
||||
error.message.includes('Failed to fetch') // Chrome
|
||||
|| error.message.includes('Load failed') // Safari
|
||||
|| error.message.includes('NetworkError when attempting to fetch resource') // Firefox
|
||||
);
|
||||
const couldBeCorsError = error instanceof Error
|
||||
&& (
|
||||
error.message.includes('Failed to fetch') // Chrome
|
||||
|| error.message.includes('Load failed') // Safari
|
||||
|| error.message.includes('NetworkError when attempting to fetch resource') // Firefox
|
||||
)
|
||||
&& typeof window !== 'undefined'; // CORS only happens in browser environments
|
||||
|
||||
if (couldBeCorsError) {
|
||||
let originOfSrc: string | null = null;
|
||||
|
||||
Reference in New Issue
Block a user