#ifndef REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_
#define REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_
#include <mmdeviceapi.h>
#include <wrl/client.h>
#include "base/synchronization/lock.h"
namespace remoting {
class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient {
public:
explicit DefaultAudioDeviceChangeDetector(
const Microsoft::WRL::ComPtr<IMMDeviceEnumerator>& enumerator);
~DefaultAudioDeviceChangeDetector();
bool GetAndReset();
private:
HRESULT __stdcall OnDefaultDeviceChanged(EDataFlow flow,
ERole role,
LPCWSTR pwstrDefaultDevice) override;
HRESULT __stdcall QueryInterface(REFIID iid, void** object) override;
HRESULT __stdcall OnDeviceAdded(LPCWSTR pwstrDeviceId) override;
HRESULT __stdcall OnDeviceRemoved(LPCWSTR pwstrDeviceId) override;
HRESULT __stdcall OnDeviceStateChanged(LPCWSTR pwstrDeviceId,
DWORD dwNewState) override;
HRESULT __stdcall OnPropertyValueChanged(LPCWSTR pwstrDeviceId,
const PROPERTYKEY key) override;
ULONG __stdcall AddRef() override;
ULONG __stdcall Release() override;
const Microsoft::WRL::ComPtr<IMMDeviceEnumerator> enumerator_;
bool changed_ = false;
base::Lock lock_;
};
}
#endif