Skip to content

Commit

Permalink
Update windows and alsa dependencies (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
a1phyr authored Dec 4, 2023
1 parent efa0c7a commit 76b0406
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ clap = { version = "4.0", features = ["derive"] }
ndk-glue = "0.7"

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.48.0", features = [
windows = { version = "0.52.0", features = [
"Win32_Media_Audio",
"Win32_Foundation",
"Win32_Devices_Properties",
Expand All @@ -34,6 +34,7 @@ windows = { version = "0.48.0", features = [
"Win32_System_Threading",
"Win32_Security",
"Win32_System_SystemServices",
"Win32_System_Variant",
"Win32_Media_Multimedia",
"Win32_UI_Shell_PropertiesSystem"
]}
Expand All @@ -43,7 +44,7 @@ parking_lot = "0.12"
once_cell = "1.12"

[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd"))'.dependencies]
alsa = "0.7"
alsa = "0.8"
libc = "0.2"
parking_lot = "0.12"
jack = { version = "0.11", optional = true }
Expand Down
3 changes: 2 additions & 1 deletion src/host/wasapi/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ use windows::Win32::Foundation;
use windows::Win32::Media::Audio::IAudioRenderClient;
use windows::Win32::Media::{Audio, KernelStreaming, Multimedia};
use windows::Win32::System::Com;
use windows::Win32::System::Com::{StructuredStorage, STGM_READ, VT_LPWSTR};
use windows::Win32::System::Com::{StructuredStorage, STGM_READ};
use windows::Win32::System::Threading;
use windows::Win32::System::Variant::VT_LPWSTR;

use super::stream::{AudioClientFlow, Stream, StreamInner};
use crate::{traits::DeviceTrait, BuildStreamError, StreamError};
Expand Down
14 changes: 8 additions & 6 deletions src/host/wasapi/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ impl Stream {
fn push_command(&self, command: Command) -> Result<(), SendError<Command>> {
self.commands.send(command)?;
unsafe {
let result = Threading::SetEvent(self.pending_scheduled_event);
assert_ne!(result, false);
Threading::SetEvent(self.pending_scheduled_event).unwrap();
}
Ok(())
}
Expand All @@ -162,7 +161,7 @@ impl Drop for Stream {
if self.push_command(Command::Terminate).is_ok() {
self.thread.take().unwrap().join().unwrap();
unsafe {
Foundation::CloseHandle(self.pending_scheduled_event);
let _ = Foundation::CloseHandle(self.pending_scheduled_event);
}
}
}
Expand All @@ -185,7 +184,7 @@ impl Drop for StreamInner {
#[inline]
fn drop(&mut self) {
unsafe {
Foundation::CloseHandle(self.event);
let _ = Foundation::CloseHandle(self.event);
}
}
}
Expand Down Expand Up @@ -243,8 +242,11 @@ fn wait_for_handle_signal(handles: &[Foundation::HANDLE]) -> Result<usize, Backe
)
};
if result == Foundation::WAIT_FAILED {
let err = unsafe { Foundation::GetLastError() };
let description = format!("`WaitForMultipleObjectsEx failed: {}", err.0);
let err = match unsafe { Foundation::GetLastError() } {
Ok(()) => windows::core::Error::OK,
Err(err) => err,
};
let description = format!("`WaitForMultipleObjectsEx failed: {}", err);
let err = BackendSpecificError { description };
return Err(err);
}
Expand Down

0 comments on commit 76b0406

Please sign in to comment.