--- 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 faa1dcf3a061144c1f7edee76f23691eabd1f436 (2017-04-20 11:23:09 +1000)
+The git commit ID used was dbcd7f96aea8d249a4b78f9a7597768c9dff22eb (2017-04-25 11:42:10 +1000)
deleted file mode 100644
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/errors.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-pub const OK: i32 = 0;
-pub const ERROR: i32 = -1;
-pub const ERROR_INVALID_FORMAT: i32 = -2;
-pub const ERROR_INVALID_PARAMETER: i32 = -3;
-pub const ERROR_NOT_SUPPORTED: i32 = -4;
-pub const ERROR_DEVICE_UNAVAILABLE: i32 = -5;
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/ffi.rs
+++ b/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/ffi.rs
@@ -482,17 +482,17 @@ fn bindgen_test_layout_cubeb_device_info
stringify!(DeviceInfo),
"::",
stringify!(latency_hi)));
}
#[test]
fn bindgen_test_layout_cubeb_device_collection() {
assert_eq!(::std::mem::size_of::<DeviceCollection>(),
- 16usize,
+ 8usize,
concat!("Size of: ", stringify!(DeviceCollection)));
assert_eq!(::std::mem::align_of::<DeviceCollection>(),
8usize,
concat!("Alignment of ", stringify!(DeviceCollection)));
assert_eq!(unsafe { &(*(0 as *const DeviceCollection)).count as *const _ as usize },
0usize,
concat!("Alignment of field: ",
stringify!(DeviceCollection),
@@ -501,20 +501,8 @@ fn bindgen_test_layout_cubeb_device_coll
assert_eq!(unsafe { &(*(0 as *const DeviceCollection)).device as *const _ as usize },
8usize,
concat!("Alignment of field: ",
stringify!(DeviceCollection),
"::",
stringify!(device)));
}
-
-#[test]
-fn test_normal_logging() {
- log!("This is log at normal level");
- log!("This is {} at normal level", "log with param");
-}
-
-#[test]
-fn test_verbose_logging() {
- logv!("This is a log at verbose level");
- logv!("This is {} at verbose level", "log with param");
-}
deleted file mode 100644
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/internal.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-use libc::c_void;
-use *;
-
-#[repr(C)]
-#[derive(Clone,Copy,Debug)]
-pub struct LayoutMap {
- pub name: *const i8,
- pub channels: u32,
- pub layout: ChannelLayout
-}
-
-#[repr(C)]
-pub struct Ops {
- pub init: Option<unsafe extern "C" fn(context: *mut *mut Context, context_name: *const i8) -> i32>,
- pub get_backend_id: Option<unsafe extern "C" fn(context: *mut Context) -> *const i8>,
- pub get_max_channel_count: Option<unsafe extern "C" fn(context: *mut Context, max_channels: *mut u32) -> i32>,
- pub get_min_latency: Option<unsafe extern "C" fn(context: *mut Context, params: StreamParams, latency_ms: *mut u32) -> i32>,
- pub get_preferred_sample_rate: Option<unsafe extern "C" fn(context: *mut Context, rate: *mut u32) -> i32>,
- pub get_preferred_channel_layout: Option<unsafe extern "C" fn(context: *mut Context, layout: *mut ChannelLayout) -> i32>,
- pub enumerate_devices: Option<unsafe extern "C" fn(context: *mut Context, devtype: DeviceType, collection: *mut *mut DeviceCollection) -> i32>,
- pub destroy: Option<unsafe extern "C" fn(context: *mut Context)>,
- pub stream_init: Option<unsafe extern "C" fn(context: *mut Context, stream: *mut *mut Stream, stream_name: *const i8, input_device: DeviceId, input_stream_params: *mut StreamParams, output_device: DeviceId, output_stream_params: *mut StreamParams, latency: u32, data_callback: DataCallback, state_callback: StateCallback, user_ptr: *mut c_void) -> i32>,
- pub stream_destroy: Option<unsafe extern "C" fn(stream: *mut Stream)>,
- pub stream_start: Option<unsafe extern "C" fn(stream: *mut Stream) -> i32>,
- pub stream_stop: Option<unsafe extern "C" fn(stream: *mut Stream) -> i32>,
- pub stream_get_position: Option<unsafe extern "C" fn(stream: *mut Stream, position: *mut u64) -> i32>,
- pub stream_get_latency: Option<unsafe extern "C" fn(stream: *mut Stream, latency: *mut u32) -> i32>,
- pub stream_set_volume: Option<unsafe extern "C" fn(stream: *mut Stream, volumes: f32) -> i32>,
- pub stream_set_panning: Option<unsafe extern "C" fn(stream: *mut Stream, panning: f32)-> i32>,
- pub stream_get_current_device: Option<unsafe extern "C" fn(stream: *mut Stream, device: *mut *const Device) -> i32>,
- pub stream_device_destroy: Option<unsafe extern "C" fn(stream: *mut Stream, device: *mut Device) -> i32>,
- pub stream_register_device_changed_callback: Option<unsafe extern "C" fn(stream: *mut Stream, device_changed_callback: DeviceChangedCallback) -> i32>,
- pub register_device_collection_changed: Option<unsafe extern "C" fn(context: *mut Context, devtype: DeviceType, callback: DeviceCollectionChangedCallback, user_ptr: *mut c_void) -> i32>
-}
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/log.rs
+++ b/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/log.rs
@@ -48,19 +48,28 @@ pub enum LogLevel {
pub type LogCallback = Option<unsafe extern "C" fn(fmt: *const c_char, ...)>;
extern "C" {
pub static g_cubeb_log_level: LogLevel;
pub static g_cubeb_log_callback: LogCallback;
}
+pub fn log_enabled() -> bool {
+ unsafe { g_cubeb_log_level != LogLevel::Disabled }
+}
+
#[test]
fn test_normal_logging() {
log!("This is log at normal level");
log!("Formatted log %d", 1);
}
#[test]
fn test_verbose_logging() {
logv!("This is a log at verbose level");
logv!("Formatted log %d", 1);
}
+
+#[test]
+fn test_logging_disabled_by_default() {
+ assert!(!log_enabled());
+}
deleted file mode 100644
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/types/device_fmt.rs
+++ /dev/null
@@ -1,89 +0,0 @@
-use std::ops;
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
-pub struct DeviceFmt(u32);
-
-const DEVICE_FMT_S16LE: u32 = 0x0010;
-const DEVICE_FMT_S16BE: u32 = 0x0020;
-const DEVICE_FMT_F32LE: u32 = 0x1000;
-const DEVICE_FMT_F32BE: u32 = 0x2000;
-const DEVICE_FMT_S16_MASK: u32 = DEVICE_FMT_S16LE | DEVICE_FMT_S16BE;
-const DEVICE_FMT_F32_MASK: u32 = DEVICE_FMT_F32LE | DEVICE_FMT_F32BE;
-const DEVICE_FMT_ALL: u32 = DEVICE_FMT_S16_MASK | DEVICE_FMT_F32_MASK;
-
-
-impl DeviceFmt {
- pub fn empty() -> Self { DeviceFmt(0) }
-
- #[inline] pub fn s16le() -> Self { DeviceFmt(DEVICE_FMT_S16LE) }
- #[inline] pub fn s16be() -> Self { DeviceFmt(DEVICE_FMT_S16BE) }
- #[inline] pub fn f32le() -> Self { DeviceFmt(DEVICE_FMT_F32LE) }
- #[inline] pub fn f32be() -> Self { DeviceFmt(DEVICE_FMT_F32BE) }
- #[inline] pub fn all() -> Self { DeviceFmt(DEVICE_FMT_ALL) }
-
- #[inline] pub fn s16ne() -> Self {
- if cfg!(target_endian = "little") {
- DeviceFmt::s16le()
- } else {
- DeviceFmt::s16be()
- }
- }
-
- #[inline] pub fn f32ne() -> Self {
- if cfg!(target_endian = "little") {
- DeviceFmt::f32le()
- } else {
- DeviceFmt::f32be()
- }
- }
-
- #[inline] pub fn contains(&self, other: Self) -> bool { (*self & other) == other }
- #[inline] pub fn insert(&mut self, other: Self) { self.0 |= other.0; }
- #[inline] pub fn remove(&mut self, other: Self) { self.0 &= !other.0; }
-}
-
-impl ops::BitOr for DeviceFmt {
- type Output = DeviceFmt;
-
- #[inline]
- fn bitor(self, other: Self) -> Self {
- DeviceFmt(self.0 | other.0)
- }
-}
-
-impl ops::BitXor for DeviceFmt {
- type Output = DeviceFmt;
-
- #[inline]
- fn bitxor(self, other: Self) -> Self {
- DeviceFmt(self.0 ^ other.0)
- }
-}
-
-impl ops::BitAnd for DeviceFmt {
- type Output = DeviceFmt;
-
- #[inline]
- fn bitand(self, other: Self) -> Self {
- DeviceFmt(self.0 & other.0)
- }
-}
-
-impl ops::Sub for DeviceFmt {
- type Output = DeviceFmt;
-
- #[inline]
- fn sub(self, other: Self) -> Self {
- DeviceFmt(self.0 & !other.0)
- }
-}
-
-impl ops::Not for DeviceFmt {
- type Output = DeviceFmt;
-
- #[inline]
- fn not(self) -> Self {
- DeviceFmt(!self.0 & DEVICE_FMT_ALL)
- }
-}
deleted file mode 100644
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/types/device_pref.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-use std::ops;
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub struct DevicePref(u32);
-
-const DEVICE_PREF_MULTIMEDIA: u32 = 0x1;
-const DEVICE_PREF_VOICE: u32 = 0x2;
-const DEVICE_PREF_NOTIFICATION: u32 = 0x4;
-const DEVICE_PREF_ALL: u32 = 0xF;
-
-impl DevicePref {
- pub fn none() -> Self { DevicePref(0) }
-
- #[inline] pub fn multimedia() -> Self { DevicePref(DEVICE_PREF_MULTIMEDIA) }
- #[inline] pub fn voice() -> Self { DevicePref(DEVICE_PREF_VOICE) }
- #[inline] pub fn notification() -> Self { DevicePref(DEVICE_PREF_NOTIFICATION) }
- #[inline] pub fn all() -> Self { DevicePref(DEVICE_PREF_ALL) }
-
- #[inline] pub fn contains(&self, other: Self) -> bool { (*self & other) == other }
- #[inline] pub fn insert(&mut self, other: Self) { self.0 |= other.0; }
- #[inline] pub fn remove(&mut self, other: Self) { self.0 &= !other.0; }
-}
-
-impl ops::BitOr for DevicePref {
- type Output = DevicePref;
-
- #[inline]
- fn bitor(self, other: Self) -> Self {
- DevicePref(self.0 | other.0)
- }
-}
-
-impl ops::BitXor for DevicePref {
- type Output = DevicePref;
-
- #[inline]
- fn bitxor(self, other: Self) -> Self {
- DevicePref(self.0 ^ other.0)
- }
-}
-
-impl ops::BitAnd for DevicePref {
- type Output = DevicePref;
-
- #[inline]
- fn bitand(self, other: Self) -> Self {
- DevicePref(self.0 & other.0)
- }
-}
-
-impl ops::Sub for DevicePref {
- type Output = DevicePref;
-
- #[inline]
- fn sub(self, other: Self) -> Self {
- DevicePref(self.0 & !other.0)
- }
-}
-
-impl ops::Not for DevicePref {
- type Output = DevicePref;
-
- #[inline]
- fn not(self) -> Self {
- DevicePref(!self.0 & DEVICE_PREF_ALL)
- }
-}
deleted file mode 100644
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/types/device_type.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-use std::ops;
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub struct DeviceType(u32);
-
-const DEVICE_TYPE_UNKNOWN: u32 = 0b00;
-const DEVICE_TYPE_INPUT:u32 = 0b01;
-const DEVICE_TYPE_OUTPUT: u32 = 0b10;
-const DEVICE_TYPE_ALL: u32 = 0b11;
-
-impl DeviceType {
- pub fn unknown() -> Self { DeviceType(DEVICE_TYPE_UNKNOWN) }
-
- #[inline] pub fn input() -> Self { DeviceType(DEVICE_TYPE_INPUT) }
- #[inline] pub fn output() -> Self { DeviceType(DEVICE_TYPE_OUTPUT) }
- #[inline] pub fn all() -> Self { DeviceType(DEVICE_TYPE_ALL) }
-
- #[inline] pub fn is_input(&self) -> bool { self.contains(DeviceType::input()) }
- #[inline] pub fn is_output(&self) -> bool { self.contains(DeviceType::output()) }
-
- #[inline] pub fn contains(&self, other: Self) -> bool { (*self & other) == other }
- #[inline] pub fn insert(&mut self, other: Self) { self.0 |= other.0; }
- #[inline] pub fn remove(&mut self, other: Self) { self.0 &= !other.0; }
-}
-
-impl ops::BitOr for DeviceType {
- type Output = DeviceType;
-
- #[inline]
- fn bitor(self, other: Self) -> Self {
- DeviceType(self.0 | other.0)
- }
-}
-
-impl ops::BitXor for DeviceType {
- type Output = DeviceType;
-
- #[inline]
- fn bitxor(self, other: Self) -> Self {
- DeviceType(self.0 ^ other.0)
- }
-}
-
-impl ops::BitAnd for DeviceType {
- type Output = DeviceType;
-
- #[inline]
- fn bitand(self, other: Self) -> Self {
- DeviceType(self.0 & other.0)
- }
-}
-
-impl ops::Sub for DeviceType {
- type Output = DeviceType;
-
- #[inline]
- fn sub(self, other: Self) -> Self {
- DeviceType(self.0 & !other.0)
- }
-}
-
-impl ops::Not for DeviceType {
- type Output = DeviceType;
-
- #[inline]
- fn not(self) -> Self {
- DeviceType(!self.0 & DEVICE_TYPE_ALL)
- }
-}
deleted file mode 100644
--- a/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/types/mod.rs
+++ /dev/null
@@ -1,323 +0,0 @@
-use libc::c_void;
-
-mod device_pref;
-mod device_fmt;
-mod device_type;
-
-pub use self::device_pref::*;
-pub use self::device_fmt::*;
-pub use self::device_type::*;
-
-/// Opaque handle to cubeb context.
-pub enum Context {}
-
-/// Opaque handle to cubeb stream.
-pub enum Stream {}
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum SampleFormat {
- Signed16LE = 0,
- Signed16BE = 1,
- Float32LE = 2,
- Float32BE = 3,
-}
-
-#[cfg(target_endian = "little")]
-pub const SAMPLE_S16NE: SampleFormat = SampleFormat::Signed16LE;
-#[cfg(target_endian = "little")]
-pub const SAMPLE_FLOAT32NE: SampleFormat = SampleFormat::Float32LE;
-#[cfg(target_endian = "big")]
-pub const SAMPLE_S16NE: SampleFormat = SampleFormat::Signed16BE;
-#[cfg(target_endian = "big")]
-pub const SAMPLE_FLOAT32NE: SampleFormat = SampleFormat::Float32BE;
-
-pub type DeviceId = *const c_void;
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum ChannelLayout {
- Undefined = 0,
- DualMono = 1,
- DualMonoLfe = 2,
- Mono = 3,
- MonoLfe = 4,
- Stereo = 5,
- StereoLfe = 6,
- Layout3F = 7,
- Layout3FLfe = 8,
- Layout2F1 = 9,
- Layout2F1Lfe = 10,
- Layout3F1 = 11,
- Layout3F1Lfe = 12,
- Layout2F2 = 13,
- Layout2F2Lfe = 14,
- Layout3F2 = 15,
- Layout3F2Lfe = 16,
- Layout3F3RLfe = 17,
- Layout3F4Lfe = 18,
- Max = 19,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone, Debug)]
-pub struct StreamParams {
- pub format: SampleFormat,
- pub rate: u32,
- pub channels: u32,
- pub layout: ChannelLayout,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone, Debug)]
-pub struct Device {
- pub output_name: *mut i8,
- pub input_name: *mut i8,
-}
-
-impl Default for Device {
- fn default() -> Self {
- Device {
- output_name: 0 as *mut _,
- input_name: 0 as *mut _,
- }
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum State {
- Started = 0,
- Stopped = 1,
- Drained = 2,
- Error = 3,
-}
-
-#[repr(C)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum DeviceState {
- Disabled = 0,
- Unplugged = 1,
- Enabled = 2,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone, Debug)]
-pub struct DeviceInfo {
- pub devid: DeviceId,
- pub device_id: *const i8,
- pub friendly_name: *const i8,
- pub group_id: *const i8,
- pub vendor_name: *const i8,
- pub devtype: DeviceType,
- pub state: DeviceState,
- pub preferred: DevicePref,
- pub format: DeviceFmt,
- pub default_format: DeviceFmt,
- pub max_channels: u32,
- pub default_rate: u32,
- pub max_rate: u32,
- pub min_rate: u32,
- pub latency_lo: u32,
- pub latency_hi: u32,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone, Debug)]
-pub struct DeviceCollection {
- /// Device count in collection.
- pub count: u32,
- /// Array of pointers to device info.
- pub device: [*const DeviceInfo; 0],
-}
-
-pub type DataCallback = Option<unsafe extern "C" fn(stream: *mut Stream, user_ptr: *mut c_void, input_buffer: *const c_void, output_buffer: *mut c_void, nframes: i64) -> i64>;
-pub type StateCallback = Option<unsafe extern "C" fn(stream: *mut Stream, user_ptr: *mut c_void, state: State)>;
-pub type DeviceChangedCallback = Option<unsafe extern "C" fn(user_ptr: *mut c_void)>;
-pub type DeviceCollectionChangedCallback = Option<unsafe extern "C" fn(context: *mut Context, user_ptr: *mut c_void)>;
-pub type LogCallback = Option<unsafe extern "C" fn(fmt: *const i8, ...)>;
-
-#[test]
-fn bindgen_test_layout_stream_params() {
- assert_eq!(::std::mem::size_of::<StreamParams>(),
- 16usize,
- concat!("Size of: ", stringify!(StreamParams)));
- assert_eq!(::std::mem::align_of::<StreamParams>(),
- 4usize,
- concat!("Alignment of ", stringify!(StreamParams)));
- assert_eq!(unsafe { &(*(0 as *const StreamParams)).format as *const _ as usize },
- 0usize,
- concat!("Alignment of field: ",
- stringify!(StreamParams),
- "::",
- stringify!(format)));
- assert_eq!(unsafe { &(*(0 as *const StreamParams)).rate as *const _ as usize },
- 4usize,
- concat!("Alignment of field: ",
- stringify!(StreamParams),
- "::",
- stringify!(rate)));
- assert_eq!(unsafe { &(*(0 as *const StreamParams)).channels as *const _ as usize },
- 8usize,
- concat!("Alignment of field: ",
- stringify!(StreamParams),
- "::",
- stringify!(channels)));
- assert_eq!(unsafe { &(*(0 as *const StreamParams)).layout as *const _ as usize },
- 12usize,
- concat!("Alignment of field: ",
- stringify!(StreamParams),
- "::",
- stringify!(layout)));
-}
-
-#[test]
-fn bindgen_test_layout_cubeb_device() {
- assert_eq!(::std::mem::size_of::<Device>(),
- 16usize,
- concat!("Size of: ", stringify!(Device)));
- assert_eq!(::std::mem::align_of::<Device>(),
- 8usize,
- concat!("Alignment of ", stringify!(Device)));
- assert_eq!(unsafe { &(*(0 as *const Device)).output_name as *const _ as usize },
- 0usize,
- concat!("Alignment of field: ",
- stringify!(Device),
- "::",
- stringify!(output_name)));
- assert_eq!(unsafe { &(*(0 as *const Device)).input_name as *const _ as usize },
- 8usize,
- concat!("Alignment of field: ",
- stringify!(Device),
- "::",
- stringify!(input_name)));
-}
-
-#[test]
-fn bindgen_test_layout_cubeb_device_info() {
- assert_eq!(::std::mem::size_of::<DeviceInfo>(),
- 88usize,
- concat!("Size of: ", stringify!(DeviceInfo)));
- assert_eq!(::std::mem::align_of::<DeviceInfo>(),
- 8usize,
- concat!("Alignment of ", stringify!(DeviceInfo)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).devid as *const _ as usize },
- 0usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(devid)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).device_id as *const _ as usize },
- 8usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(device_id)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).friendly_name as *const _ as usize },
- 16usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(friendly_name)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).group_id as *const _ as usize },
- 24usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(group_id)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).vendor_name as *const _ as usize },
- 32usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(vendor_name)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).devtype as *const _ as usize },
- 40usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(type_)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).state as *const _ as usize },
- 44usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(state)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).preferred as *const _ as usize },
- 48usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(preferred)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).format as *const _ as usize },
- 52usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(format)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).default_format as *const _ as usize },
- 56usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(default_format)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).max_channels as *const _ as usize },
- 60usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(max_channels)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).default_rate as *const _ as usize },
- 64usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(default_rate)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).max_rate as *const _ as usize },
- 68usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(max_rate)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).min_rate as *const _ as usize },
- 72usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(min_rate)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).latency_lo as *const _ as usize },
- 76usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(latency_lo)));
- assert_eq!(unsafe { &(*(0 as *const DeviceInfo)).latency_hi as *const _ as usize },
- 80usize,
- concat!("Alignment of field: ",
- stringify!(DeviceInfo),
- "::",
- stringify!(latency_hi)));
-}
-
-#[test]
-fn bindgen_test_layout_cubeb_device_collection() {
- assert_eq!(::std::mem::size_of::<DeviceCollection>(),
- 8usize,
- concat!("Size of: ", stringify!(DeviceCollection)));
- assert_eq!(::std::mem::align_of::<DeviceCollection>(),
- 8usize,
- concat!("Alignment of ", stringify!(DeviceCollection)));
- assert_eq!(unsafe { &(*(0 as *const DeviceCollection)).count as *const _ as usize },
- 0usize,
- concat!("Alignment of field: ",
- stringify!(DeviceCollection),
- "::",
- stringify!(count)));
- assert_eq!(unsafe { &(*(0 as *const DeviceCollection)).device as *const _ as usize },
- 8usize,
- concat!("Alignment of field: ",
- stringify!(DeviceCollection),
- "::",
- stringify!(device)));
-
-}
--- a/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs
+++ b/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs
@@ -689,17 +689,17 @@ unsafe extern "C" fn pulse_subscribe_cal
index: u32,
user_data: *mut c_void) {
let mut ctx = &mut *(user_data as *mut Context);
match t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK {
PA_SUBSCRIPTION_EVENT_SOURCE |
PA_SUBSCRIPTION_EVENT_SINK => {
- if cubeb::g_cubeb_log_level != cubeb::LogLevel::Disabled {
+ if cubeb::log_enabled() {
if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE &&
(t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE {
log!("Removing sink index %d", index);
} else if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE &&
(t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW {
log!("Adding sink index %d", index);
}
if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK &&
--- a/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs
+++ b/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs
@@ -185,17 +185,17 @@ impl<'ctx> Stream<'ctx> {
pa_threaded_mainloop_unlock(stm.context.mainloop);
if !r {
stm.destroy();
return Err(cubeb::ERROR);
}
- if cubeb::g_cubeb_log_level != cubeb::LogLevel::Disabled {
+ if cubeb::log_enabled() {
if output_stream_params.is_some() {
let output_att = *pa_stream_get_buffer_attr(stm.output_stream);
log!("Output buffer attributes maxlength %u, tlength %u, \
prebuf %u, minreq %u, fragsize %u",
output_att.maxlength,
output_att.tlength,
output_att.prebuf,
output_att.minreq,