mirror of
https://github.com/facefusion/facefusion.git
synced 2026-06-06 20:53:54 +02:00
fix dataflow in streamer
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
import subprocess
|
||||
from collections import deque
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import Deque, Iterator
|
||||
from typing import Deque, Iterator, List
|
||||
|
||||
import cv2
|
||||
import numpy
|
||||
@@ -20,6 +20,7 @@ from facefusion.vision import extract_vision_mask, read_static_images
|
||||
|
||||
def multi_process_capture(camera_capture : cv2.VideoCapture, camera_fps : Fps) -> Iterator[VisionFrame]:
|
||||
capture_deque : Deque[VisionFrame] = deque()
|
||||
source_vision_frames = read_static_images(state_manager.get_item('source_paths'))
|
||||
|
||||
with tqdm(desc = translator.get('streaming'), unit = 'frame', disable = state_manager.get_item('log_level') in [ 'warn', 'error' ]) as progress:
|
||||
with ThreadPoolExecutor(max_workers = state_manager.get_item('execution_thread_count')) as executor:
|
||||
@@ -31,7 +32,7 @@ def multi_process_capture(camera_capture : cv2.VideoCapture, camera_fps : Fps) -
|
||||
camera_capture.release()
|
||||
|
||||
if numpy.any(capture_vision_frame):
|
||||
future = executor.submit(process_stream_frame, capture_vision_frame)
|
||||
future = executor.submit(process_stream_frame, source_vision_frames, capture_vision_frame)
|
||||
futures.append(future)
|
||||
|
||||
for future_done in [ future for future in futures if future.done() ]:
|
||||
@@ -44,8 +45,7 @@ def multi_process_capture(camera_capture : cv2.VideoCapture, camera_fps : Fps) -
|
||||
yield capture_deque.popleft()
|
||||
|
||||
|
||||
def process_stream_frame(target_vision_frame : VisionFrame) -> VisionFrame:
|
||||
source_vision_frames = read_static_images(state_manager.get_item('source_paths'))
|
||||
def process_stream_frame(source_vision_frames : List[VisionFrame], target_vision_frame : VisionFrame) -> VisionFrame:
|
||||
source_audio_frame = create_empty_audio_frame()
|
||||
source_voice_frame = create_empty_audio_frame()
|
||||
temp_vision_frame = target_vision_frame.copy()
|
||||
|
||||
Reference in New Issue
Block a user