scrap: ensure video_handler's creation before client start

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-06-09 17:14:26 +08:00
parent 2a91fb842d
commit feaadcfc96
3 changed files with 72 additions and 45 deletions

View File

@@ -1159,9 +1159,11 @@ where
let latency_controller = LatencyController::new();
let latency_controller_cl = latency_controller.clone();
// Create video_handler out of the thread below to ensure that the handler exists before client start.
// It will take a few tenths of a second for the first time, and then tens of milliseconds.
let mut video_handler = VideoHandler::new(latency_controller);
std::thread::spawn(move || {
let mut video_handler = VideoHandler::new(latency_controller);
loop {
if let Ok(data) = video_receiver.recv() {
match data {