diff options
| author | Eskil Q <eskilq@kth.se> | 2021-01-06 23:50:09 +0100 |
|---|---|---|
| committer | Eskil Q <eskilq@kth.se> | 2021-01-06 23:50:09 +0100 |
| commit | 92d5b21bf0f910f219c473002f83ba93ddcbee6d (patch) | |
| tree | 5280eb78c1e75e711ba5091c4ddeb6fa0ac79f69 /mumd/src/audio.rs | |
| parent | 02e6f2b84d72294b29a1698c1b73fbb5697815da (diff) | |
| download | mum-92d5b21bf0f910f219c473002f83ba93ddcbee6d.tar.gz | |
fix deadlock
Diffstat (limited to 'mumd/src/audio.rs')
| -rw-r--r-- | mumd/src/audio.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs index 3f03e61..bdc8377 100644 --- a/mumd/src/audio.rs +++ b/mumd/src/audio.rs @@ -31,7 +31,7 @@ use std::{ }; use strum::IntoEnumIterator; use strum_macros::EnumIter; -use tokio::sync::watch; +use tokio::sync::{watch}; const SAMPLE_RATE: u32 = 48000; @@ -132,11 +132,11 @@ impl Audio { let err_fn = |err| error!("An error occurred on the output audio stream: {}", err); - let user_volumes = Arc::new(Mutex::new(HashMap::new())); + let user_volumes = Arc::new(std::sync::Mutex::new(HashMap::new())); let (output_volume_sender, output_volume_receiver) = watch::channel::<f32>(output_volume); - let play_sounds = Arc::new(Mutex::new(VecDeque::new())); + let play_sounds = Arc::new(std::sync::Mutex::new(VecDeque::new())); - let client_streams = Arc::new(Mutex::new(HashMap::new())); + let client_streams = Arc::new(std::sync::Mutex::new(HashMap::new())); let output_stream = match output_supported_sample_format { SampleFormat::F32 => output_device.build_output_stream( &output_config, @@ -292,7 +292,7 @@ impl Audio { .collect(); } - pub fn decode_packet(&self, stream_type: VoiceStreamType, session_id: u32, payload: VoicePacketPayload) { + pub fn decode_packet_payload(&self, stream_type: VoiceStreamType, session_id: u32, payload: VoicePacketPayload) { match self.client_streams.lock().unwrap().entry((stream_type, session_id)) { Entry::Occupied(mut entry) => { entry |
