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

Unified Diff: content/browser/renderer_host/media/audio_input_device_manager.h

Issue 10662049: Move the device enumerate/open/close work to device thread from IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor fix for the problem detected by the trybots Created 8 years, 6 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: 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..3a4215805fb6b5f41e649bad2a02086d1641068f 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.
#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,7 @@ class CONTENT_EXPORT AudioInputDeviceManager
static const int kInvalidSessionId;
static const char kInvalidDeviceId[];
- explicit AudioInputDeviceManager(media::AudioManager* audio_manager);
+ AudioInputDeviceManager(scoped_refptr<base::MessageLoopProxy> message_loop);
mflodman_chromium_OOO 2012/06/29 14:46:04 Add explicit.
no longer working on chromium 2012/07/02 08:40:49 Done.
// MediaStreamProvider implementation, called on IO thread.
virtual void Register(MediaStreamProviderListener* listener) OVERRIDE;
@@ -61,20 +57,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.
+ 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_;
DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager);
};

Powered by Google App Engine
This is Rietveld 408576698