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

Unified Diff: media/audio/mac/audio_device_listener_mac.h

Issue 11338024: Handle audio device changes on Mac (Take 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass callback directly. Created 8 years, 2 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/mac/audio_device_listener_mac.h
diff --git a/media/audio/mac/audio_device_listener_mac.h b/media/audio/mac/audio_device_listener_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..21bf10511900ee99badf42987f6c670a2a903d7f
--- /dev/null
+++ b/media/audio/mac/audio_device_listener_mac.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_MAC_AUDIO_DEVICE_LISTENER_MAC_H_
+#define MEDIA_AUDIO_MAC_AUDIO_DEVICE_LISTENER_MAC_H_
+
+#include "base/callback.h"
+#include "base/gtest_prod_util.h"
+#include "base/threading/thread_checker.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+// Listens for default device changes and forwards them to AudioManagerMac so it
+// can notify downstream clients. Only output device changes are supported
+// currently.
+class MEDIA_EXPORT AudioDeviceListenerMac {
+ public:
+ // The listener callback may be called from a system level multimedia thread,
+ // thus the callee must be thread safe. |listener_cb| is a permanent callback
+ // and must outlive AudioDeviceListenerWin. A |listener_cb| call may be in
+ // progress while AudioDeviceListenerMac is destroyed, but no new calls will
+ // occur after destruction.
+ explicit AudioDeviceListenerMac(base::Closure* listener_cb);
+ ~AudioDeviceListenerMac();
+
+ private:
+ base::Closure* listener_cb_;
scherkus (not reviewing) 2012/10/31 23:17:22 what the!? just make a copy
DaleCurtis 2012/11/01 00:16:33 Nope, we want the callback to outlive AudioDeviceL
scherkus (not reviewing) 2012/11/01 00:47:48 This concern still feels hinged on not knowing if
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioDeviceListenerMac);
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_MAC_AUDIO_DEVICE_LISTENER_MAC_H_
« no previous file with comments | « no previous file | media/audio/mac/audio_device_listener_mac.cc » ('j') | media/audio/mac/audio_device_listener_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698