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

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

Issue 29423003: Added video capture capabilities retrieval and caching to VideoCaptureManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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
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 // VideoCaptureManager is used to open/close, start/stop, enumerate available 5 // VideoCaptureManager is used to open/close, start/stop, enumerate available
6 // video capture devices, and manage VideoCaptureController's. 6 // video capture devices, and manage VideoCaptureController's.
7 // All functions are expected to be called from Browser::IO thread. Some helper 7 // All functions are expected to be called from Browser::IO thread. Some helper
8 // functions (*OnDeviceThread) will dispatch operations to the device thread. 8 // functions (*OnDeviceThread) will dispatch operations to the device thread.
9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. 9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice.
10 // A device can only be opened once. 10 // A device can only be opened once.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const DoneCB& done_cb); 75 const DoneCB& done_cb);
76 76
77 // Called by VideoCaptureHost to remove |client_handler|. If this is the last 77 // Called by VideoCaptureHost to remove |client_handler|. If this is the last
78 // client of the device, the |controller| and its VideoCaptureDevice may be 78 // client of the device, the |controller| and its VideoCaptureDevice may be
79 // destroyed. The client must not access |controller| after calling this 79 // destroyed. The client must not access |controller| after calling this
80 // function. 80 // function.
81 void StopCaptureForClient(VideoCaptureController* controller, 81 void StopCaptureForClient(VideoCaptureController* controller,
82 VideoCaptureControllerID client_id, 82 VideoCaptureControllerID client_id,
83 VideoCaptureControllerEventHandler* client_handler); 83 VideoCaptureControllerEventHandler* client_handler);
84 84
85 // Retrieve the available capture capabilities for a particular device. The
86 // capabilities are cached during GetAvailableDevicesOnDeviceThread() and
87 // updated on DoStartDeviceOnDeviceThread(). The call is synchronous.
88 const media::VideoCaptureCapabilities* EnumerateDeviceCapabilities(
89 const StreamDeviceInfo& device_info);
90
85 private: 91 private:
86 virtual ~VideoCaptureManager(); 92 virtual ~VideoCaptureManager();
87 struct DeviceEntry; 93 struct DeviceEntry;
88 94
89 // Check to see if |entry| has no clients left on its controller. If so, 95 // Check to see if |entry| has no clients left on its controller. If so,
90 // remove it from the list of devices, and delete it asynchronously. |entry| 96 // remove it from the list of devices, and delete it asynchronously. |entry|
91 // may be freed by this function. 97 // may be freed by this function.
92 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry); 98 void DestroyDeviceEntryIfNoClients(DeviceEntry* entry);
93 99
94 // Helpers to report an event to our Listener. 100 // Helpers to report an event to our Listener.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Set to true if using fake video capture devices for testing, false by 176 // Set to true if using fake video capture devices for testing, false by
171 // default. This is only used for the MEDIA_DEVICE_VIDEO_CAPTURE device type. 177 // default. This is only used for the MEDIA_DEVICE_VIDEO_CAPTURE device type.
172 bool use_fake_device_; 178 bool use_fake_device_;
173 179
174 // We cache the enumerated video capture devices in 180 // We cache the enumerated video capture devices in
175 // GetAvailableDevicesOnDeviceThread() and then later look up the requested ID 181 // GetAvailableDevicesOnDeviceThread() and then later look up the requested ID
176 // when a device is created in DoStartDeviceOnDeviceThread(). Used only on the 182 // when a device is created in DoStartDeviceOnDeviceThread(). Used only on the
177 // device thread. 183 // device thread.
178 media::VideoCaptureDevice::Names video_capture_devices_; 184 media::VideoCaptureDevice::Names video_capture_devices_;
179 185
186 // Local cache of video capture capabilities, indexed by unique id. It is
187 // created in GetAvailableDevicesOnDeviceThread(), updated in
188 // DoStartDeviceOnDeviceThread() and retrieved for a particular device id in
189 // EnumerateDeviceCapabilities(), read only.
190 std::map<std::string, media::VideoCaptureCapabilities>
191 video_capture_capabilities_;
192
180 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); 193 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager);
181 }; 194 };
182 195
183 } // namespace content 196 } // namespace content
184 197
185 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 198 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698