mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 23:35:43 +00:00
fix(export, native, ui): resolve critical data integrity and resource management bugs in PR #122
- Implement comprehensive solo/mute export pipeline in audioEncoder.ts - Fix duplicate caption IDs by adding chunk-specific indices in handlers.ts - Prioritize native monitor selection by bounds in monitor_utils.cpp - Fix alignment for blur annotations extending beyond canvas boundaries - Resolve timeline selection desync and sidebar visibility for blur annotations - Fix memory leaks in audio waveform generation with AudioContext cleanup
This commit is contained in:
@@ -13,12 +13,12 @@ export async function generateWaveform(audioPath: string, samples = 200): Promis
|
||||
return waveformCache.get(cacheKey)!;
|
||||
}
|
||||
|
||||
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
||||
try {
|
||||
const response = await fetch(toFileUrl(audioPath));
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
|
||||
// Use an offline audio context to decode the data
|
||||
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
||||
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
||||
|
||||
const channelData = audioBuffer.getChannelData(0); // Use the first channel
|
||||
@@ -40,5 +40,11 @@ export async function generateWaveform(audioPath: string, samples = 200): Promis
|
||||
} catch (error) {
|
||||
console.error('Failed to generate waveform:', error);
|
||||
return new Array(samples).fill(0);
|
||||
} finally {
|
||||
try {
|
||||
await audioContext.close();
|
||||
} catch (e) {
|
||||
// ignore close errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user