Bug 1367646 - Add device collection patch to libcubeb/update.h r?kinetik draft
authorDan Glastonbury <dan.glastonbury@gmail.com>
Fri, 26 May 2017 11:32:13 +1000
changeset 584880 22881cb90be852679002600b346ccd3c05cc8499
parent 584879 73284e8985cb315946c450b68f8c2272efb87ff1
child 584881 c4be8c74c3b3d382d3773a0203c4e7ca6ac03ae0
push id60918
push userbmo:dglastonbury@mozilla.com
push dateFri, 26 May 2017 06:28:26 +0000
reviewerskinetik
bugs1367646
milestone55.0a1
Bug 1367646 - Add device collection patch to libcubeb/update.h r?kinetik Can be removed once changes are upstreamed. MozReview-Commit-ID: 2dRzgj51x7L
media/libcubeb/device-collection-destroy.patch
media/libcubeb/update.sh
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