Bug 1399978 - Update cubeb-pulse-rs to git commit 2e22e53. r=kinetik

MozReview-Commit-ID: INksO0nbT1F

--HG--
extra : rebase_source : ea7936f95c44972478878cb54b1e2a83c4fbc4fe
This commit is contained in:
Dan Glastonbury 2017-09-25 15:23:30 +10:00
Родитель 8f68d9bde5
Коммит e0b3ce467e
3 изменённых файлов: 24 добавлений и 15 удалений

Просмотреть файл

@ -5,4 +5,4 @@ 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 a386d91d7f34e6d3a949ee4fa44e848e29634587 (2017-09-05 13:34:32 +1000)
The git commit ID used was 2e22e5359000f11c47346c54b34182bb350fe9d3 (2017-09-26 15:30:09 +1300)

Просмотреть файл

@ -211,8 +211,10 @@ impl Context {
ffi::pa_context_get_server_info(self.raw_mut(), Some(wrapped::<CB>), userdata))
}
pub fn get_sink_info_by_name<CB>(&self, name: &CStr, _: CB, userdata: *mut c_void) -> Result<Operation>
where CB: Fn(&Context, *const SinkInfo, i32, *mut c_void)
pub fn get_sink_info_by_name<'str, CS, CB>(&self, name: CS, _: CB, userdata: *mut c_void) -> Result<Operation>
where
CB: Fn(&Context, *const SinkInfo, i32, *mut c_void),
CS: Into<Option<&'str CStr>>,
{
debug_assert_eq!(::std::mem::size_of::<CB>(), 0);
@ -232,7 +234,10 @@ impl Context {
}
op_or_err!(self,
ffi::pa_context_get_sink_info_by_name(self.raw_mut(), name.as_ptr(), Some(wrapped::<CB>), userdata))
ffi::pa_context_get_sink_info_by_name(self.raw_mut(),
name.into().unwrap_cstr(),
Some(wrapped::<CB>),
userdata))
}
pub fn get_sink_info_list<CB>(&self, _: CB, userdata: *mut c_void) -> Result<Operation>

Просмотреть файл

@ -134,7 +134,7 @@ impl Context {
ctx.mainloop.signal();
}
let _ = context.get_sink_info_by_name(unsafe { CStr::from_ptr(info.default_sink_name) },
let _ = context.get_sink_info_by_name(try_cstr_from(info.default_sink_name),
sink_info_cb,
u);
}
@ -162,7 +162,6 @@ impl Context {
ctx.operation_wait(None, &o);
}
}
assert!(ctx.default_sink_info.is_some());
ctx.mainloop.unlock();
// Return the result.
@ -232,14 +231,17 @@ impl Context {
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 ctx = &(*list_data.context);
if eol != 0 {
ctx.mainloop.signal();
return;
}
debug_assert!(!i.is_null());
debug_assert!(!user_data.is_null());
let mut list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
let info = unsafe { &*i };
let group_id = match info.proplist().gets("sysfs.path") {
@ -261,7 +263,6 @@ impl Context {
cubeb::DevicePref::empty()
};
let ctx = &(*list_data.context);
let device_id = ctx.devids.borrow_mut().add(info_name);
let friendly_name = info_description.into_raw();
let devinfo = cubeb::DeviceInfo {
@ -283,19 +284,20 @@ impl Context {
latency_hi: 0,
};
list_data.devinfo.push(devinfo);
ctx.mainloop.signal();
}
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 ctx = &(*list_data.context);
if eol != 0 {
ctx.mainloop.signal();
return;
}
debug_assert!(!user_data.is_null());
debug_assert!(!i.is_null());
let mut list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
let info = unsafe { &*i };
let group_id = match info.proplist().gets("sysfs.path") {
@ -317,7 +319,6 @@ impl Context {
cubeb::DevicePref::empty()
};
let ctx = &(*list_data.context);
let device_id = ctx.devids.borrow_mut().add(info_name);
let friendly_name = info_description.into_raw();
let devinfo = cubeb::DeviceInfo {
@ -341,14 +342,17 @@ impl Context {
list_data.devinfo.push(devinfo);
ctx.mainloop.signal();
}
fn default_device_names(_: &pulse::Context, info: &pulse::ServerInfo, user_data: *mut c_void) {
let list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
list_data.default_sink_name = unsafe { CStr::from_ptr(info.default_sink_name) }.to_owned();
list_data.default_source_name = unsafe { CStr::from_ptr(info.default_source_name) }.to_owned();
list_data.default_sink_name = super::try_cstr_from(info.default_sink_name)
.map(|s| s.to_owned())
.unwrap_or_default();
list_data.default_source_name = super::try_cstr_from(info.default_source_name)
.map(|s| s.to_owned())
.unwrap_or_default();
(*list_data.context).mainloop.signal();
}