NPAPI:DefaultAudioDeviceNotification

Revision as of 19:09, 24 February 2016 by Jmathies (talk | contribs) (minor nits)

Status

Under consideration.

Contributors

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

Problem Summary

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

This callback registration 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