Skip to content

Commit 66ed6be

Browse files
committed
fixed merge conflicts
1 parent 8215207 commit 66ed6be

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ndk-glue = "0.7"
2727

2828
[target.'cfg(target_os = "windows")'.dependencies]
2929
windows = { version = "0.54.0", features = [
30+
"implement",
3031
"Win32_Media_Audio",
3132
"Win32_Foundation",
3233
"Win32_Devices_Properties",

src/host/wasapi/device.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ use std::mem;
1111
use std::os::windows::ffi::OsStringExt;
1212
use std::ptr;
1313
use std::slice;
14-
use std::sync::OnceLock;
1514
use std::sync::mpsc::Sender;
15+
use std::sync::OnceLock;
1616
use std::sync::{Arc, Mutex, MutexGuard};
1717
use std::time::Duration;
1818

1919
use super::com;
2020
use super::{windows_err_to_cpal_err, windows_err_to_cpal_err_message};
21-
use windows::core::Interface;
2221
use windows::core::GUID;
22+
use windows::core::{implement, IUnknown, Interface, HRESULT, PCWSTR, PROPVARIANT};
2323
use windows::Win32::Devices::Properties;
2424
use windows::Win32::Foundation;
2525
use windows::Win32::Media::Audio::IAudioRenderClient;
2626
use windows::Win32::Media::{Audio, KernelStreaming, Multimedia};
2727
use windows::Win32::System::Com;
28-
use windows::Win32::System::Com::{StructuredStorage, STGM_READ};
28+
use windows::Win32::System::Com::{CoTaskMemFree, StringFromIID, StructuredStorage, STGM_READ};
2929
use windows::Win32::System::Threading;
3030
use windows::Win32::System::Variant::VT_LPWSTR;
3131

@@ -284,11 +284,11 @@ unsafe fn format_from_waveformatex_ptr(
284284
}
285285

286286
#[implement(Audio::IActivateAudioInterfaceCompletionHandler)]
287-
struct CompletionHandler(Sender<WinResult<IUnknown>>);
287+
struct CompletionHandler(Sender<windows::core::Result<IUnknown>>);
288288

289289
fn retrieve_result(
290290
operation: &Audio::IActivateAudioInterfaceAsyncOperation,
291-
) -> WinResult<IUnknown> {
291+
) -> windows::core::Result<IUnknown> {
292292
let mut result = HRESULT::default();
293293
let mut interface: Option<IUnknown> = None;
294294
unsafe {
@@ -302,7 +302,7 @@ impl Audio::IActivateAudioInterfaceCompletionHandler_Impl for CompletionHandler
302302
fn ActivateCompleted(
303303
&self,
304304
operation: Option<&Audio::IActivateAudioInterfaceAsyncOperation>,
305-
) -> WinResult<()> {
305+
) -> windows::core::Result<()> {
306306
let result = retrieve_result(operation.unwrap());
307307
let _ = self.0.send(result);
308308
Ok(())
@@ -313,10 +313,10 @@ impl Audio::IActivateAudioInterfaceCompletionHandler_Impl for CompletionHandler
313313
unsafe fn ActivateAudioInterfaceSync<P0, T>(
314314
deviceinterfacepath: P0,
315315
activationparams: Option<*const PROPVARIANT>,
316-
) -> WinResult<T>
316+
) -> windows::core::Result<T>
317317
where
318318
P0: windows::core::IntoParam<PCWSTR>,
319-
T: Interface + ComInterface,
319+
T: Interface,
320320
{
321321
let (sender, receiver) = std::sync::mpsc::channel();
322322
let completion: Audio::IActivateAudioInterfaceCompletionHandler =
@@ -357,16 +357,16 @@ impl Device {
357357

358358
let prop_variant = &property_value.as_raw().Anonymous.Anonymous;
359359

360-
// Read the friendly-name from the union data field, expecting a *const u16.
361-
if prop_variant.vt != VT_LPWSTR.0 {
362-
let description = format!(
363-
"property store produced invalid data: {:?}",
364-
prop_variant.vt
365-
);
366-
let err = BackendSpecificError { description };
367-
return Err(err.into());
368-
}
369-
let ptr_utf16 = *(&prop_variant.Anonymous as *const _ as *const *const u16);
360+
// Read the friendly-name from the union data field, expecting a *const u16.
361+
if prop_variant.vt != VT_LPWSTR.0 {
362+
let description = format!(
363+
"property store produced invalid data: {:?}",
364+
prop_variant.vt
365+
);
366+
let err = BackendSpecificError { description };
367+
return Err(err.into());
368+
}
369+
let ptr_utf16 = *(&prop_variant.Anonymous as *const _ as *const *const u16);
370370

371371
// Find the length of the friendly name.
372372
let mut len = 0;
@@ -1029,7 +1029,6 @@ impl Iterator for Devices {
10291029
// }
10301030
//}
10311031

1032-
10331032
pub fn default_input_device() -> Option<Device> {
10341033
//default_device(Audio::eCapture)
10351034
Some(Device::default_input())

0 commit comments

Comments
 (0)