Merge pull request #250 from arounyf/pr/audio-fix

fix: 修复 WebRTC 音频/视频接收器重启时破音问题
This commit is contained in:
SilentWind
2026-05-05 12:12:17 +08:00
committed by GitHub

View File

@@ -680,7 +680,13 @@ impl UniversalSession {
);
});
*self.video_receiver_handle.lock().await = Some(handle);
{
let mut guard = self.video_receiver_handle.lock().await;
if let Some(old) = guard.take() {
old.abort();
}
*guard = Some(handle);
}
}
pub async fn start_audio_from_opus(
@@ -767,7 +773,13 @@ impl UniversalSession {
);
});
*self.audio_receiver_handle.lock().await = Some(handle);
{
let mut guard = self.audio_receiver_handle.lock().await;
if let Some(old) = guard.take() {
old.abort();
}
*guard = Some(handle);
}
}
pub fn has_audio(&self) -> bool {