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

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: Review fixes 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 // TODO(justinlin): This is so we don't get a null device. Remove later.
177 vc_device_name.unique_id = "/dev/video1";
176 video_capture_device = 178 video_capture_device =
177 media::FakeVideoCaptureDevice::Create(vc_device_name); 179 media::FakeVideoCaptureDevice::Create(vc_device_name);
178 break; 180 break;
179 default: 181 default:
180 NOTIMPLEMENTED(); 182 NOTIMPLEMENTED();
181 break; 183 break;
182 } 184 }
183 } 185 }
184 if (!video_capture_device) { 186 if (!video_capture_device) {
185 PostOnError(capture_session_id, kDeviceNotAvailable); 187 PostOnError(capture_session_id, kDeviceNotAvailable);
186 return; 188 return;
187 } 189 }
188 190
189 DeviceEntry& new_entry = devices_[capture_session_id]; 191 DeviceEntry& new_entry = devices_[capture_session_id];
190 new_entry.stream_type = device.stream_type; 192 new_entry.stream_type = device.stream_type;
191 new_entry.capture_device = video_capture_device; 193 new_entry.capture_device = video_capture_device;
194
192 PostOnOpened(device.stream_type, capture_session_id); 195 PostOnOpened(device.stream_type, capture_session_id);
193 } 196 }
194 197
195 void VideoCaptureManager::OnClose(int capture_session_id) { 198 void VideoCaptureManager::OnClose(int capture_session_id) {
196 DCHECK(IsOnDeviceThread()); 199 DCHECK(IsOnDeviceThread());
197 DVLOG(1) << "VideoCaptureManager::OnClose, id " << capture_session_id; 200 DVLOG(1) << "VideoCaptureManager::OnClose, id " << capture_session_id;
198 201
199 VideoCaptureDevices::iterator device_it = devices_.find(capture_session_id); 202 VideoCaptureDevices::iterator device_it = devices_.find(capture_session_id);
200 if (device_it == devices_.end()) { 203 if (device_it == devices_.end()) {
201 return; 204 return;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 529
527 VideoCaptureDevices::iterator dit = devices_.find(capture_session_id); 530 VideoCaptureDevices::iterator dit = devices_.find(capture_session_id);
528 if (dit != devices_.end()) { 531 if (dit != devices_.end()) {
529 return dit->second.capture_device; 532 return dit->second.capture_device;
530 } 533 }
531 } 534 }
532 return NULL; 535 return NULL;
533 } 536 }
534 537
535 } // namespace media_stream 538 } // namespace media_stream
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698