mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 1622343 - Automatic code fixes for rustfmt warnings for now-unskipped files r=linter-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D66811 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
62ee54ce79
commit
68e140412a
@ -34,11 +34,11 @@ use rayon;
|
||||
use swgl_bindings::SwCompositor;
|
||||
use thread_profiler::register_thread_with_profiler;
|
||||
use webrender::{
|
||||
api::*, api::units::*, ApiRecordingReceiver, AsyncPropertySampler, AsyncScreenshotHandle,
|
||||
BinaryRecorder, Compositor, CompositorCapabilities, DebugFlags, Device,
|
||||
NativeSurfaceId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
|
||||
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, VertexUsageHint,
|
||||
WrShaders, set_profiler_hooks, CompositorConfig, NativeSurfaceInfo, NativeTileId, FastHashMap
|
||||
api::units::*, api::*, set_profiler_hooks, ApiRecordingReceiver, AsyncPropertySampler, AsyncScreenshotHandle,
|
||||
BinaryRecorder, Compositor, CompositorCapabilities, CompositorConfig, DebugFlags, Device, FastHashMap,
|
||||
NativeSurfaceId, NativeSurfaceInfo, NativeTileId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer,
|
||||
RendererOptions, RendererStats, SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod,
|
||||
VertexUsageHint, WrShaders,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
@ -757,7 +757,7 @@ impl<'a> From<(&'a (WrPipelineId, WrDocumentId), &'a WrEpoch)> for WrPipelineEpo
|
||||
#[repr(C)]
|
||||
pub struct WrPipelineIdAndEpoch {
|
||||
pipeline_id: WrPipelineId,
|
||||
epoch: WrEpoch
|
||||
epoch: WrEpoch,
|
||||
}
|
||||
|
||||
impl<'a> From<(&WrPipelineId, &WrEpoch)> for WrPipelineIdAndEpoch {
|
||||
@ -880,7 +880,12 @@ extern "C" {
|
||||
// These callbacks are invoked from the render backend thread (aka the APZ
|
||||
// sampler thread)
|
||||
fn apz_register_sampler(window_id: WrWindowId);
|
||||
fn apz_sample_transforms(window_id: WrWindowId, transaction: &mut Transaction, document_id: WrDocumentId, epochs_being_rendered: &WrPipelineIdEpochs);
|
||||
fn apz_sample_transforms(
|
||||
window_id: WrWindowId,
|
||||
transaction: &mut Transaction,
|
||||
document_id: WrDocumentId,
|
||||
epochs_being_rendered: &WrPipelineIdEpochs,
|
||||
);
|
||||
fn apz_deregister_sampler(window_id: WrWindowId);
|
||||
}
|
||||
|
||||
@ -965,14 +970,16 @@ impl AsyncPropertySampler for SamplerCallback {
|
||||
unsafe { apz_register_sampler(self.window_id) }
|
||||
}
|
||||
|
||||
fn sample(&self, document_id: DocumentId,
|
||||
epochs_being_rendered: &FastHashMap<PipelineId, Epoch>) -> Vec<FrameMsg> {
|
||||
fn sample(&self, document_id: DocumentId, epochs_being_rendered: &FastHashMap<PipelineId, Epoch>) -> Vec<FrameMsg> {
|
||||
let mut transaction = Transaction::new();
|
||||
unsafe { apz_sample_transforms(
|
||||
self.window_id, &mut transaction,
|
||||
document_id, &epochs_being_rendered.iter()
|
||||
.map(WrPipelineIdAndEpoch::from).collect()
|
||||
)};
|
||||
unsafe {
|
||||
apz_sample_transforms(
|
||||
self.window_id,
|
||||
&mut transaction,
|
||||
document_id,
|
||||
&epochs_being_rendered.iter().map(WrPipelineIdAndEpoch::from).collect(),
|
||||
)
|
||||
};
|
||||
// TODO: also omta_sample_transforms(...)
|
||||
transaction.get_frame_ops()
|
||||
}
|
||||
@ -995,9 +1002,7 @@ pub struct WrHitTester {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_api_request_hit_tester(
|
||||
dh: &DocumentHandle,
|
||||
) -> *mut WrHitTester {
|
||||
pub extern "C" fn wr_api_request_hit_tester(dh: &DocumentHandle) -> *mut WrHitTester {
|
||||
let hit_tester = dh.api.request_hit_tester(dh.document_id);
|
||||
Box::into_raw(Box::new(WrHitTester { ptr: hit_tester }))
|
||||
}
|
||||
@ -1008,20 +1013,15 @@ pub unsafe extern "C" fn wr_hit_tester_clone(hit_tester: *mut WrHitTester) -> *m
|
||||
Box::into_raw(Box::new(WrHitTester { ptr: new_ref }))
|
||||
}
|
||||
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_hit_tester_hit_test(
|
||||
hit_tester: &WrHitTester,
|
||||
point: WorldPoint,
|
||||
out_pipeline_id: &mut WrPipelineId,
|
||||
out_scroll_id: &mut u64,
|
||||
out_hit_info: &mut u16
|
||||
out_hit_info: &mut u16,
|
||||
) -> bool {
|
||||
let result = hit_tester.ptr.hit_test(
|
||||
None,
|
||||
point,
|
||||
HitTestFlags::empty()
|
||||
);
|
||||
let result = hit_tester.ptr.hit_test(None, point, HitTestFlags::empty());
|
||||
|
||||
for item in &result.items {
|
||||
// For now we should never be getting results back for which the tag is
|
||||
@ -1235,14 +1235,9 @@ extern "C" {
|
||||
clip_rect: DeviceIntRect,
|
||||
);
|
||||
fn wr_compositor_end_frame(compositor: *mut c_void);
|
||||
fn wr_compositor_enable_native_compositor(
|
||||
compositor: *mut c_void,
|
||||
enable: bool,
|
||||
);
|
||||
fn wr_compositor_enable_native_compositor(compositor: *mut c_void, enable: bool);
|
||||
fn wr_compositor_deinit(compositor: *mut c_void);
|
||||
fn wr_compositor_get_capabilities(
|
||||
compositor: *mut c_void,
|
||||
) -> CompositorCapabilities;
|
||||
fn wr_compositor_get_capabilities(compositor: *mut c_void) -> CompositorCapabilities;
|
||||
}
|
||||
|
||||
pub struct WrCompositor(*mut c_void);
|
||||
@ -1256,13 +1251,7 @@ impl Compositor for WrCompositor {
|
||||
is_opaque: bool,
|
||||
) {
|
||||
unsafe {
|
||||
wr_compositor_create_surface(
|
||||
self.0,
|
||||
id,
|
||||
virtual_offset,
|
||||
tile_size,
|
||||
is_opaque,
|
||||
);
|
||||
wr_compositor_create_surface(self.0, id, virtual_offset, tile_size, is_opaque);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1341,9 +1330,7 @@ impl Compositor for WrCompositor {
|
||||
}
|
||||
|
||||
fn get_capabilities(&self) -> CompositorCapabilities {
|
||||
unsafe {
|
||||
wr_compositor_get_capabilities(self.0)
|
||||
}
|
||||
unsafe { wr_compositor_get_capabilities(self.0) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1446,7 +1433,7 @@ pub extern "C" fn wr_window_new(
|
||||
};
|
||||
CompositorConfig::Native {
|
||||
max_update_rects: 1,
|
||||
compositor: Box::new(SwCompositor::new(sw_gl.unwrap(), Some(native_gl), wr_compositor))
|
||||
compositor: Box::new(SwCompositor::new(sw_gl.unwrap(), Some(native_gl), wr_compositor)),
|
||||
}
|
||||
} else if compositor != ptr::null_mut() {
|
||||
CompositorConfig::Native {
|
||||
@ -2615,10 +2602,7 @@ pub extern "C" fn wr_dp_push_iframe(
|
||||
}
|
||||
|
||||
// A helper fn to construct a PrimitiveFlags
|
||||
fn prim_flags(
|
||||
is_backface_visible: bool,
|
||||
prefer_compositor_surface: bool,
|
||||
) -> PrimitiveFlags {
|
||||
fn prim_flags(is_backface_visible: bool, prefer_compositor_surface: bool) -> PrimitiveFlags {
|
||||
let mut flags = PrimitiveFlags::empty();
|
||||
|
||||
if is_backface_visible {
|
||||
@ -2868,16 +2852,18 @@ pub extern "C" fn wr_dp_push_clear_rect_with_parent_clip(
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_image(state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_rendering: ImageRendering,
|
||||
key: WrImageKey,
|
||||
premultiplied_alpha: bool,
|
||||
color: ColorF,
|
||||
prefer_compositor_surface: bool) {
|
||||
pub extern "C" fn wr_dp_push_image(
|
||||
state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_rendering: ImageRendering,
|
||||
key: WrImageKey,
|
||||
premultiplied_alpha: bool,
|
||||
color: ColorF,
|
||||
prefer_compositor_surface: bool,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
|
||||
|
||||
let space_and_clip = parent.to_webrender(state.pipeline_id);
|
||||
@ -2950,19 +2936,21 @@ pub extern "C" fn wr_dp_push_repeating_image(
|
||||
|
||||
/// Push a 3 planar yuv image.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_key_0: WrImageKey,
|
||||
image_key_1: WrImageKey,
|
||||
image_key_2: WrImageKey,
|
||||
color_depth: WrColorDepth,
|
||||
color_space: WrYuvColorSpace,
|
||||
color_range: WrColorRange,
|
||||
image_rendering: ImageRendering,
|
||||
prefer_compositor_surface: bool) {
|
||||
pub extern "C" fn wr_dp_push_yuv_planar_image(
|
||||
state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_key_0: WrImageKey,
|
||||
image_key_1: WrImageKey,
|
||||
image_key_2: WrImageKey,
|
||||
color_depth: WrColorDepth,
|
||||
color_space: WrYuvColorSpace,
|
||||
color_range: WrColorRange,
|
||||
image_rendering: ImageRendering,
|
||||
prefer_compositor_surface: bool,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
|
||||
|
||||
let space_and_clip = parent.to_webrender(state.pipeline_id);
|
||||
@ -2989,18 +2977,20 @@ pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
|
||||
|
||||
/// Push a 2 planar NV12 image.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_key_0: WrImageKey,
|
||||
image_key_1: WrImageKey,
|
||||
color_depth: WrColorDepth,
|
||||
color_space: WrYuvColorSpace,
|
||||
color_range: WrColorRange,
|
||||
image_rendering: ImageRendering,
|
||||
prefer_compositor_surface: bool) {
|
||||
pub extern "C" fn wr_dp_push_yuv_NV12_image(
|
||||
state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_key_0: WrImageKey,
|
||||
image_key_1: WrImageKey,
|
||||
color_depth: WrColorDepth,
|
||||
color_space: WrYuvColorSpace,
|
||||
color_range: WrColorRange,
|
||||
image_rendering: ImageRendering,
|
||||
prefer_compositor_surface: bool,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
|
||||
|
||||
let space_and_clip = parent.to_webrender(state.pipeline_id);
|
||||
@ -3027,17 +3017,19 @@ pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
|
||||
|
||||
/// Push a yuv interleaved image.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_key_0: WrImageKey,
|
||||
color_depth: WrColorDepth,
|
||||
color_space: WrYuvColorSpace,
|
||||
color_range: WrColorRange,
|
||||
image_rendering: ImageRendering,
|
||||
prefer_compositor_surface: bool) {
|
||||
pub extern "C" fn wr_dp_push_yuv_interleaved_image(
|
||||
state: &mut WrState,
|
||||
bounds: LayoutRect,
|
||||
clip: LayoutRect,
|
||||
is_backface_visible: bool,
|
||||
parent: &WrSpaceAndClipChain,
|
||||
image_key_0: WrImageKey,
|
||||
color_depth: WrColorDepth,
|
||||
color_space: WrYuvColorSpace,
|
||||
color_range: WrColorRange,
|
||||
image_rendering: ImageRendering,
|
||||
prefer_compositor_surface: bool,
|
||||
) {
|
||||
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
|
||||
|
||||
let space_and_clip = parent.to_webrender(state.pipeline_id);
|
||||
|
@ -39,4 +39,3 @@ mod program_cache;
|
||||
pub mod bindings;
|
||||
pub mod moz2d_renderer;
|
||||
mod swgl_bindings;
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
*/
|
||||
|
||||
use bumpalo;
|
||||
use jsparagus::ast::types::Program;
|
||||
use jsparagus::ast::source_atom_set::SourceAtomSet;
|
||||
use jsparagus::ast::types::Program;
|
||||
use jsparagus::emitter::{emit, EmitError, EmitOptions, EmitResult};
|
||||
use jsparagus::parser::{parse_module, parse_script, ParseError, ParseOptions};
|
||||
use std::{mem, slice, str};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::{mem, slice, str};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct CVec<T> {
|
||||
@ -293,8 +293,11 @@ fn smoosh(text: &str, options: &SmooshCompileOptions) -> Result<EmitResult, Smoo
|
||||
|
||||
let mut emit_options = EmitOptions::new();
|
||||
emit_options.no_script_rval = options.no_script_rval;
|
||||
match emit(&mut Program::Script(parse_result.unbox()), &emit_options,
|
||||
atoms.replace(SourceAtomSet::new_uninitialized())) {
|
||||
match emit(
|
||||
&mut Program::Script(parse_result.unbox()),
|
||||
&emit_options,
|
||||
atoms.replace(SourceAtomSet::new_uninitialized()),
|
||||
) {
|
||||
Ok(result) => Ok(result),
|
||||
Err(EmitError::NotImplemented(message)) => {
|
||||
println!("Unimplemented: {}", message);
|
||||
|
@ -14,13 +14,10 @@ use audioipc::codec::LengthDelimitedCodec;
|
||||
use audioipc::frame::{framed, Framed};
|
||||
use audioipc::platformhandle_passing::{framed_with_platformhandles, FramedWithPlatformHandles};
|
||||
use audioipc::{core, rpc};
|
||||
use audioipc::{
|
||||
messages, messages::DeviceCollectionReq, messages::DeviceCollectionResp, ClientMessage,
|
||||
ServerMessage,
|
||||
};
|
||||
use audioipc::{messages, messages::DeviceCollectionReq, messages::DeviceCollectionResp, ClientMessage, ServerMessage};
|
||||
use cubeb_backend::{
|
||||
ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops, Result,
|
||||
Stream, StreamParams, StreamParamsRef,
|
||||
ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops, Result, Stream, StreamParams,
|
||||
StreamParamsRef,
|
||||
};
|
||||
use futures::Future;
|
||||
use futures_cpupool::{CpuFuture, CpuPool};
|
||||
@ -38,10 +35,8 @@ struct CubebClient;
|
||||
impl rpc::Client for CubebClient {
|
||||
type Request = ServerMessage;
|
||||
type Response = ClientMessage;
|
||||
type Transport = FramedWithPlatformHandles<
|
||||
audioipc::AsyncMessageStream,
|
||||
LengthDelimitedCodec<Self::Request, Self::Response>,
|
||||
>;
|
||||
type Transport =
|
||||
FramedWithPlatformHandles<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Request, Self::Response>>;
|
||||
}
|
||||
|
||||
pub const CLIENT_OPS: Ops = capi_new!(ClientContext, ClientStream);
|
||||
@ -141,16 +136,12 @@ impl rpc::Server for DeviceCollectionServer {
|
||||
type Request = DeviceCollectionReq;
|
||||
type Response = DeviceCollectionResp;
|
||||
type Future = CpuFuture<Self::Response, ()>;
|
||||
type Transport =
|
||||
Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
|
||||
type Transport = Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
|
||||
|
||||
fn process(&mut self, req: Self::Request) -> Self::Future {
|
||||
match req {
|
||||
DeviceCollectionReq::DeviceChange(device_type) => {
|
||||
trace!(
|
||||
"ctx_thread: DeviceChange Callback: device_type={}",
|
||||
device_type
|
||||
);
|
||||
trace!("ctx_thread: DeviceChange Callback: device_type={}", device_type);
|
||||
|
||||
let devtype = cubeb_backend::DeviceType::from_bits_truncate(device_type);
|
||||
|
||||
@ -166,14 +157,10 @@ impl rpc::Server for DeviceCollectionServer {
|
||||
self.cpu_pool.spawn_fn(move || {
|
||||
run_in_callback(|| {
|
||||
if devtype.contains(cubeb_backend::DeviceType::INPUT) {
|
||||
unsafe {
|
||||
input_cb.unwrap()(ptr::null_mut(), input_user_ptr as *mut c_void)
|
||||
}
|
||||
unsafe { input_cb.unwrap()(ptr::null_mut(), input_user_ptr as *mut c_void) }
|
||||
}
|
||||
if devtype.contains(cubeb_backend::DeviceType::OUTPUT) {
|
||||
unsafe {
|
||||
output_cb.unwrap()(ptr::null_mut(), output_user_ptr as *mut c_void)
|
||||
}
|
||||
unsafe { output_cb.unwrap()(ptr::null_mut(), output_user_ptr as *mut c_void) }
|
||||
}
|
||||
});
|
||||
|
||||
@ -206,8 +193,7 @@ impl ContextOps for ClientContext {
|
||||
let thread_create_callback = params.thread_create_callback;
|
||||
let thread_destroy_callback = params.thread_destroy_callback;
|
||||
|
||||
let server_stream =
|
||||
unsafe { audioipc::MessageStream::from_raw_fd(params.server_connection) };
|
||||
let server_stream = unsafe { audioipc::MessageStream::from_raw_fd(params.server_connection) };
|
||||
|
||||
let core = core::spawn_thread(
|
||||
"AudioIPC Client RPC",
|
||||
@ -231,8 +217,8 @@ impl ContextOps for ClientContext {
|
||||
// will return errors the caller expects to handle.
|
||||
let _ = send_recv!(rpc, ClientConnect(std::process::id()) => ClientConnected);
|
||||
|
||||
let backend_id = send_recv!(rpc, ContextGetBackendId => ContextBackendId())
|
||||
.unwrap_or_else(|_| "(remote error)".to_string());
|
||||
let backend_id =
|
||||
send_recv!(rpc, ContextGetBackendId => ContextBackendId()).unwrap_or_else(|_| "(remote error)".to_string());
|
||||
let backend_id = CString::new(backend_id).expect("backend_id query failed");
|
||||
|
||||
let cpu_pool = futures_cpupool::Builder::new()
|
||||
@ -277,11 +263,7 @@ impl ContextOps for ClientContext {
|
||||
send_recv!(self.rpc(), ContextGetPreferredSampleRate => ContextPreferredSampleRate())
|
||||
}
|
||||
|
||||
fn enumerate_devices(
|
||||
&mut self,
|
||||
devtype: DeviceType,
|
||||
collection: &DeviceCollectionRef,
|
||||
) -> Result<()> {
|
||||
fn enumerate_devices(&mut self, devtype: DeviceType, collection: &DeviceCollectionRef) -> Result<()> {
|
||||
assert_not_in_callback();
|
||||
let v: Vec<ffi::cubeb_device_info> = match send_recv!(self.rpc(),
|
||||
ContextGetDeviceEnumeration(devtype.bits()) =>
|
||||
@ -304,11 +286,7 @@ impl ContextOps for ClientContext {
|
||||
assert_not_in_callback();
|
||||
unsafe {
|
||||
let coll = &mut *collection.as_ptr();
|
||||
let mut devices = Vec::from_raw_parts(
|
||||
coll.device as *mut ffi::cubeb_device_info,
|
||||
coll.count,
|
||||
coll.count,
|
||||
);
|
||||
let mut devices = Vec::from_raw_parts(coll.device as *mut ffi::cubeb_device_info, coll.count, coll.count);
|
||||
for dev in &mut devices {
|
||||
if !dev.device_id.is_null() {
|
||||
let _ = CString::from_raw(dev.device_id as *mut _);
|
||||
@ -383,8 +361,7 @@ impl ContextOps for ClientContext {
|
||||
ContextSetupDeviceCollectionCallback =>
|
||||
ContextSetupDeviceCollectionCallback())?;
|
||||
|
||||
let stream =
|
||||
unsafe { audioipc::MessageStream::from_raw_fd(fds.platform_handles[0].into_raw()) };
|
||||
let stream = unsafe { audioipc::MessageStream::from_raw_fd(fds.platform_handles[0].into_raw()) };
|
||||
|
||||
// TODO: The lowest comms layer expects exactly 3 PlatformHandles, but we only
|
||||
// need one here. Drop the dummy handles the other side sent us to discard.
|
||||
|
@ -62,8 +62,7 @@ impl rpc::Server for CallbackServer {
|
||||
type Request = CallbackReq;
|
||||
type Response = CallbackResp;
|
||||
type Future = CpuFuture<Self::Response, ()>;
|
||||
type Transport =
|
||||
Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
|
||||
type Transport = Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Response, Self::Request>>;
|
||||
|
||||
fn process(&mut self, req: Self::Request) -> Self::Future {
|
||||
match req {
|
||||
@ -94,10 +93,7 @@ impl rpc::Server for CallbackServer {
|
||||
self.cpu_pool.spawn_fn(move || {
|
||||
// TODO: This is proof-of-concept. Make it better.
|
||||
let input_ptr: *const u8 = match input_shm {
|
||||
Some(shm) => shm
|
||||
.get_slice(nframes as usize * input_frame_size)
|
||||
.unwrap()
|
||||
.as_ptr(),
|
||||
Some(shm) => shm.get_slice(nframes as usize * input_frame_size).unwrap().as_ptr(),
|
||||
None => ptr::null(),
|
||||
};
|
||||
let output_ptr: *mut u8 = match output_shm {
|
||||
@ -173,13 +169,9 @@ impl<'ctx> ClientStream<'ctx> {
|
||||
let rpc = ctx.rpc();
|
||||
let data = send_recv!(rpc, StreamInit(init_params) => StreamCreated())?;
|
||||
|
||||
debug!(
|
||||
"token = {}, handles = {:?}",
|
||||
data.token, data.platform_handles
|
||||
);
|
||||
debug!("token = {}, handles = {:?}", data.token, data.platform_handles);
|
||||
|
||||
let stream =
|
||||
unsafe { audioipc::MessageStream::from_raw_fd(data.platform_handles[0].into_raw()) };
|
||||
let stream = unsafe { audioipc::MessageStream::from_raw_fd(data.platform_handles[0].into_raw()) };
|
||||
|
||||
let input_file = unsafe { data.platform_handles[1].into_file() };
|
||||
let input_shm = if has_input {
|
||||
|
Loading…
x
Reference in New Issue
Block a user