mirror of
https://github.com/facefusion/facefusion.git
synced 2026-06-02 19:01:35 +02:00
4fe79483ea
* fix executor thread not terminating after stream deletion * fix stream shutdown and thread lifecycle * add todo * cleanup * cleanup * cleanup * cleanup * audio_queue.put() → get_nowait() + put_nowait() * rename test * fix test * merge tests * cleanup tests * cleanup tests * cleanup tests * simplify test logic with mock * cleanup * cleanup hard to read stream_helper.py * introduce rtc_peer.has_peers * fix lint * add todos * fix test hash
34 lines
646 B
Python
34 lines
646 B
Python
from typing import List
|
|
|
|
from facefusion import rtc
|
|
from facefusion.types import RtcPeer, RtcStore, SessionId
|
|
|
|
RTC_STORE : RtcStore = {}
|
|
|
|
|
|
def init_peers(session_id : SessionId) -> None:
|
|
RTC_STORE[session_id] = []
|
|
|
|
|
|
def get_peers(session_id : SessionId) -> List[RtcPeer]:
|
|
return RTC_STORE.get(session_id)
|
|
|
|
|
|
def delete_peers(session_id : SessionId) -> None:
|
|
if session_id in RTC_STORE:
|
|
rtc_peers = get_peers(session_id)
|
|
|
|
if rtc_peers:
|
|
rtc.delete_peers(rtc_peers)
|
|
del RTC_STORE[session_id]
|
|
|
|
return None
|
|
|
|
|
|
def has_peers(session_id : SessionId) -> bool:
|
|
return bool(RTC_STORE.get(session_id))
|
|
|
|
|
|
def clear() -> None:
|
|
RTC_STORE.clear()
|