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

Side by Side Diff: media/audio/audio_manager_base.h

Issue 11233023: Handle audio device changes on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No ctor thread check. Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility>
10 11
11 #include "base/atomic_ref_count.h" 12 #include "base/atomic_ref_count.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
16 #include "media/audio/audio_manager.h" 17 #include "media/audio/audio_manager.h"
17 18
18 #if defined(OS_WIN) 19 #if defined(OS_WIN)
19 #include "base/win/scoped_com_initializer.h" 20 #include "base/win/scoped_com_initializer.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 AudioDeviceListener* listener) OVERRIDE; 98 AudioDeviceListener* listener) OVERRIDE;
98 virtual void RemoveOutputDeviceChangeListener( 99 virtual void RemoveOutputDeviceChangeListener(
99 AudioDeviceListener* listener) OVERRIDE; 100 AudioDeviceListener* listener) OVERRIDE;
100 101
101 protected: 102 protected:
102 AudioManagerBase(); 103 AudioManagerBase();
103 104
104 // TODO(dalecurtis): This must change to map both input and output parameters 105 // TODO(dalecurtis): This must change to map both input and output parameters
105 // to a single dispatcher, otherwise on a device state change we'll just get 106 // to a single dispatcher, otherwise on a device state change we'll just get
106 // the exact same invalid dispatcher. 107 // the exact same invalid dispatcher.
107 typedef std::map<AudioParameters, scoped_refptr<AudioOutputDispatcher>, 108 typedef std::map<std::pair<AudioParameters, AudioParameters>,
108 AudioParameters::Compare> 109 scoped_refptr<AudioOutputDispatcher> >
109 AudioOutputDispatchersMap; 110 AudioOutputDispatchersMap;
110 111
111 // Shuts down the audio thread and releases all the audio output dispatchers 112 // Shuts down the audio thread and releases all the audio output dispatchers
112 // on the audio thread. All audio streams should be freed before Shutdown() 113 // on the audio thread. All audio streams should be freed before Shutdown()
113 // is called. This must be called in the destructor of every AudioManagerBase 114 // is called. This must be called in the destructor of every AudioManagerBase
114 // implementation. 115 // implementation.
115 void Shutdown(); 116 void Shutdown();
116 117
117 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } 118 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; }
118 119
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // tasks which run on the audio thread even after Shutdown() has been started 161 // tasks which run on the audio thread even after Shutdown() has been started
161 // and GetMessageLoop() starts returning NULL. 162 // and GetMessageLoop() starts returning NULL.
162 scoped_refptr<base::MessageLoopProxy> message_loop_; 163 scoped_refptr<base::MessageLoopProxy> message_loop_;
163 164
164 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 165 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
165 }; 166 };
166 167
167 } // namespace media 168 } // namespace media
168 169
169 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 170 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698