Bug 1281402 - Uplift cubeb to revision 9a1d6ccd2. r?kinetik
MozReview-Commit-ID: 36jF493k7XW
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,8 @@
The source from this directory was copied from the cubeb
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 git repository is: git://github.com/kinetiknz/cubeb.git
-The git commit ID used was 073c9f011114fe4208b4aa49e99e33cde1deb6f1.
+The git commit ID used was 9a1d6ccd2a0d65bfb985743b927398bcbeb05ad6.
--- a/media/libcubeb/src/cubeb_audiounit.c
+++ b/media/libcubeb/src/cubeb_audiounit.c
@@ -1531,16 +1531,17 @@ audiounit_get_devices(AudioObjectID ** d
ret = AudioObjectGetPropertyData(kAudioObjectSystemObject, &adr, 0, NULL, &size, (void *)*devices);
if (ret != noErr) {
free(*devices);
*devices = NULL;
}
} else {
*devices = NULL;
+ ret = -1;
}
return ret;
}
static char *
audiounit_strref_to_cstr_utf8(CFStringRef strref)
{
@@ -1593,34 +1594,33 @@ audiounit_get_available_samplerate(Audio
UInt32 size = sizeof(Float64);
Float64 fvalue = 0.0;
if (AudioObjectGetPropertyData(devid, &adr, 0, NULL, &size, &fvalue) == noErr) {
*def = fvalue;
}
}
adr.mSelector = kAudioDevicePropertyAvailableNominalSampleRates;
- if (AudioObjectHasProperty(devid, &adr)) {
- UInt32 size = 0;
- AudioValueRange range;
- if (AudioObjectGetPropertyDataSize(devid, &adr, 0, NULL, &size) == noErr) {
- uint32_t i, count = size / sizeof(AudioValueRange);
- AudioValueRange * ranges = malloc(size);
- range.mMinimum = 9999999999.0;
- range.mMaximum = 0.0;
- if (AudioObjectGetPropertyData(devid, &adr, 0, NULL, &size, ranges) == noErr) {
- for (i = 0; i < count; i++) {
- if (ranges[i].mMaximum > range.mMaximum)
- range.mMaximum = ranges[i].mMaximum;
- if (ranges[i].mMinimum < range.mMinimum)
- range.mMinimum = ranges[i].mMinimum;
- }
+ UInt32 size = 0;
+ AudioValueRange range;
+ if (AudioObjectHasProperty(devid, &adr) &&
+ AudioObjectGetPropertyDataSize(devid, &adr, 0, NULL, &size) == noErr) {
+ uint32_t i, count = size / sizeof(AudioValueRange);
+ AudioValueRange * ranges = malloc(size);
+ range.mMinimum = 9999999999.0;
+ range.mMaximum = 0.0;
+ if (AudioObjectGetPropertyData(devid, &adr, 0, NULL, &size, ranges) == noErr) {
+ for (i = 0; i < count; i++) {
+ if (ranges[i].mMaximum > range.mMaximum)
+ range.mMaximum = ranges[i].mMaximum;
+ if (ranges[i].mMinimum < range.mMinimum)
+ range.mMinimum = ranges[i].mMinimum;
}
- free(ranges);
}
+ free(ranges);
*max = (uint32_t)range.mMaximum;
*min = (uint32_t)range.mMinimum;
} else {
*min = *max = 0;
}
}
@@ -1834,17 +1834,17 @@ audiounit_get_devices_of_type(cubeb_devi
for(uint32_t i = 0; i < count; ++i) {
/* For device in the given scope channel must be > 0. */
if (audiounit_get_channel_count(devices[i], scope) > 0) {
devices_in_scope[dev_count] = devices[i];
++dev_count;
}
}
- if (devid_array) {
+ if (devid_array && dev_count > 0) {
*devid_array = calloc(dev_count, sizeof(AudioObjectID));
assert(*devid_array);
memcpy(*devid_array, &devices_in_scope, dev_count * sizeof(AudioObjectID));
}
return dev_count;
}
static uint32_t
--- a/media/libcubeb/src/cubeb_pulse.c
+++ b/media/libcubeb/src/cubeb_pulse.c
@@ -996,17 +996,17 @@ pulse_format_to_cubeb_format(pa_sample_f
}
static void
pulse_ensure_dev_list_data_list_size (pulse_dev_list_data * list_data)
{
if (list_data->count == list_data->max) {
list_data->max += 8;
list_data->devinfo = realloc(list_data->devinfo,
- sizeof(cubeb_device_info) * list_data->max);
+ sizeof(cubeb_device_info *) * list_data->max);
}
}
static cubeb_device_state
pulse_get_state_from_sink_port(pa_sink_port_info * info)
{
if (info != NULL) {
#if PA_CHECK_VERSION(2, 0, 0)
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -1725,17 +1725,17 @@ wasapi_stream_init(cubeb * context, cube
*stream = stm;
return CUBEB_OK;
}
void close_wasapi_stream(cubeb_stream * stm)
{
- XASSERT(stm && !stm->thread && !stm->shutdown_event);
+ XASSERT(stm);
stm->stream_reset_lock->assert_current_thread_owns();
XASSERT(stm->output_client || stm->input_client);
SafeRelease(stm->output_client);
stm->output_client = NULL;
SafeRelease(stm->input_client);