Bug 1470041 - Update audioipc to 3d716fe8. r=kamidphish
authorMatthew Gregan <kinetik@flim.org>
Sun, 26 Aug 2018 20:33:19 +1200
changeset 488539 bdcf4ee0cea72947c57cff3227f0674034e1d879
parent 488538 251cbf54ce917e617da41f22df75d2bf63d3fa24
child 488540 5c7e7dae1b81b85206a155914b59e82bf99bb2c6
push id9730
push usercsabou@mozilla.com
push dateMon, 27 Aug 2018 16:38:33 +0000
treeherdermozilla-beta@4084eef2130f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish
bugs1470041
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1470041 - Update audioipc to 3d716fe8. r=kamidphish
media/audioipc/README_MOZILLA
media/audioipc/audioipc/src/cmsg.rs
media/audioipc/client/src/stream.rs
--- a/media/audioipc/README_MOZILLA
+++ b/media/audioipc/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the audioipc-2
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The audioipc-2 git repository is: https://github.com/djg/audioipc-2.git
 
-The git commit ID used was 219a811b62b83bd6e4cb54ae6aebc56bbb43203c (2018-04-18 13:57:59 +1200)
+The git commit ID used was 3d716fe897ccb3ea43a2af0c794ea57c433400d7 (2018-07-30 08:51:04 +1200)
--- a/media/audioipc/audioipc/src/cmsg.rs
+++ b/media/audioipc/audioipc/src/cmsg.rs
@@ -103,16 +103,18 @@ impl ControlMsgBuilder {
         self.result = self.result.and_then(align_buf).and_then(|mut cmsg| {
             let cmsg_len = len(msg.len());
             if cmsg.remaining_mut() < cmsg_len {
                 return Err(Error::NoSpace);
             }
 
             let cmsghdr = cmsghdr {
                 cmsg_len: cmsg_len as _,
+                #[cfg(target_env = "musl")]
+                __pad1: 0,
                 cmsg_level: level,
                 cmsg_type: kind,
             };
 
             let cmsghdr = unsafe {
                 slice::from_raw_parts(&cmsghdr as *const _ as *const _, mem::size_of::<cmsghdr>())
             };
             cmsg.put_slice(cmsghdr);
--- a/media/audioipc/client/src/stream.rs
+++ b/media/audioipc/client/src/stream.rs
@@ -48,18 +48,18 @@ pub struct ClientStream<'ctx> {
     // This must be a reference to Context for cubeb, cubeb accesses
     // stream methods via stream->context->ops
     context: &'ctx ClientContext,
     user_ptr: *mut c_void,
     token: usize,
 }
 
 struct CallbackServer {
-    input_shm: SharedMemSlice,
-    output_shm: SharedMemMutSlice,
+    input_shm: Option<SharedMemSlice>,
+    output_shm: Option<SharedMemMutSlice>,
     data_cb: ffi::cubeb_data_callback,
     state_cb: ffi::cubeb_state_callback,
     user_ptr: usize,
     cpu_pool: CpuPool,
 }
 
 impl rpc::Server for CallbackServer {
     type Request = CallbackReq;
@@ -72,31 +72,43 @@ impl rpc::Server for CallbackServer {
             CallbackReq::Data(nframes, frame_size) => {
                 trace!(
                     "stream_thread: Data Callback: nframes={} frame_size={}",
                     nframes,
                     frame_size
                 );
 
                 // Clone values that need to be moved into the cpu pool thread.
-                let input_shm = unsafe { self.input_shm.clone_view() };
-                let mut output_shm = unsafe { self.output_shm.clone_view() };
+                let input_shm = match self.input_shm {
+                    Some(ref shm) => unsafe { Some(shm.clone_view()) },
+                    None => None,
+                };
+                let mut output_shm = match self.output_shm {
+                    Some(ref shm) => unsafe { Some(shm.clone_view()) },
+                    None => None,
+                };
                 let user_ptr = self.user_ptr;
                 let cb = self.data_cb.unwrap();
 
                 self.cpu_pool.spawn_fn(move || {
                     // TODO: This is proof-of-concept. Make it better.
-                    let input_ptr: *const u8 = input_shm
-                        .get_slice(nframes as usize * frame_size)
-                        .unwrap()
-                        .as_ptr();
-                    let output_ptr: *mut u8 = output_shm
-                        .get_mut_slice(nframes as usize * frame_size)
-                        .unwrap()
-                        .as_mut_ptr();
+                    let input_ptr: *const u8 = match input_shm {
+                        Some(shm) => shm
+                            .get_slice(nframes as usize * frame_size)
+                            .unwrap()
+                            .as_ptr(),
+                        None => ptr::null()
+                    };
+                    let output_ptr: *mut u8 = match output_shm {
+                        Some(ref mut shm) => shm
+                            .get_mut_slice(nframes as usize * frame_size)
+                            .unwrap()
+                            .as_mut_ptr(),
+                        None => ptr::null_mut()
+                    };
 
                     set_in_callback(true);
                     let nframes = unsafe {
                         cb(
                             ptr::null_mut(),
                             user_ptr as *mut c_void,
                             input_ptr as *const _,
                             output_ptr as *mut _,
@@ -131,31 +143,42 @@ impl<'ctx> ClientStream<'ctx> {
         ctx: &'ctx ClientContext,
         init_params: messages::StreamInitParams,
         data_callback: ffi::cubeb_data_callback,
         state_callback: ffi::cubeb_state_callback,
         user_ptr: *mut c_void,
     ) -> Result<Stream> {
         assert_not_in_callback();
 
+        let has_input = init_params.input_stream_params.is_some();
+        let has_output = init_params.output_stream_params.is_some();
+
         let rpc = ctx.rpc();
         let data = try!(send_recv!(rpc, StreamInit(init_params) => StreamCreated()));
 
         debug!("token = {}, fds = {:?}", data.token, data.fds);
 
         let stm = data.fds[0];
         let stream = unsafe { net::UnixStream::from_raw_fd(stm) };
 
         let input = data.fds[1];
         let input_file = unsafe { File::from_raw_fd(input) };
-        let input_shm = SharedMemSlice::from(&input_file, SHM_AREA_SIZE).unwrap();
+        let input_shm = if has_input {
+            Some(SharedMemSlice::from(&input_file, SHM_AREA_SIZE).unwrap())
+        } else {
+            None
+        };
 
         let output = data.fds[2];
         let output_file = unsafe { File::from_raw_fd(output) };
-        let output_shm = SharedMemMutSlice::from(&output_file, SHM_AREA_SIZE).unwrap();
+        let output_shm = if has_output {
+            Some(SharedMemMutSlice::from(&output_file, SHM_AREA_SIZE).unwrap())
+        } else {
+            None
+        };
 
         let user_data = user_ptr as usize;
 
         let cpu_pool = ctx.cpu_pool();
 
         let server = CallbackServer {
             input_shm: input_shm,
             output_shm: output_shm,