79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
// Metro module 15908 (f15909).
|
|
import _slicedToArray from "../../../../_bundle/_slicedToArray";
|
|
import { useId, useCallback, useEffect } from "react";
|
|
class VoicePanelStreamOutputSinkStack {
|
|
constructor(a0, r6 = false) {
|
|
this.activeSinks = new Map();
|
|
this.timer = -1;
|
|
this.mediaEngine = a0;
|
|
if (r6) {
|
|
this.timer = setInterval(() => this.logSinks(), 2000);
|
|
}
|
|
}
|
|
cleanUp() {
|
|
clearInterval(this.timer);
|
|
}
|
|
logSinks() {
|
|
const r9 = [];
|
|
for (const activeSink of this.activeSinks) {
|
|
const r35 = _slicedToArray(activeSink, 2);
|
|
r9.push(`[Stream:${r35[0]}, Locks:[${Array.from(r35[1]).join(",")}]]`);
|
|
}
|
|
}
|
|
setHasActiveVideoOutputSink(a0, a1, a2) {
|
|
let r13 = this.activeSinks.get(a1);
|
|
if (r13 == null) {
|
|
r13 = new Set();
|
|
}
|
|
const r19 = r13.has(a0);
|
|
if (a2) {
|
|
if (r19) {
|
|
return void 0;
|
|
}
|
|
r13.add(a0);
|
|
if (r13.size === 1) {
|
|
this.setActive(a1, true, this.sourceId(a0));
|
|
this.activeSinks.set(a1, r13);
|
|
}
|
|
} else {
|
|
if (!r19) {
|
|
return void 0;
|
|
}
|
|
r13.delete(a0);
|
|
if (r13.size === 0) {
|
|
this.setActive(a1, false, this.sourceId(a0));
|
|
this.activeSinks.delete(a1);
|
|
}
|
|
}
|
|
}
|
|
clearLock(a0) {
|
|
for (const activeSink of this.activeSinks) {
|
|
const [r32, r33] = activeSink;
|
|
if (r33.has(a0)) {
|
|
r33.delete(a0);
|
|
if (r33.size === 0) {
|
|
const setActive2 = this.setActive;
|
|
setActive2.call(this, r32, false, this.sourceId(a0));
|
|
this.activeSinks.delete(r32);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
setActive(c22592_0, c22592_1, c22592_2) {
|
|
this.mediaEngine.eachConnection((a0) => a0.setHasActiveVideoOutputSink(c22592_0, c22592_1, c22592_2));
|
|
}
|
|
sourceId(a0) {
|
|
return `VoicePanelStreamOutputSinkStack-${a0}`;
|
|
}
|
|
}
|
|
export default VoicePanelStreamOutputSinkStack;
|
|
export function useSetHasActiveVideoOutputSink(a0) {
|
|
let c22593_0 = a0;
|
|
const id = useId();
|
|
const callback = useCallback((a0, a1) => {
|
|
c22593_0.setHasActiveVideoOutputSink(id, a0, a1);
|
|
}, [id, a0]);
|
|
useEffect(() => () => c22593_0.clearLock(id), [id, callback, a0]);
|
|
return callback;
|
|
}
|