Bug 1428952 - P1: Update cubeb-pulse-rs to version 864332f. r?kinetik draft
authorDan Glastonbury <dan.glastonbury@gmail.com>
Mon, 06 Nov 2017 14:30:29 +1000
changeset 717496 699ea3bc33c5e292d89f1197569ebef5befa5bf6
parent 717422 05fed903f40f05fd923ba2137696ecc1fa0bafe6
child 717497 4e47f426e0959323df33b27725b7518a8609d6cf
push id94702
push userbmo:dglastonbury@mozilla.com
push dateTue, 09 Jan 2018 04:07:24 +0000
reviewerskinetik
bugs1428952
milestone59.0a1
Bug 1428952 - P1: Update cubeb-pulse-rs to version 864332f. r?kinetik MozReview-Commit-ID: 3fLcQer7fr3
media/libcubeb/cubeb-pulse-rs/README_MOZILLA
media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/log.rs
media/libcubeb/cubeb-pulse-rs/src/backend/context.rs
media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs
media/libcubeb/cubeb-pulse-rs/src/capi.rs
--- a/media/libcubeb/cubeb-pulse-rs/README_MOZILLA
+++ b/media/libcubeb/cubeb-pulse-rs/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the cubeb-pulse-rs
 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 cubeb-pulse-rs git repository is: https://github.com/djg/cubeb-pulse-rs.git
 
