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

Unified Diff: media/audio/win/audio_manager_win.cc

Issue 11233023: Handle audio device changes on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments! Unit tests! 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/win/audio_manager_win.cc
diff --git a/media/audio/win/audio_manager_win.cc b/media/audio/win/audio_manager_win.cc
index 4449d150d14019ae05a71f8aa2d8b77642cd5638..b1110b36d83025e1774cad765a2ddb3a050c0764 100644
--- a/media/audio/win/audio_manager_win.cc
+++ b/media/audio/win/audio_manager_win.cc
@@ -10,10 +10,13 @@
#include <mmsystem.h>
#include <setupapi.h>
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
@@ -123,6 +126,11 @@ bool AudioManagerWin::HasAudioInputDevices() {
return (::waveInGetNumDevs() != 0);
}
+void AudioManagerWin::InitializeOnAudioThread() {
+ // AudioDeviceListenerWin must be initialized on a COM thread.
+ output_device_listener_.reset(new AudioDeviceListenerWin(this));
+}
+
string16 AudioManagerWin::GetAudioInputDeviceModel() {
// Get the default audio capture device and its device interface name.
DWORD device_id = 0;
@@ -345,4 +353,14 @@ AudioParameters AudioManagerWin::GetPreferredLowLatencyOutputStreamParameters(
sample_rate, bits_per_sample, GetAudioHardwareBufferSize());
}
+void AudioManagerWin::OnDeviceChange() {
+ // Only fire device changes if low latency output is supported.
+ if (!media::IsWASAPISupported())
scherkus (not reviewing) 2012/10/24 04:27:09 This is impossible because your check for the equi
DaleCurtis 2012/10/24 19:27:29 Done.
+ return;
+
+ GetMessageLoop()->PostTask(FROM_HERE, base::Bind(
+ &AudioManagerWin::NotifyAllOutputDeviceChangeListeners,
+ base::Unretained(this)));
+}
+
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698