Bug 1545279 - Update cubeb from upstream to 3570749. r=padenot
authorAlex Chronopoulos <achronop@gmail.com>
Thu, 25 Apr 2019 09:22:35 +0000
changeset 530077 3ba614682b62df868e89da1d7705b3191954f0fc
parent 530076 e1ab2cda04243606b3e030f6858f415b83fae1f6
child 530078 ccad4749f589248d7b94fd7ec75abb92ee03d833
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1545279, 3570749
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545279 - Update cubeb from upstream to 3570749. r=padenot Pick commits: 3570749 - wasapi: tie monitor lifetime with notification client lifetime. BMO 1545279 (#505) 162625a - test: add option to get the posotion of a stream (#504) Differential Revision: https://phabricator.services.mozilla.com/D28796
media/libcubeb/moz.yaml
media/libcubeb/src/cubeb_wasapi.cpp
--- a/media/libcubeb/moz.yaml
+++ b/media/libcubeb/moz.yaml
@@ -14,10 +14,10 @@ bugzilla:
 origin:
   name: "cubeb"
   description: "Cross platform audio library"
 
   url: "https://github.com/kinetiknz/cubeb"
   license: "ISC"
 
   # update.sh will update this value
-  release: "241e3c7b8a6ce76ad9e075ee5761cd4d0906bc16 (2019-04-16 17:39:01 +0200)"
+  release: "3570749942a4fea2b7e372833cb8374ce42cf389 (2019-04-24 13:04:01 +1200)"
 
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -158,17 +158,16 @@ struct cubeb {
   com_ptr<IMMDeviceEnumerator> device_collection_enumerator;
   com_ptr<wasapi_collection_notification_client> collection_notification_client;
   /* Collection changed for input (capture) devices. */
   cubeb_device_collection_changed_callback input_collection_changed_callback = nullptr;
   void * input_collection_changed_user_ptr = nullptr;
   /* Collection changed for output (render) devices. */
   cubeb_device_collection_changed_callback output_collection_changed_callback = nullptr;
   void * output_collection_changed_user_ptr = nullptr;
-  std::unique_ptr<monitor_device_notifications> monitor_notifications;
 };
 
 class wasapi_endpoint_notification_client;
 
 /* We have three possible callbacks we can use with a stream:
  * - input only
  * - output only
  * - synchronized input and output
@@ -303,16 +302,17 @@ public:
 
     CloseHandle(input_changed);
     CloseHandle(output_changed);
     CloseHandle(shutdown);
   }
 
   void notify(EDataFlow flow)
   {
+    XASSERT(cubeb_context);
     if (flow == eCapture && cubeb_context->input_collection_changed_callback) {
       bool res = SetEvent(input_changed);
       if (!res) {
         LOG("Failed to set input changed event");
       }
       return;
     }
     if (flow == eRender && cubeb_context->output_collection_changed_callback) {
@@ -445,16 +445,17 @@ public:
       return E_NOINTERFACE;
     }
     return S_OK;
   }
 
   wasapi_collection_notification_client(cubeb * context)
     : ref_count(1)
     , cubeb_context(context)
+    , monitor_notifications(context)
   {
     XASSERT(cubeb_context);
   }
 
   virtual ~wasapi_collection_notification_client()
   { }
 
   HRESULT STDMETHODCALLTYPE
@@ -487,17 +488,17 @@ public:
     if (new_state == DEVICE_STATE_ACTIVE ||
         new_state == DEVICE_STATE_NOTPRESENT ||
         new_state == DEVICE_STATE_UNPLUGGED) {
       EDataFlow flow;
       HRESULT hr = GetDataFlow(device_id, &flow);
       if (FAILED(hr)) {
         return hr;
       }
-      cubeb_context->monitor_notifications->notify(flow);
+      monitor_notifications.notify(flow);
     }
     return S_OK;
   }
 
   HRESULT STDMETHODCALLTYPE
   OnPropertyValueChanged(LPCWSTR device_id, const PROPERTYKEY key)
   {
     //Audio device property value changed.
@@ -525,16 +526,17 @@ private:
 
     return endpoint->GetDataFlow(flow);
   }
 
   /* refcount for this instance, necessary to implement MSCOM semantics. */
   LONG ref_count;
 
   cubeb * cubeb_context = nullptr;
+  monitor_device_notifications monitor_notifications;
 };
 
 class wasapi_endpoint_notification_client : public IMMNotificationClient
 {
 public:
   /* The implementation of MSCOM was copied from MSDN. */
   ULONG STDMETHODCALLTYPE
   AddRef()
@@ -1331,33 +1333,30 @@ HRESULT register_collection_notification
   hr = context->device_collection_enumerator->RegisterEndpointNotificationCallback(
                                                 context->collection_notification_client.get());
   if (FAILED(hr)) {
     LOG("Could not register endpoint notification callback: %lx", hr);
     context->collection_notification_client.reset();
     context->device_collection_enumerator.reset();
   }
 
-  context->monitor_notifications.reset(new monitor_device_notifications(context));
-
   return hr;
 }
 
 HRESULT unregister_collection_notification_client(cubeb * context)
 {
   HRESULT hr = context->device_collection_enumerator->
     UnregisterEndpointNotificationCallback(context->collection_notification_client.get());
   if (FAILED(hr)) {
     return hr;
   }
 
   context->collection_notification_client = nullptr;
   context->device_collection_enumerator = nullptr;
 
-  context->monitor_notifications.reset();
   return hr;
 }
 
 HRESULT get_default_endpoint(com_ptr<IMMDevice> & device, EDataFlow direction, ERole role)
 {
   com_ptr<IMMDeviceEnumerator> enumerator;
   HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator),
                                 NULL, CLSCTX_INPROC_SERVER,