NPAPI:DefaultAudioDeviceNotification: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "= Status = Under consideration. = Contributors = * Last modified: February 24, 2016 * Authors: Bob Owen (Mozilla Corporation) = Problem Summary = = Current Proposal = =...")
 
(First draft)
Line 1: Line 1:
= Status =
= Status =
Under consideration.
Under consideration.


= Contributors =
= Contributors =
* Last modified: February 24, 2016
* Last modified: February 24, 2016
* Authors: Bob Owen (Mozilla Corporation)
* Authors: Bob Owen (Mozilla Corporation)


= Problem Summary =
= Problem Summary =
In Windows 10, Microsoft have made a change to the permissions required for calls to IMMDeviceEnumerator::RegisterEndpointNotificationCallback [https://msdn.microsoft.com/en-us/library/windows/desktop/dd371403%28v=vs.85%29.aspx], so that it no longer works if a process is running at low integrity or lower.
This function is used by some plugins in order to be notified of default audio device changes.
Low integrity is used for sandboxing processes and so this means that plugins, which use it, lose this functionality when sandboxed.


= Current Proposal =
= Current Proposal =
To create two new Windows only variables for NPN_SetVaue and NPP_SetValue, to allow a plugin instances to request and receive notifications of default audio device changes.
== NPN_SetVaue - <code>NPPVpluginRequiresAudioDeviceChanges = 4001</code> ==
* when true - call IMMDeviceEnumerator::RegisterEndpointNotificationCallback (if not already registered), so that we can react to the notifications. Also add instance to a requires notification list.
* when false - remove instance from the requires notification list. If the list is now empty call IMMDeviceEnumerator::UnregisterEndpointNotificationCallback [https://msdn.microsoft.com/en-us/library/windows/desktop/dd371404%28v=vs.85%29.aspx].
== NPP_SetValue - <code>NPNVaudioDeviceChangeDetails = 4001</code> ==
* this would be used when OnDefaultDeviceChanged [https://msdn.microsoft.com/en-us/library/windows/desktop/dd371418%28v=vs.85%29.aspx] is called on the registered IMMNotificationClient [https://msdn.microsoft.com/en-us/library/windows/desktop/dd371417%28v=vs.85%29.aspx]. It would set a new structure (below) containing the two enums and const wchar_t* passed in OnDefaultDeviceChanged. This would be set on each instance in the requires notification list.
<pre>
typedef struct _NPaudioDeviceChangeDetails
{
  int32_t flow;
  int32_t role;
  const wchar_t* defaultDevice;
} NPaudioDeviceChangeDetails;
</pre>
== Notes ==
* The intention is for the registration and in particular the notifications for device changes to be asynchronous, so plugins would needs to allow for this when attempting to interact with the default device.
* These notifications would be on a per instance basis, so plugins only requiring plugin-level notification would need to work around this.


= Open Issues =
= Open Issues =
* None
* None

Revision as of 16:07, 24 February 2016

Status

Under consideration.

Contributors

  • Last modified: February 24, 2016
  • Authors: Bob Owen (Mozilla Corporation)

Problem Summary

In Windows 10, Microsoft have made a change to the permissions required for calls to IMMDeviceEnumerator::RegisterEndpointNotificationCallback [1], so that it no longer works if a process is running at low integrity or lower.

This function is used by some plugins in order to be notified of default audio device changes.

Low integrity is used for sandboxing processes and so this means that plugins, which use it, lose this functionality when sandboxed.

Current Proposal

To create two new Windows only variables for NPN_SetVaue and NPP_SetValue, to allow a plugin instances to request and receive notifications of default audio device changes.

NPN_SetVaue - NPPVpluginRequiresAudioDeviceChanges = 4001

  • when true - call IMMDeviceEnumerator::RegisterEndpointNotificationCallback (if not already registered), so that we can react to the notifications. Also add instance to a requires notification list.
  • when false - remove instance from the requires notification list. If the list is now empty call IMMDeviceEnumerator::UnregisterEndpointNotificationCallback [2].

NPP_SetValue - NPNVaudioDeviceChangeDetails = 4001

  • this would be used when OnDefaultDeviceChanged [3] is called on the registered IMMNotificationClient [4]. It would set a new structure (below) containing the two enums and const wchar_t* passed in OnDefaultDeviceChanged. This would be set on each instance in the requires notification list.
typedef struct _NPaudioDeviceChangeDetails
{
  int32_t flow;
  int32_t role;
  const wchar_t* defaultDevice;
} NPaudioDeviceChangeDetails;

Notes

  • The intention is for the registration and in particular the notifications for device changes to be asynchronous, so plugins would needs to allow for this when attempting to interact with the default device.
  • These notifications would be on a per instance basis, so plugins only requiring plugin-level notification would need to work around this.

Open Issues

  • None