Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: remoting/host/win/default_audio_device_change_detector.h

Issue 2809293006: [Chromoting] Move DefaultAudioDeviceChangeDetector out of AudioCapturerWin (Closed)
Patch Set: Remove override of destructor Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/win/BUILD.gn ('k') | remoting/host/win/default_audio_device_change_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_
6 #define REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_
7
8 #include <mmdeviceapi.h>
9
10 #include "base/synchronization/lock.h"
11 #include "base/win/scoped_comptr.h"
12
13 namespace remoting {
14
15 // An IMMNotificationClient implementation to detect the change of the default
16 // audio output device on the system. It registers itself into the input
17 // IMMDeviceEnumerator in constructor and unregisters in destructor.
18 // This class does not use the default ref-counting memory management method
19 // provided by IUnknown: calling DefaultAudioDeviceChangeDetector::Release()
20 // won't delete the object.
21 class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient {
22 public:
23 explicit DefaultAudioDeviceChangeDetector(
24 const base::win::ScopedComPtr<IMMDeviceEnumerator>& enumerator);
25 ~DefaultAudioDeviceChangeDetector();
26
27 bool GetAndReset();
28
29 private:
30 // IMMNotificationClient implementation.
31 HRESULT __stdcall OnDefaultDeviceChanged(EDataFlow flow,
32 ERole role,
33 LPCWSTR pwstrDefaultDevice) override;
34
35 HRESULT __stdcall QueryInterface(REFIID iid, void** object) override;
36
37 // No-ops overrides.
38 HRESULT __stdcall OnDeviceAdded(LPCWSTR pwstrDeviceId) override;
39 HRESULT __stdcall OnDeviceRemoved(LPCWSTR pwstrDeviceId) override;
40 HRESULT __stdcall OnDeviceStateChanged(LPCWSTR pwstrDeviceId,
41 DWORD dwNewState) override;
42 HRESULT __stdcall OnPropertyValueChanged(LPCWSTR pwstrDeviceId,
43 const PROPERTYKEY key) override;
44 ULONG __stdcall AddRef() override;
45 ULONG __stdcall Release() override;
46
47 const base::win::ScopedComPtr<IMMDeviceEnumerator> enumerator_;
48 bool changed_ = false;
49 base::Lock lock_;
50 };
51
52 } // namespace remoting
53
54 #endif // REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_
OLDNEW
« no previous file with comments | « remoting/host/win/BUILD.gn ('k') | remoting/host/win/default_audio_device_change_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698