Skip to content

Commit

Permalink
Fixes panic on no output stream (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHusky authored Apr 8, 2021
1 parent 5874c7a commit cc804df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kissmp-bridge/src/voice_chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,14 @@ pub fn encode_and_send_samples(
pub fn run_vc_playback(receiver: std::sync::mpsc::Receiver<VoiceChatPlaybackEvent>) {
use rodio::Source;
std::thread::spawn(move || {
let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap();
let (_stream, stream_handle) = match rodio::OutputStream::try_default() {
Ok(a) => a,
_ => {
println!("Could not find a output audio stream for voice chat.");
println!("Check your OS's settings and verify you have a device available.");
return
},
};
let mut sinks = std::collections::HashMap::new();
let mut decoder =
audiopus::coder::Decoder::new(audiopus::SampleRate::Hz16000, audiopus::Channels::Mono)
Expand Down

0 comments on commit cc804df

Please sign in to comment.