kopia lustrzana https://github.com/mifi/lossless-cut
fix crashes
rodzic
8a01a928a1
commit
8e361077a8
|
@ -28,6 +28,15 @@ export class RefuseOverwriteError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
export function fixRemoteBuffer(buffer: Buffer) {
|
||||
// if we don't do this when creating a Blob, we get:
|
||||
// "Failed to construct 'Blob': The provided ArrayBufferView value must not be resizable."
|
||||
// maybe when moving away from @electron/remote, it's not needed anymore?
|
||||
const buffer2 = Buffer.allocUnsafe(buffer.length);
|
||||
buffer.copy(buffer2);
|
||||
return buffer2;
|
||||
}
|
||||
|
||||
export function logStdoutStderr({ stdout, stderr }: { stdout: Buffer, stderr: Buffer }) {
|
||||
if (stdout.length > 0) {
|
||||
console.log('%cSTDOUT:', 'color: green; font-weight: bold');
|
||||
|
@ -492,7 +501,7 @@ async function renderThumbnail(filePath: string, timestamp: number) {
|
|||
|
||||
const { stdout } = await runFfmpeg(args);
|
||||
|
||||
const blob = new Blob([stdout], { type: 'image/jpeg' });
|
||||
const blob = new Blob([fixRemoteBuffer(stdout)], { type: 'image/jpeg' });
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
|
@ -507,7 +516,7 @@ export async function extractSubtitleTrack(filePath: string, streamId: number) {
|
|||
|
||||
const { stdout } = await runFfmpeg(args);
|
||||
|
||||
const blob = new Blob([stdout], { type: 'text/vtt' });
|
||||
const blob = new Blob([fixRemoteBuffer(stdout)], { type: 'text/vtt' });
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import sortBy from 'lodash/sortBy';
|
|||
import { useThrottle } from '@uidotdev/usehooks';
|
||||
import { waveformColorDark, waveformColorLight } from '../colors';
|
||||
|
||||
import { renderWaveformPng } from '../ffmpeg';
|
||||
import { fixRemoteBuffer, renderWaveformPng } from '../ffmpeg';
|
||||
import { RenderableWaveform } from '../types';
|
||||
import { FFprobeStream } from '../../../../ffprobe';
|
||||
|
||||
|
@ -73,12 +73,9 @@ export default ({ darkMode, filePath, relevantTime, duration, waveformEnabled, a
|
|||
return w;
|
||||
}
|
||||
|
||||
// if we don't do this, we get Failed to construct 'Blob': The provided ArrayBufferView value must not be resizable.
|
||||
const buffer2 = Buffer.allocUnsafe(buffer.length);
|
||||
buffer.copy(buffer2);
|
||||
return {
|
||||
...w,
|
||||
url: URL.createObjectURL(new Blob([buffer2], { type: 'image/png' })),
|
||||
url: URL.createObjectURL(new Blob([fixRemoteBuffer(buffer)], { type: 'image/png' })),
|
||||
};
|
||||
}));
|
||||
} catch (err) {
|
||||
|
|
Ładowanie…
Reference in New Issue