Chromium Code Reviews| Index: content/browser/renderer_host/media/audio_input_device_manager.h |
| diff --git a/content/browser/renderer_host/media/audio_input_device_manager.h b/content/browser/renderer_host/media/audio_input_device_manager.h |
| index 96bff65679102dd59554b1e2d057e1223cf1c2c6..d871bca9f202fc39be4cbdcf400e0c61486ce229 100644 |
| --- a/content/browser/renderer_host/media/audio_input_device_manager.h |
| +++ b/content/browser/renderer_host/media/audio_input_device_manager.h |
| @@ -6,8 +6,8 @@ |
| // communicates with MediaStreamManager and AudioInputRendererHost on the |
| // browser IO thread, handles queries like enumerate/open/close from |
| // MediaStreamManager and start/stop from AudioInputRendererHost. |
| - |
| -// All the queries and work are handled on the IO thread. |
| +// The work for enumerate/open/close is handled asynchronously on Media Stream |
| +// device thread, while start/stop are synchronous API on IO thread. |
|
tommi (sloooow) - chröme
2012/07/02 13:36:36
are synchronous on the IO thread.
no longer working on chromium
2012/07/04 12:35:25
Done.
|
| #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ |
| #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ |
| @@ -21,10 +21,6 @@ |
| #include "content/common/media/media_stream_options.h" |
| #include "media/audio/audio_device_name.h" |
| -namespace media { |
| -class AudioManager; |
| -} |
| - |
| namespace media_stream { |
| class AudioInputDeviceManagerEventHandler; |
| @@ -41,7 +37,8 @@ class CONTENT_EXPORT AudioInputDeviceManager |
| static const int kInvalidSessionId; |
| static const char kInvalidDeviceId[]; |
| - explicit AudioInputDeviceManager(media::AudioManager* audio_manager); |
| + explicit AudioInputDeviceManager( |
| + scoped_refptr<base::MessageLoopProxy> message_loop); |
|
tommi (sloooow) - chröme
2012/07/02 13:36:36
why scoped_refptr<> here? instead just do:
explic
tommi (sloooow) - chröme
2012/07/02 13:36:36
add a comment here about what message loop this is
no longer working on chromium
2012/07/04 12:35:25
Done with changing the name to device_loop.
I hav
no longer working on chromium
2012/07/04 12:35:25
Done.
|
| // MediaStreamProvider implementation, called on IO thread. |
| virtual void Register(MediaStreamProviderListener* listener) OVERRIDE; |
| @@ -61,20 +58,32 @@ class CONTENT_EXPORT AudioInputDeviceManager |
| friend class base::RefCountedThreadSafe<AudioInputDeviceManager>; |
| virtual ~AudioInputDeviceManager(); |
| + // Executed on media stream device thread. |
| + void EnumerateOnDeviceThread(); |
| + void OpenOnDeviceThread(int session_id, const StreamDeviceInfo& device); |
| + void CloseOnDeviceThread(int session_id); |
| + |
| // Executed on IO thread to call Listener. |
| void DevicesEnumeratedOnIOThread(StreamDeviceInfoArray* devices); |
| void OpenedOnIOThread(int session_id); |
| void ClosedOnIOThread(int session_id); |
| void ErrorOnIOThread(int session_id, MediaStreamProviderError error); |
| + // Helpers. |
|
tommi (sloooow) - chröme
2012/07/02 13:36:36
this comment doesn't really add anything so just r
no longer working on chromium
2012/07/04 12:35:25
Done.
|
| + bool IsOnDeviceThread() const; |
| + |
| + // Only accessed on Browser::IO thread. |
| MediaStreamProviderListener* listener_; |
| int next_capture_session_id_; |
| typedef std::map<int, AudioInputDeviceManagerEventHandler*> EventHandlerMap; |
| EventHandlerMap event_handlers_; |
| + |
| + // Only accessed from media stream device thread. |
| typedef std::map<int, media::AudioDeviceName> AudioInputDeviceMap; |
| AudioInputDeviceMap devices_; |
| - // TODO(tommi): Is it necessary to store this as a member? |
| - media::AudioManager* audio_manager_; |
| + |
| + // The message loop of media stream device thread that this object runs on. |
| + scoped_refptr<base::MessageLoopProxy> message_loop_; |
|
tommi (sloooow) - chröme
2012/07/02 13:36:36
device_loop_ or media_stream_loop_?
no longer working on chromium
2012/07/04 12:35:25
Done.
|
| DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager); |
| }; |