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

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: address comments and add a test Created 6 years, 8 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 VideoCaptureControllerID client_id, 75 VideoCaptureControllerID client_id,
76 VideoCaptureControllerEventHandler* client_handler, 76 VideoCaptureControllerEventHandler* client_handler,
77 const DoneCB& done_cb); 77 const DoneCB& done_cb);
78 78
79 // Called by VideoCaptureHost to remove |client_handler|. If this is the last 79 // Called by VideoCaptureHost to remove |client_handler|. If this is the last
80 // client of the device, the |controller| and its VideoCaptureDevice may be 80 // client of the device, the |controller| and its VideoCaptureDevice may be
81 // destroyed. The client must not access |controller| after calling this 81 // destroyed. The client must not access |controller| after calling this
82 // function. 82 // function.
83 void StopCaptureForClient(VideoCaptureController* controller, 83 void StopCaptureForClient(VideoCaptureController* controller,
84 VideoCaptureControllerID client_id, 84 VideoCaptureControllerID client_id,
85 VideoCaptureControllerEventHandler* client_handler); 85 VideoCaptureControllerEventHandler* client_handler,
86 bool aborted_due_to_error);
86 87
87 // Retrieves all capture supported formats for a particular device. Returns 88 // Retrieves all capture supported formats for a particular device. Returns
88 // false if the |capture_session_id| is not found. The supported formats are 89 // false if the |capture_session_id| is not found. The supported formats are
89 // cached during device(s) enumeration, and depending on the underlying 90 // cached during device(s) enumeration, and depending on the underlying
90 // implementation, could be an empty list. 91 // implementation, could be an empty list.
91 bool GetDeviceSupportedFormats( 92 bool GetDeviceSupportedFormats(
92 media::VideoCaptureSessionId capture_session_id, 93 media::VideoCaptureSessionId capture_session_id,
93 media::VideoCaptureFormats* supported_formats); 94 media::VideoCaptureFormats* supported_formats);
94 95
95 // Retrieves the format(s) currently in use. Returns false if the 96 // Retrieves the format(s) currently in use. Returns false if the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 DeviceEntry* GetDeviceEntryForMediaStreamDevice( 139 DeviceEntry* GetDeviceEntryForMediaStreamDevice(
139 const MediaStreamDevice& device_info); 140 const MediaStreamDevice& device_info);
140 141
141 // Find a DeviceEntry entry for the indicated session, creating a fresh one 142 // Find a DeviceEntry entry for the indicated session, creating a fresh one
142 // if necessary. Returns NULL if the session id is invalid. 143 // if necessary. Returns NULL if the session id is invalid.
143 DeviceEntry* GetOrCreateDeviceEntry( 144 DeviceEntry* GetOrCreateDeviceEntry(
144 media::VideoCaptureSessionId capture_session_id); 145 media::VideoCaptureSessionId capture_session_id);
145 146
146 // Find the DeviceEntry that owns a particular controller pointer. 147 // Find the DeviceEntry that owns a particular controller pointer.
147 DeviceEntry* GetDeviceEntryForController( 148 DeviceEntry* GetDeviceEntryForController(
148 const VideoCaptureController* controller); 149 const VideoCaptureController* controller) const;
150
151 // Does the same work as StopCaptureForClient but takes DeviceEntry as the
152 // input.
153 void StopCaptureForClientInternal(
perkj_chrome 2014/04/25 14:36:45 This method doesnt seem to exist?
154 DeviceEntry* device_entry,
155 VideoCaptureControllerID client_id,
156 VideoCaptureControllerEventHandler* client_handler);
149 157
150 bool IsOnDeviceThread() const; 158 bool IsOnDeviceThread() const;
151 159
152 // Queries the Names of the devices in the system; the formats supported by 160 // Queries the Names of the devices in the system; the formats supported by
153 // the new devices are also queried, and consolidated with the copy of the 161 // the new devices are also queried, and consolidated with the copy of the
154 // local device info cache passed. The consolidated list of devices and 162 // local device info cache passed. The consolidated list of devices and
155 // supported formats is returned. 163 // supported formats is returned.
156 DeviceInfos GetAvailableDevicesInfoOnDeviceThread( 164 DeviceInfos GetAvailableDevicesInfoOnDeviceThread(
157 MediaStreamType stream_type, 165 MediaStreamType stream_type,
158 const DeviceInfos& old_device_info_cache); 166 const DeviceInfos& old_device_info_cache);
(...skipping 21 matching lines...) Expand all
180 media::VideoCaptureSessionId session_id, 188 media::VideoCaptureSessionId session_id,
181 gfx::NativeViewId window_id); 189 gfx::NativeViewId window_id);
182 190
183 // The message loop of media stream device thread, where VCD's live. 191 // The message loop of media stream device thread, where VCD's live.
184 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; 192 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
185 193
186 // Only accessed on Browser::IO thread. 194 // Only accessed on Browser::IO thread.
187 MediaStreamProviderListener* listener_; 195 MediaStreamProviderListener* listener_;
188 media::VideoCaptureSessionId new_capture_session_id_; 196 media::VideoCaptureSessionId new_capture_session_id_;
189 197
198 typedef std::map<media::VideoCaptureSessionId, MediaStreamDevice> SessionMap;
190 // An entry is kept in this map for every session that has been created via 199 // An entry is kept in this map for every session that has been created via
191 // the Open() entry point. The keys are session_id's. This map is used to 200 // the Open() entry point. The keys are session_id's. This map is used to
192 // determine which device to use when StartCaptureForClient() occurs. Used 201 // determine which device to use when StartCaptureForClient() occurs. Used
193 // only on the IO thread. 202 // only on the IO thread.
194 std::map<media::VideoCaptureSessionId, MediaStreamDevice> sessions_; 203 SessionMap sessions_;
195 204
196 // An entry, kept in a map, that owns a VideoCaptureDevice and its associated 205 // An entry, kept in a map, that owns a VideoCaptureDevice and its associated
197 // VideoCaptureController. VideoCaptureManager owns all VideoCaptureDevices 206 // VideoCaptureController. VideoCaptureManager owns all VideoCaptureDevices
198 // and VideoCaptureControllers and is responsible for deleting the instances 207 // and VideoCaptureControllers and is responsible for deleting the instances
199 // when they are not used any longer. 208 // when they are not used any longer.
200 // 209 //
201 // The set of currently started VideoCaptureDevice and VideoCaptureController 210 // The set of currently started VideoCaptureDevice and VideoCaptureController
202 // objects is only accessed from IO thread, though the DeviceEntry instances 211 // objects is only accessed from IO thread, though the DeviceEntry instances
203 // themselves may visit to the device thread for device creation and 212 // themselves may visit to the device thread for device creation and
204 // destruction. 213 // destruction.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Accessed on the device thread only. 251 // Accessed on the device thread only.
243 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> 252 std::map<media::VideoCaptureSessionId, gfx::NativeViewId>
244 notification_window_ids_; 253 notification_window_ids_;
245 254
246 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); 255 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager);
247 }; 256 };
248 257
249 } // namespace content 258 } // namespace content
250 259
251 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 260 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698