-The git commit ID used was 2e22e5359000f11c47346c54b34182bb350fe9d3 (2017-09-26 15:30:09 +1300)
+The git commit ID used was 864332fde124761da15c444e58889faf598a219f (2017-10-30 10:55:41 +1300)
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/log.rs
+++ b/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/log.rs
@@ -13,18 +13,18 @@ macro_rules! log_internal {
             }
         }
     };
     ($level: expr, $fmt: expr, $($arg:tt)+) => {
         #[allow(unused_unsafe)]
         unsafe {
             if $level <= $crate::g_cubeb_log_level {
                 if let Some(log_callback) = $crate::g_cubeb_log_callback {
-                    let cstr = ::std::ffi::CString::new(concat!("%s:%d: ", $fmt, "\n")).unwrap();
-                    log_callback(cstr.as_ptr(), file!(), line!(), $($arg)+);
+                    let cstr = ::std::ffi::CString::new(format!(concat!("%s:%d: ", $fmt, "\n"), $($arg)+)).unwrap();
+                    log_callback(cstr.as_ptr(), file!(), line!());
                 }
             }
         }
     }
 }
 
 #[macro_export]
 macro_rules! logv {
--- a/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs
+++ b/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs
@@ -116,17 +116,17 @@ impl Context {
                         version_2_0_0: false,
                         devids: RefCell::new(Intern::new()),
                     }))
     }
 
     pub fn new(name: *const c_char) -> Result<Box<Self>> {
         fn server_info_cb(context: &pulse::Context, info: &pulse::ServerInfo, u: *mut c_void) {
             fn sink_info_cb(_: &pulse::Context, i: *const pulse::SinkInfo, eol: i32, u: *mut c_void) {
-                let mut ctx = unsafe { &mut *(u as *mut Context) };
+                let ctx = unsafe { &mut *(u as *mut Context) };
                 if eol == 0 {
                     let info = unsafe { &*i };
                     let flags = pulse::SinkFlags::from_bits_truncate(info.flags);
                     ctx.default_sink_info = Some(DefaultInfo {
                                                      sample_spec: info.sample_spec,
                                                      channel_map: info.channel_map,
                                                      flags: flags,
                                                  });
@@ -226,17 +226,17 @@ impl Context {
         match self.default_sink_info {
             Some(ref info) => Ok(channel_map_to_layout(&info.channel_map)),
             None => Err(cubeb::ERROR),
         }
     }
 
     pub fn enumerate_devices(&self, devtype: cubeb::DeviceType) -> Result<cubeb::DeviceCollection> {
         fn add_output_device(_: &pulse::Context, i: *const pulse::SinkInfo, eol: i32, user_data: *mut c_void) {
-            let mut list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
+            let list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
             let ctx = &(*list_data.context);
 
             if eol != 0 {
                 ctx.mainloop.signal();
                 return;
             }
 
             debug_assert!(!i.is_null());
@@ -282,17 +282,17 @@ impl Context {
                 default_rate: info.sample_spec.rate,
                 latency_lo: 0,
                 latency_hi: 0,
             };
             list_data.devinfo.push(devinfo);
         }
 
         fn add_input_device(_: &pulse::Context, i: *const pulse::SourceInfo, eol: i32, user_data: *mut c_void) {
-            let mut list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
+            let list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
             let ctx = &(*list_data.context);
 
             if eol != 0 {
                 ctx.mainloop.signal();
                 return;
             }
 
             debug_assert!(!user_data.is_null());
@@ -418,17 +418,17 @@ impl Context {
     }
 
     pub fn register_device_collection_changed(&mut self,
                                               devtype: cubeb::DeviceType,
                                               cb: cubeb::DeviceCollectionChangedCallback,
                                               user_ptr: *mut c_void)
                                               -> i32 {
         fn update_collection(_: &pulse::Context, event: pulse::SubscriptionEvent, index: u32, user_data: *mut c_void) {
-            let mut ctx = unsafe { &mut *(user_data as *mut Context) };
+            let ctx = unsafe { &mut *(user_data as *mut Context) };
 
             let (f, t) = (event.event_facility(), event.event_type());
             match f {
                 pulse::SubscriptionEventFacility::Source |
                 pulse::SubscriptionEventFacility::Sink => {
                     match t {
                         pulse::SubscriptionEventType::Remove |
                         pulse::SubscriptionEventType::New => {
@@ -495,17 +495,17 @@ impl Context {
             self.mainloop.unlock();
         }
 
         cubeb::OK
     }
 
     pub fn context_init(&mut self) -> i32 {
         fn error_state(c: &pulse::Context, u: *mut c_void) {
-            let mut ctx = unsafe { &mut *(u as *mut Context) };
+            let ctx = unsafe { &mut *(u as *mut Context) };
             if !c.get_state().is_good() {
                 ctx.error = true;
             }
             ctx.mainloop.signal();
         }
 
         if self.context.is_some() {
             debug_assert!(self.error);
--- a/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs
+++ b/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs
@@ -118,17 +118,17 @@ impl<'ctx> Stream<'ctx> {
                     if unsafe { s.peek(buffer, size).is_err() } {
                         return -1;
                     }
                 }
                 readable_size
             }
 
             logv!("Input callback buffer size {}", nbytes);
-            let mut stm = unsafe { &mut *(u as *mut Stream) };
+            let stm = unsafe { &mut *(u as *mut Stream) };
             if stm.shutdown {
                 return;
             }
 
             let mut read_data: *const c_void = ptr::null();
             let mut read_size: usize = 0;
             while read_from_input(s, &mut read_data, &mut read_size) > 0 {
                 /* read_data can be NULL in case of a hole. */
@@ -167,17 +167,17 @@ impl<'ctx> Stream<'ctx> {
                 if stm.shutdown {
                     return;
                 }
             }
         }
 
         fn write_data(_: &pulse::Stream, nbytes: usize, u: *mut c_void) {
             logv!("Output callback to be written buffer size {}", nbytes);
-            let mut stm = unsafe { &mut *(u as *mut Stream) };
+            let stm = unsafe { &mut *(u as *mut Stream) };
             if stm.shutdown || stm.state != cubeb::STATE_STARTED {
                 return;
             }
 
             if stm.input_stream.is_none() {
                 // Output/playback only operation.
                 // Write directly to output
                 debug_assert!(stm.output_stream.is_some());
@@ -336,17 +336,17 @@ impl<'ctx> Stream<'ctx> {
                 _ => {},
             }
         }
         self.context.mainloop.unlock();
     }
 
     pub fn start(&mut self) -> i32 {
         fn output_preroll(_: &pulse::MainloopApi, u: *mut c_void) {
-            let mut stm = unsafe { &mut *(u as *mut Stream) };
+            let stm = unsafe { &mut *(u as *mut Stream) };
             if !stm.shutdown {
                 let size = stm.output_stream
                     .as_ref()
                     .map_or(0, |s| s.writable_size().unwrap_or(0));
                 stm.trigger_user_callback(ptr::null_mut(), size);
             }
         }
 
@@ -474,17 +474,17 @@ impl<'ctx> Stream<'ctx> {
     pub fn set_panning(&mut self, panning: f32) -> i32 {
         #[repr(C)]
         struct SinkInputInfoResult<'a> {
             pub cvol: pulse::CVolume,
             pub mainloop: &'a pulse::ThreadedMainloop,
         }
 
         fn get_input_volume(_: &pulse::Context, info: *const pulse::SinkInputInfo, eol: i32, u: *mut c_void) {
-            let mut r = unsafe { &mut *(u as *mut SinkInputInfoResult) };
+            let r = unsafe { &mut *(u as *mut SinkInputInfoResult) };
             if eol == 0 {
                 let info = unsafe { *info };
                 r.cvol = info.volume;
             }
             r.mainloop.signal();
         }
 
         match self.output_stream {
@@ -686,17 +686,17 @@ impl<'ctx> Stream<'ctx> {
             }
         }
 
         true
     }
 
     fn trigger_user_callback(&mut self, input_data: *const c_void, nbytes: usize) {
         fn drained_cb(a: &pulse::MainloopApi, e: *mut pa_time_event, _tv: &pulse::TimeVal, u: *mut c_void) {
-            let mut stm = unsafe { &mut *(u as *mut Stream) };
+            let stm = unsafe { &mut *(u as *mut Stream) };
             debug_assert_eq!(stm.drain_timer, e);
             stm.state_change_callback(cubeb::STATE_DRAINED);
             /* there's no pa_rttime_free, so use this instead. */
             a.time_free(stm.drain_timer);
             stm.drain_timer = ptr::null_mut();
             stm.context.mainloop.signal();
         }
 
--- a/media/libcubeb/cubeb-pulse-rs/src/capi.rs
+++ b/media/libcubeb/cubeb-pulse-rs/src/capi.rs
@@ -114,17 +114,17 @@ unsafe extern "C" fn capi_stream_init(c:
                                       data_callback: cubeb::DataCallback,
                                       state_callback: cubeb::StateCallback,
                                       user_ptr: *mut c_void)
                                       -> i32 {
     fn try_stream_params_from(sp: *mut cubeb::StreamParams) -> Option<cubeb::StreamParams> {
         if sp.is_null() { None } else { Some(unsafe { *sp }) }
     }
 
-    let mut ctx = &mut *(c as *mut backend::Context);
+    let ctx = &mut *(c as *mut backend::Context);
     let stream_name = CStr::from_ptr(stream_name);
 
     match ctx.new_stream(stream_name,
                          input_device,
                          try_stream_params_from(input_stream_params),
                          output_device,
                          try_stream_params_from(output_stream_params),
                          latency_frames,
@@ -139,23 +139,23 @@ unsafe extern "C" fn capi_stream_init(c:
     }
 }
 
 unsafe extern "C" fn capi_stream_destroy(s: *mut cubeb::Stream) {
     let _ = Box::from_raw(s as *mut backend::Stream);
 }
 
 unsafe extern "C" fn capi_stream_start(s: *mut cubeb::Stream) -> i32 {
-    let mut stm = &mut *(s as *mut backend::Stream);
+    let stm = &mut *(s as *mut backend::Stream);
 
     stm.start()
 }
 
 unsafe extern "C" fn capi_stream_stop(s: *mut cubeb::Stream) -> i32 {
-    let mut stm = &mut *(s as *mut backend::Stream);
+    let stm = &mut *(s as *mut backend::Stream);
 
     stm.stop()
 }
 
 unsafe extern "C" fn capi_stream_get_position(s: *mut cubeb::Stream, position: *mut u64) -> i32 {
     let stm = &*(s as *mut backend::Stream);
 
     match stm.position() {
@@ -209,17 +209,17 @@ unsafe extern "C" fn capi_stream_device_
 }
 
 unsafe extern "C" fn capi_register_device_collection_changed(c: *mut cubeb::Context,
                                                              devtype: cubeb::DeviceType,
                                                              collection_changed_callback:
                                                              cubeb::DeviceCollectionChangedCallback,
                                                       user_ptr: *mut c_void) -> i32
 {
-    let mut ctx = &mut *(c as *mut backend::Context);
+    let ctx = &mut *(c as *mut backend::Context);
     ctx.register_device_collection_changed(devtype, collection_changed_callback, user_ptr as _)
 }
 
 pub const PULSE_OPS: cubeb::Ops = cubeb::Ops {
     init: Some(capi_init),
     get_backend_id: Some(capi_get_backend_id),
     get_max_channel_count: Some(capi_get_max_channel_count),
     get_min_latency: Some(capi_get_min_latency),