From a218dc90e6471c48b58d73b4d2a7007488a2d450 Mon Sep 17 00:00:00 2001 From: Viktor Lazarev Date: Thu, 29 Aug 2019 08:34:41 +0200 Subject: [PATCH] Fixing compile errors --- src/host/wasapi/device.rs | 1 + src/host/wasapi/stream.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/host/wasapi/device.rs b/src/host/wasapi/device.rs index 1848bc9..fd9840a 100644 --- a/src/host/wasapi/device.rs +++ b/src/host/wasapi/device.rs @@ -96,6 +96,7 @@ pub struct Device { impl DeviceTrait for Device { type SupportedInputFormats = SupportedInputFormats; type SupportedOutputFormats = SupportedOutputFormats; + type Stream = Stream; fn name(&self) -> Result { Device::name(self) diff --git a/src/host/wasapi/stream.rs b/src/host/wasapi/stream.rs index c42421d..5ed67e7 100644 --- a/src/host/wasapi/stream.rs +++ b/src/host/wasapi/stream.rs @@ -239,7 +239,7 @@ fn run_inner(run_context: RunContext, data_callback: &mut dyn FnMut(StreamData), unsafe { 'stream_loop: loop { // Process queued commands. - match process_commands(run_context, error_callback) { + match process_commands(&mut run_context) { Ok(()) => (), Err(err) => { error_callback(err); @@ -251,7 +251,7 @@ fn run_inner(run_context: RunContext, data_callback: &mut dyn FnMut(StreamData), let handle_idx = match wait_for_handle_signal(&run_context.handles) { Ok(idx) => idx, Err(err) => { - error_callback(err); + error_callback(err.into()); break 'stream_loop; } }; @@ -312,7 +312,7 @@ fn run_inner(run_context: RunContext, data_callback: &mut dyn FnMut(StreamData), buffer: slice, }); let data = StreamData::Input { buffer: unknown_buffer }; - data_callback(stream.id.clone(), Ok(data)); + data_callback(data); // Release the buffer. let hresult = (*capture_client).ReleaseBuffer(frames_available); if let Err(err) = stream_error_from_hresult(hresult) { @@ -332,7 +332,7 @@ fn run_inner(run_context: RunContext, data_callback: &mut dyn FnMut(StreamData), AudioClientFlow::Render { render_client } => { // The number of frames available for writing. - let frames_available = match get_available_frames(stream) { + let frames_available = match get_available_frames(&stream) { Ok(0) => continue, // TODO: Can this happen? Ok(n) => n, Err(err) => { @@ -365,7 +365,7 @@ fn run_inner(run_context: RunContext, data_callback: &mut dyn FnMut(StreamData), buffer: slice }); let data = StreamData::Output { buffer: unknown_buffer }; - data_callback(stream.id.clone(), Ok(data)); + data_callback(data); let hresult = (*render_client) .ReleaseBuffer(frames_available as u32, 0); if let Err(err) = stream_error_from_hresult(hresult) {