mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
perf(app): defer media capture routing and skip offscreen skeleton layout (#1732)
This commit is contained in:
1 parent
591e9fe2ba
commit
698469fa96
9 files changed
+168
-34
No files matched your search
@@ -236,10 +236,33 @@ export function getSoundCaptureMasterGainNode(): GainNode {
|
||||
return getMasterGainNode();
|
||||
}
|
||||
|
||||
const soundCaptureActivationListeners: Set<() => void> = new Set();
|
||||
|
||||
export function isSoundCaptureActive(): boolean {
|
||||
return captureTaps.size > 0;
|
||||
}
|
||||
|
||||
export function onSoundCaptureActivated(listener: () => void): () => void {
|
||||
soundCaptureActivationListeners.add(listener);
|
||||
return () => {
|
||||
soundCaptureActivationListeners.delete(listener);
|
||||
};
|
||||
}
|
||||
|
||||
export function addSoundCaptureDestination(node: AudioNode): void {
|
||||
if (captureTaps.has(node)) return;
|
||||
const master = getMasterGainNode();
|
||||
const wasInactive = captureTaps.size === 0;
|
||||
captureTaps.add(node);
|
||||
if (wasInactive) {
|
||||
for (const listener of soundCaptureActivationListeners) {
|
||||
try {
|
||||
listener();
|
||||
} catch (error) {
|
||||
logger.warn('Sound capture activation listener failed', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
master.connect(node);
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user