Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update windows-rs dependency #791

Merged
merged 3 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

- Update `windows` dependency to v0.48

# Version 0.15.2 (2023-03-30)

- webaudio: support multichannel output streams
Expand Down
13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ clap = { version = "4.0", features = ["derive"] }
ndk-glue = "0.7"

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.46.0", features = ["Win32_Media_Audio", "Win32_Foundation", "Win32_System_Com", "Win32_Devices_Properties", "Win32_Media_KernelStreaming", "Win32_System_Com_StructuredStorage", "Win32_System_Ole", "Win32_System_Threading", "Win32_Security", "Win32_System_SystemServices", "Win32_System_WindowsProgramming", "Win32_Media_Multimedia", "Win32_UI_Shell_PropertiesSystem"]}
windows = { version = "0.48.0", features = [
"Win32_Media_Audio",
"Win32_Foundation",
"Win32_Devices_Properties",
"Win32_Media_KernelStreaming",
"Win32_System_Com_StructuredStorage",
"Win32_System_Threading",
"Win32_Security",
"Win32_System_SystemServices",
"Win32_Media_Multimedia",
"Win32_UI_Shell_PropertiesSystem"
]}
asio-sys = { version = "0.2", path = "asio-sys", optional = true }
num-traits = { version = "0.2.6", optional = true }
parking_lot = "0.12"
Expand Down
9 changes: 4 additions & 5 deletions src/host/wasapi/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use windows::Win32::Foundation::WAIT_OBJECT_0;
use windows::Win32::Media::Audio;
use windows::Win32::System::SystemServices;
use windows::Win32::System::Threading;
use windows::Win32::System::WindowsProgramming;

pub struct Stream {
/// The high-priority audio processing thread calling callbacks.
Expand Down Expand Up @@ -160,7 +159,7 @@ impl Stream {
impl Drop for Stream {
#[inline]
fn drop(&mut self) {
if let Ok(_) = self.push_command(Command::Terminate) {
if self.push_command(Command::Terminate).is_ok() {
self.thread.take().unwrap().join().unwrap();
unsafe {
Foundation::CloseHandle(self.pending_scheduled_event);
Expand Down Expand Up @@ -238,9 +237,9 @@ fn wait_for_handle_signal(handles: &[Foundation::HANDLE]) -> Result<usize, Backe
let result = unsafe {
Threading::WaitForMultipleObjectsEx(
handles,
false, // Don't wait for all, just wait for the first
WindowsProgramming::INFINITE, // TODO: allow setting a timeout
false, // irrelevant parameter here
false, // Don't wait for all, just wait for the first
Threading::INFINITE, // TODO: allow setting a timeout
false, // irrelevant parameter here
)
};
if result == Foundation::WAIT_FAILED {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ impl StreamInstant {
fn from_nanos(nanos: i64) -> Self {
let secs = nanos / 1_000_000_000;
let subsec_nanos = nanos - secs * 1_000_000_000;
Self::new(secs as i64, subsec_nanos as u32)
Self::new(secs, subsec_nanos as u32)
}

#[allow(dead_code)]
Expand Down
Loading