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

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.h

Issue 10919095: content_browsertests will now use fake webrtc devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // MediaStreamManager is used to open/enumerate media capture devices (video 5 // MediaStreamManager is used to open/enumerate media capture devices (video
6 // supported now). Call flow: 6 // supported now). Call flow:
7 // 1. GenerateStream is called when a render process wants to use a capture 7 // 1. GenerateStream is called when a render process wants to use a capture
8 // device. 8 // device.
9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to 9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual void DevicesAccepted(const std::string& label, 141 virtual void DevicesAccepted(const std::string& label,
142 const StreamDeviceInfoArray& devices) OVERRIDE; 142 const StreamDeviceInfoArray& devices) OVERRIDE;
143 virtual void SettingsError(const std::string& label) OVERRIDE; 143 virtual void SettingsError(const std::string& label) OVERRIDE;
144 144
145 // Implements base::SystemMonitor::DevicesChangedObserver. 145 // Implements base::SystemMonitor::DevicesChangedObserver.
146 virtual void OnDevicesChanged( 146 virtual void OnDevicesChanged(
147 base::SystemMonitor::DeviceType device_type) OVERRIDE; 147 base::SystemMonitor::DeviceType device_type) OVERRIDE;
148 148
149 // Used by unit test to make sure fake devices are used instead of a real 149 // Used by unit test to make sure fake devices are used instead of a real
150 // devices, which is needed for server based testing. 150 // devices, which is needed for server based testing.
151 // TODO(xians): Remove this hack since we can create our own
152 // MediaStreamManager in our unit tests.
153 void UseFakeDevice(); 151 void UseFakeDevice();
154 152
153 // Call to have all GenerateStream calls from now on use fake devices instead
154 // of real ones. This should NOT be used in production versions of Chrome.
155 static void AlwaysUseFakeDevice();
156
155 // This object gets deleted on the UI thread after the IO thread has been 157 // This object gets deleted on the UI thread after the IO thread has been
156 // destroyed. So we need to know when IO thread is being destroyed so that 158 // destroyed. So we need to know when IO thread is being destroyed so that
157 // we can delete VideoCaptureManager and AudioInputDeviceManager. 159 // we can delete VideoCaptureManager and AudioInputDeviceManager.
158 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; 160 virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
159 161
160 private: 162 private:
161 // Contains all data needed to keep track of requests. 163 // Contains all data needed to keep track of requests.
162 struct DeviceRequest; 164 struct DeviceRequest;
163 165
164 // Cache enumerated device list. 166 // Cache enumerated device list.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 int active_enumeration_ref_count_[content::NUM_MEDIA_STREAM_DEVICE_TYPES]; 224 int active_enumeration_ref_count_[content::NUM_MEDIA_STREAM_DEVICE_TYPES];
223 225
224 // All non-closed request. 226 // All non-closed request.
225 typedef std::map<std::string, DeviceRequest> DeviceRequests; 227 typedef std::map<std::string, DeviceRequest> DeviceRequests;
226 DeviceRequests requests_; 228 DeviceRequests requests_;
227 229
228 // Hold a pointer to the IO loop to check we delete the device thread and 230 // Hold a pointer to the IO loop to check we delete the device thread and
229 // managers on the right thread. 231 // managers on the right thread.
230 MessageLoop* io_loop_; 232 MessageLoop* io_loop_;
231 233
234 // Static members.
235 static bool always_use_fake_devices_;
236
232 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 237 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
233 }; 238 };
234 239
235 } // namespace media_stream 240 } // namespace media_stream
236 241
237 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 242 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698