mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1443368 - Update cubeb-pulse-rs to commit 22cdde3. r=kinetik
Pull for change to replace assert in get_server_info callback with proper handling for null pointer. MozReview-Commit-ID: 996HQw3FyYQ --HG-- extra : rebase_source : a0d8a0d4ed6df1e5cad13b8ad03d9e1d10fc9223
This commit is contained in:
parent
e0dc62fb37
commit
d1d3dca95f
@ -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 f58dc34c5af519352aed4b4cd79bb34060e59c65 (2018-02-23 11:16:40 +1000)
|
||||
The git commit ID used was 22cdde3e573303649a77e48a19f7ca2c4d308047 (2018-03-06 10:39:46 +1000)
|
||||
|
@ -189,17 +189,20 @@ impl Context {
|
||||
}
|
||||
|
||||
pub fn get_server_info<CB>(&self, _: CB, userdata: *mut c_void) -> Result<Operation>
|
||||
where CB: Fn(&Context, &ServerInfo, *mut c_void)
|
||||
where CB: Fn(&Context, Option<&ServerInfo>, *mut c_void)
|
||||
{
|
||||
debug_assert_eq!(::std::mem::size_of::<CB>(), 0);
|
||||
|
||||
// See: A note about `wrapped` functions
|
||||
unsafe extern "C" fn wrapped<F>(c: *mut ffi::pa_context, i: *const ffi::pa_server_info, userdata: *mut c_void)
|
||||
where F: Fn(&Context, &ServerInfo, *mut c_void)
|
||||
where F: Fn(&Context, Option<&ServerInfo>, *mut c_void)
|
||||
{
|
||||
use std::mem::{forget, uninitialized};
|
||||
debug_assert_ne!(i, ptr::null_mut());
|
||||
let info = &*i;
|
||||
let info = if i.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(&*i)
|
||||
};
|
||||
let ctx = context::from_raw_ptr(c);
|
||||
let result = uninitialized::<F>()(&ctx, info, userdata);
|
||||
forget(ctx);
|
||||
|
@ -118,7 +118,7 @@ impl PulseContext {
|
||||
}
|
||||
|
||||
fn new(name: Option<&CStr>) -> Result<Box<Self>> {
|
||||
fn server_info_cb(context: &pulse::Context, info: &pulse::ServerInfo, u: *mut c_void) {
|
||||
fn server_info_cb(context: &pulse::Context, info: Option<&pulse::ServerInfo>, u: *mut c_void) {
|
||||
fn sink_info_cb(
|
||||
_: &pulse::Context,
|
||||
i: *const pulse::SinkInfo,
|
||||
@ -138,11 +138,17 @@ impl PulseContext {
|
||||
ctx.mainloop.signal();
|
||||
}
|
||||
|
||||
let _ = context.get_sink_info_by_name(
|
||||
try_cstr_from(info.default_sink_name),
|
||||
sink_info_cb,
|
||||
u,
|
||||
);
|
||||
if let Some(info) = info {
|
||||
let _ = context.get_sink_info_by_name(
|
||||
try_cstr_from(info.default_sink_name),
|
||||
sink_info_cb,
|
||||
u,
|
||||
);
|
||||
} else {
|
||||
// If info is None, then an error occured.
|
||||
let ctx = unsafe { &mut *(u as *mut PulseContext) };
|
||||
ctx.mainloop.signal();
|
||||
}
|
||||
}
|
||||
|
||||
let name = name.map(|s| s.to_owned());
|
||||
@ -349,17 +355,19 @@ impl ContextOps for PulseContext {
|
||||
|
||||
fn default_device_names(
|
||||
_: &pulse::Context,
|
||||
info: &pulse::ServerInfo,
|
||||
info: Option<&pulse::ServerInfo>,
|
||||
user_data: *mut c_void,
|
||||
) {
|
||||
let list_data = unsafe { &mut *(user_data as *mut PulseDevListData) };
|
||||
|
||||
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();
|
||||
if let Some(info) = info {
|
||||
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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user