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

Unified Diff: media/audio/win/audio_device_listener_win.h

Issue 1248543002: Remove device change deduplication based on device id. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/win/audio_device_listener_win.h
diff --git a/media/audio/win/audio_device_listener_win.h b/media/audio/win/audio_device_listener_win.h
index 9c2ac4824a67ebc92284fcbbc1eb9af7a87ddf99..053afa64380df8e5a97f2817b813aa03718ee593 100644
--- a/media/audio/win/audio_device_listener_win.h
+++ b/media/audio/win/audio_device_listener_win.h
@@ -11,11 +11,16 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/threading/thread_checker.h"
+#include "base/time/time.h"
#include "base/win/scoped_comptr.h"
#include "media/base/media_export.h"
using base::win::ScopedComPtr;
+namespace base {
+class TickClock;
+}
+
namespace media {
// IMMNotificationClient implementation for listening for default device changes
@@ -35,6 +40,9 @@ class MEDIA_EXPORT AudioDeviceListenerWin : public IMMNotificationClient {
private:
friend class AudioDeviceListenerWinTest;
+ // Minimum allowed time between device change notifications.
+ static const int kDeviceChangeLimitMs = 250;
+
// IMMNotificationClient implementation.
STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)() override;
@@ -50,14 +58,15 @@ class MEDIA_EXPORT AudioDeviceListenerWin : public IMMNotificationClient {
base::Closure listener_cb_;
ScopedComPtr<IMMDeviceEnumerator> device_enumerator_;
- std::string default_render_device_id_;
- std::string default_capture_device_id_;
- std::string default_communications_render_device_id_;
- std::string default_communications_capture_device_id_;
+
+ // Used to rate limit device change events.
+ base::TimeTicks last_device_change_time_;
// AudioDeviceListenerWin must be constructed and destructed on one thread.
base::ThreadChecker thread_checker_;
+ scoped_ptr<base::TickClock> tick_clock_;
+
DISALLOW_COPY_AND_ASSIGN(AudioDeviceListenerWin);
};
« no previous file with comments | « no previous file | media/audio/win/audio_device_listener_win.cc » ('j') | media/audio/win/audio_device_listener_win_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698