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

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

Issue 10928043: Media Related changes for TabCapture API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fixes, make tab capture skip approval. Created 8 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 | Annotate | Revision Log
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 #include "content/browser/renderer_host/media/video_capture_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 media::FakeVideoCaptureDevice::Create(vc_device_name); 166 media::FakeVideoCaptureDevice::Create(vc_device_name);
167 } else { 167 } else {
168 switch (device.stream_type) { 168 switch (device.stream_type) {
169 case content::MEDIA_DEVICE_VIDEO_CAPTURE: 169 case content::MEDIA_DEVICE_VIDEO_CAPTURE:
170 video_capture_device = 170 video_capture_device =
171 media::VideoCaptureDevice::Create(vc_device_name); 171 media::VideoCaptureDevice::Create(vc_device_name);
172 break; 172 break;
173 case content::MEDIA_TAB_VIDEO_CAPTURE: 173 case content::MEDIA_TAB_VIDEO_CAPTURE:
174 // TODO(miu): Replace this stub with the actual implementation in a 174 // TODO(miu): Replace this stub with the actual implementation in a
175 // later change. 175 // later change.
176 vc_device_name.unique_id = "/dev/video1";
perkj_chrome 2012/10/09 11:10:02 needed?
justinlin 2012/10/11 07:19:21 Yes, for now otherwise the fake device returns nul
176 video_capture_device = 177 video_capture_device =
177 media::FakeVideoCaptureDevice::Create(vc_device_name); 178 media::FakeVideoCaptureDevice::Create(vc_device_name);
178 break; 179 break;
179 default: 180 default:
180 NOTIMPLEMENTED(); 181 NOTIMPLEMENTED();
181 break; 182 break;
182 } 183 }
183 } 184 }
184 if (!video_capture_device) { 185 if (!video_capture_device) {
185 PostOnError(capture_session_id, kDeviceNotAvailable); 186 PostOnError(capture_session_id, kDeviceNotAvailable);
186 return; 187 return;
187 } 188 }
188 189
189 DeviceEntry& new_entry = devices_[capture_session_id]; 190 DeviceEntry& new_entry = devices_[capture_session_id];
190 new_entry.stream_type = device.stream_type; 191 new_entry.stream_type = device.stream_type;
191 new_entry.capture_device = video_capture_device; 192 new_entry.capture_device = video_capture_device;
193
192 PostOnOpened(device.stream_type, capture_session_id); 194 PostOnOpened(device.stream_type, capture_session_id);
193 } 195 }
194 196
195 void VideoCaptureManager::OnClose(int capture_session_id) { 197 void VideoCaptureManager::OnClose(int capture_session_id) {
196 DCHECK(IsOnDeviceThread()); 198 DCHECK(IsOnDeviceThread());
197 DVLOG(1) << "VideoCaptureManager::OnClose, id " << capture_session_id; 199 DVLOG(1) << "VideoCaptureManager::OnClose, id " << capture_session_id;
198 200
199 VideoCaptureDevices::iterator device_it = devices_.find(capture_session_id); 201 VideoCaptureDevices::iterator device_it = devices_.find(capture_session_id);
200 if (device_it == devices_.end()) { 202 if (device_it == devices_.end()) {
201 return; 203 return;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 528
527 VideoCaptureDevices::iterator dit = devices_.find(capture_session_id); 529 VideoCaptureDevices::iterator dit = devices_.find(capture_session_id);
528 if (dit != devices_.end()) { 530 if (dit != devices_.end()) {
529 return dit->second.capture_device; 531 return dit->second.capture_device;
530 } 532 }
531 } 533 }
532 return NULL; 534 return NULL;
533 } 535 }
534 536
535 } // namespace media_stream 537 } // namespace media_stream
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698