Bug 1367646 - Add device collection patch to libcubeb/update.h r?kinetik
Can be removed once changes are upstreamed.
MozReview-Commit-ID: 2dRzgj51x7L
new file mode 100644
--- /dev/null
+++ b/media/libcubeb/device-collection-destroy.patch
@@ -0,0 +1,31 @@
+diff --git a/media/libcubeb/src/cubeb.c b/media/libcubeb/src/cubeb.c
+index 714f88f722ec..00e074644044 100644
+--- a/media/libcubeb/src/cubeb.c
++++ b/media/libcubeb/src/cubeb.c
+@@ -574,13 +574,24 @@ int cubeb_enumerate_devices(cubeb * context,
+ int cubeb_device_collection_destroy(cubeb * context,
+ cubeb_device_collection * collection)
+ {
+- if (context == NULL || collection == NULL)
++ int r;
++
++ if (!context || !collection)
+ return CUBEB_ERROR_INVALID_PARAMETER;
+
+ if (!context->ops->device_collection_destroy)
+ return CUBEB_ERROR_NOT_SUPPORTED;
+
+- return context->ops->device_collection_destroy(context, collection);
++ if (!collection->device)
++ return CUBEB_OK;
++
++ r = context->ops->device_collection_destroy(context, collection);
++ if (r == CUBEB_OK) {
++ collection->device = NULL;
++ collection->count = 0;
++ }
++
++ return r;
+ }
+
+ int cubeb_register_device_collection_changed(cubeb * context,
--- a/media/libcubeb/update.sh
+++ b/media/libcubeb/update.sh
@@ -63,10 +63,13 @@ if [ -n "$rev" ]; then
echo "WARNING: updating from a dirty git repository."
fi
sed -i.bak -e "/The git commit ID used was/ s/[0-9a-f]\{40\}\(-dirty\)\{0,1\} .\{1,100\}/$version ($date)/" README_MOZILLA
rm README_MOZILLA.bak
else
echo "Remember to update README_MOZILLA with the version details."
fi
-echo "Applying a patch on top of $rev"
+echo "Applying disable-assert.patch on top of $rev"
patch -p3 < disable-assert.patch
+
+echo "Applying device-collection-destroy.patch on top of $rev"
+patch -p3 < device-collection-destroy.patch