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

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

Issue 10912004: Begin adding support for tab mirroring via the MediaStream audio/video capturing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add CONTENT_EXPORT to resolve linker issues on components builds. Also, IWYU. Created 8 years, 4 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/media_stream_manager.h
diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h
index bb407cea0a373851c4a85a058f1fdd5b3730a0a1..aef6f7d79ffdc338f25c3f4695c2c08e88cd5b10 100644
--- a/content/browser/renderer_host/media/media_stream_manager.h
+++ b/content/browser/renderer_host/media/media_stream_manager.h
@@ -24,7 +24,6 @@
#include <map>
#include <string>
-#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -44,6 +43,10 @@ class ScopedCOMInitializer;
}
}
+namespace media {
+class AudioManager;
+}
+
namespace media_stream {
class AudioInputDeviceManager;
@@ -76,24 +79,21 @@ class CONTENT_EXPORT MediaStreamManager
public SettingsRequester,
public base::SystemMonitor::DevicesChangedObserver {
public:
- // This class takes the ownerships of the |audio_input_device_manager|
- // and |video_capture_manager|.
- MediaStreamManager(AudioInputDeviceManager* audio_input_device_manager,
- VideoCaptureManager* video_capture_manager);
-
+ MediaStreamManager();
virtual ~MediaStreamManager();
- // Used to access VideoCaptureManager.
- VideoCaptureManager* video_capture_manager();
+ // Used to access the VideoCaptureManager for the given |stream_type|.
+ VideoCaptureManager* GetVideoCaptureManager(MediaStreamType stream_type);
- // Used to access AudioInputDeviceManager.
- AudioInputDeviceManager* audio_input_device_manager();
+ // Used to access the AudioInputDeviceManager for the given |stream_type|.
+ AudioInputDeviceManager* GetAudioInputDeviceManager(
+ MediaStreamType stream_type);
// GenerateStream opens new media devices according to |components|. It
// creates a new request which is identified by a unique |label| that's
// returned to the caller.
void GenerateStream(MediaStreamRequester* requester, int render_process_id,
- int render_view_id, const StreamOptions& options,
+ int render_view_id, const StreamOptions& components,
const GURL& security_origin, std::string* label);
// Cancel generate stream.
@@ -146,6 +146,11 @@ class CONTENT_EXPORT MediaStreamManager
virtual void OnDevicesChanged(
base::SystemMonitor::DeviceType device_type) OVERRIDE;
+ // Used by unit tests to provide an alternate AudioManager instance.
+ // Normally, BrowserMainLoop::GetAudioManager() is used to gain access to the
+ // AudioManager.
no longer working on chromium 2012/08/31 13:38:23 Add a comment to specify that this function needs
miu 2012/09/01 01:32:00 Done.
+ void UseAudioManager(media::AudioManager* audio_manager);
no longer working on chromium 2012/08/31 13:38:23 nit, SetAudioManager?
miu 2012/09/01 01:32:00 Done.
+
// Used by unit test to make sure fake devices are used instead of a real
// devices, which is needed for server based testing.
// TODO(xians): Remove this hack since we can create our own
@@ -187,9 +192,10 @@ class CONTENT_EXPORT MediaStreamManager
bool HasEnumerationRequest();
void ClearEnumerationCache(EnumerationCache* cache);
- // Helper to ensure the device thread and pass the message loop to device
- // managers, it also register itself as the listener to the device managers.
- void EnsureDeviceThreadAndListener();
+ // Helper to create the device manager for the given stream_type, if needed.
+ // Auto-starts the device thread and registers this as a listener with the
+ // device managers.
+ void EnsureDeviceManagerStarted(MediaStreamType stream_type);
// Sends cached device list to a client corresponding to the request
// identified by |label|.
@@ -206,16 +212,20 @@ class CONTENT_EXPORT MediaStreamManager
scoped_ptr<base::Thread> device_thread_;
scoped_ptr<MediaStreamDeviceSettings> device_settings_;
- scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_;
- scoped_refptr<VideoCaptureManager> video_capture_manager_;
+
+ media::AudioManager* audio_manager_; // not owned
+
+ // Device managers, instantiated on-demand.
+ scoped_refptr<MediaStreamProvider> device_manager_[
+ content::NUM_MEDIA_STREAM_DEVICE_TYPES];
// Indicator of device monitoring state.
bool monitoring_started_;
// Stores most recently enumerated device lists. The cache is cleared when
// monitoring is stopped or there is no request for that type of device.
- EnumerationCache audio_enumeration_cache_;
- EnumerationCache video_enumeration_cache_;
+ EnumerationCache user_audio_enumeration_cache_;
+ EnumerationCache user_video_enumeration_cache_;
// Keeps track of live enumeration commands sent to VideoCaptureManager or
// AudioInputDeviceManager, in order to only enumerate when necessary.

Powered by Google App Engine
This is Rietveld 408576698