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

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

Issue 248113003: Fix for closing the desktop sharing notification bar when the shared window is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 VideoCaptureControllerID client_id, 72 VideoCaptureControllerID client_id,
73 VideoCaptureControllerEventHandler* client_handler, 73 VideoCaptureControllerEventHandler* client_handler,
74 const DoneCB& done_cb); 74 const DoneCB& done_cb);
75 75
76 // Called by VideoCaptureHost to remove |client_handler|. If this is the last 76 // Called by VideoCaptureHost to remove |client_handler|. If this is the last
77 // client of the device, the |controller| and its VideoCaptureDevice may be 77 // client of the device, the |controller| and its VideoCaptureDevice may be
78 // destroyed. The client must not access |controller| after calling this 78 // destroyed. The client must not access |controller| after calling this
79 // function. 79 // function.
80 void StopCaptureForClient(VideoCaptureController* controller, 80 void StopCaptureForClient(VideoCaptureController* controller,
81 VideoCaptureControllerID client_id, 81 VideoCaptureControllerID client_id,
82 VideoCaptureControllerEventHandler* client_handler); 82 VideoCaptureControllerEventHandler* client_handler,
83 bool aborted_due_to_error);
83 84
84 // Retrieves all capture supported formats for a particular device. Returns 85 // Retrieves all capture supported formats for a particular device. Returns
85 // false if the |capture_session_id| is not found. The supported formats are 86 // false if the |capture_session_id| is not found. The supported formats are
86 // cached during device(s) enumeration, and depending on the underlying 87 // cached during device(s) enumeration, and depending on the underlying
87 // implementation, could be an empty list. 88 // implementation, could be an empty list.
88 bool GetDeviceSupportedFormats( 89 bool GetDeviceSupportedFormats(
89 media::VideoCaptureSessionId capture_session_id, 90 media::VideoCaptureSessionId capture_session_id,
90 media::VideoCaptureFormats* supported_formats); 91 media::VideoCaptureFormats* supported_formats);
91 92
92 // Retrieves the format(s) currently in use. Returns false if the 93 // Retrieves the format(s) currently in use. Returns false if the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 DeviceEntry* GetDeviceEntryForMediaStreamDevice( 141 DeviceEntry* GetDeviceEntryForMediaStreamDevice(
141 const MediaStreamDevice& device_info); 142 const MediaStreamDevice& device_info);
142 143
143 // Find a DeviceEntry entry for the indicated session, creating a fresh one 144 // Find a DeviceEntry entry for the indicated session, creating a fresh one
144 // if necessary. Returns NULL if the session id is invalid. 145 // if necessary. Returns NULL if the session id is invalid.
145 DeviceEntry* GetOrCreateDeviceEntry( 146 DeviceEntry* GetOrCreateDeviceEntry(
146 media::VideoCaptureSessionId capture_session_id); 147 media::VideoCaptureSessionId capture_session_id);
147 148
148 // Find the DeviceEntry that owns a particular controller pointer. 149 // Find the DeviceEntry that owns a particular controller pointer.
149 DeviceEntry* GetDeviceEntryForController( 150 DeviceEntry* GetDeviceEntryForController(
150 const VideoCaptureController* controller); 151 const VideoCaptureController* controller) const;
151 152
152 bool IsOnDeviceThread() const; 153 bool IsOnDeviceThread() const;
153 154
154 // Queries the Names of the devices in the system; the formats supported by 155 // Queries the Names of the devices in the system; the formats supported by
155 // the new devices are also queried, and consolidated with the copy of the 156 // the new devices are also queried, and consolidated with the copy of the
156 // local device info cache passed. The consolidated list of devices and 157 // local device info cache passed. The consolidated list of devices and
157 // supported formats is returned. 158 // supported formats is returned.
158 DeviceInfos GetAvailableDevicesInfoOnDeviceThread( 159 DeviceInfos GetAvailableDevicesInfoOnDeviceThread(
159 MediaStreamType stream_type, 160 MediaStreamType stream_type,
160 const DeviceInfos& old_device_info_cache); 161 const DeviceInfos& old_device_info_cache);
(...skipping 21 matching lines...) Expand all
182 media::VideoCaptureSessionId session_id, 183 media::VideoCaptureSessionId session_id,
183 gfx::NativeViewId window_id); 184 gfx::NativeViewId window_id);
184 185
185 // The message loop of media stream device thread, where VCD's live. 186 // The message loop of media stream device thread, where VCD's live.
186 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; 187 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
187 188
188 // Only accessed on Browser::IO thread. 189 // Only accessed on Browser::IO thread.
189 MediaStreamProviderListener* listener_; 190 MediaStreamProviderListener* listener_;
190 media::VideoCaptureSessionId new_capture_session_id_; 191 media::VideoCaptureSessionId new_capture_session_id_;
191 192
193 typedef std::map<media::VideoCaptureSessionId, MediaStreamDevice> SessionMap;
192 // An entry is kept in this map for every session that has been created via 194 // An entry is kept in this map for every session that has been created via
193 // the Open() entry point. The keys are session_id's. This map is used to 195 // the Open() entry point. The keys are session_id's. This map is used to
194 // determine which device to use when StartCaptureForClient() occurs. Used 196 // determine which device to use when StartCaptureForClient() occurs. Used
195 // only on the IO thread. 197 // only on the IO thread.
196 std::map<media::VideoCaptureSessionId, MediaStreamDevice> sessions_; 198 SessionMap sessions_;
197 199
198 // An entry, kept in a map, that owns a VideoCaptureDevice and its associated 200 // An entry, kept in a map, that owns a VideoCaptureDevice and its associated
199 // VideoCaptureController. VideoCaptureManager owns all VideoCaptureDevices 201 // VideoCaptureController. VideoCaptureManager owns all VideoCaptureDevices
200 // and VideoCaptureControllers and is responsible for deleting the instances 202 // and VideoCaptureControllers and is responsible for deleting the instances
201 // when they are not used any longer. 203 // when they are not used any longer.
202 // 204 //
203 // The set of currently started VideoCaptureDevice and VideoCaptureController 205 // The set of currently started VideoCaptureDevice and VideoCaptureController
204 // objects is only accessed from IO thread, though the DeviceEntry instances 206 // objects is only accessed from IO thread, though the DeviceEntry instances
205 // themselves may visit to the device thread for device creation and 207 // themselves may visit to the device thread for device creation and
206 // destruction. 208 // destruction.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Accessed on the device thread only. 240 // Accessed on the device thread only.
239 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> 241 std::map<media::VideoCaptureSessionId, gfx::NativeViewId>
240 notification_window_ids_; 242 notification_window_ids_;
241 243
242 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); 244 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager);
243 }; 245 };
244 246
245 } // namespace content 247 } // namespace content
246 248
247 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 249 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698