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

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

Issue 2809293006: [Chromoting] Move DefaultAudioDeviceChangeDetector out of AudioCapturerWin (Closed)
Patch Set: 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
12 namespace remoting {
13
14 // An IMMNotificationClient implementation to detect the change of the default
15 // audio output device on the system.
16 // This class does not use the default referring memory management method
Sergey Ulanov 2017/04/13 01:30:12 s/default referring memory management method/refer
Hzj_jie 2017/04/13 17:26:16 I have not noticed the mm_device_enumerator_ is fo
17 // provided by IUnknown: the
18 // IMMDeviceEnumerator::RegisterEndpointNotificationCallback() will be called in
19 // the constructor, and
20 // IMMDeviceEnumerator::UnregisterEndpointNotificationCallback() will be called
Sergey Ulanov 2017/04/13 01:30:12 s/will be/is/ in the two places above.
Hzj_jie 2017/04/13 17:26:16 Done.
21 // in the destructor. Consumers should ensure the input IMMDeviceEnumerator
22 // outlives this instance.
23 class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient {
24 public:
25 DefaultAudioDeviceChangeDetector(IMMDeviceEnumerator* enumerator);
26 ~DefaultAudioDeviceChangeDetector();
27
28 HRESULT __stdcall OnDefaultDeviceChanged(EDataFlow flow,
Sergey Ulanov 2017/04/13 01:30:12 Move IMMNotificationClient implementation to the p
Hzj_jie 2017/04/13 17:26:16 Done.
29 ERole role,
30 LPCWSTR pwstrDefaultDevice) override;
31
32 HRESULT __stdcall QueryInterface(REFIID iid, void** object) override;
33
34 bool GetAndReset();
35
36 // No-ops overrides.
37 HRESULT __stdcall OnDeviceAdded(LPCWSTR pwstrDeviceId) override {
Sergey Ulanov 2017/04/13 01:30:12 Normally all virtual method overrides should be in
Hzj_jie 2017/04/13 17:26:16 Done.
38 return S_OK;
39 }
40 HRESULT __stdcall OnDeviceRemoved(LPCWSTR pwstrDeviceId) override {
41 return S_OK;
42 }
43 HRESULT __stdcall OnDeviceStateChanged(LPCWSTR pwstrDeviceId,
44 DWORD dwNewState) override {
45 return S_OK;
46 }
47 HRESULT __stdcall OnPropertyValueChanged(LPCWSTR pwstrDeviceId,
48 const PROPERTYKEY key) override {
49 return S_OK;
50 }
51 ULONG __stdcall AddRef() override { return 1; }
52 ULONG __stdcall Release() override { return 1; }
53
54 private:
55 IMMDeviceEnumerator* const enumerator_;
56 bool changed_ = false;
57 base::Lock lock_;
58 };
59
60 } // namespace remoting
61
62 #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