From 453112d5fa9f83edb9beec984d473e07e0714512 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 19 Nov 2024 18:34:27 +0200 Subject: [PATCH] An attempt to fix the sound issues --- crates/live_kit_client/src/live_kit_client.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/live_kit_client/src/live_kit_client.rs b/crates/live_kit_client/src/live_kit_client.rs index bb77eafdf7bd80..a816a9ee94e47d 100644 --- a/crates/live_kit_client/src/live_kit_client.rs +++ b/crates/live_kit_client/src/live_kit_client.rs @@ -218,8 +218,16 @@ pub fn capture_local_audio_track( ); } if let Some(stream) = &stream { - loop { - stream.play().log_err(); + stream.play().log_err(); + } + + // We need to keep the thread alive and task not dropped, so the `stream` is not dropped. + // `stream` is `!Send` so we cannot move it away anywhere else. + loop { + std::thread::park(); + // Suppress the unreachable code warning + if false { + break; } }