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

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

Issue 17846002: Refactor the VideoCaptureDevice::Name struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 5 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
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Implementation notes: This needs to work on a variety of hardware 5 // Implementation notes: This needs to work on a variety of hardware
6 // configurations where the speed of the CPU and GPU greatly affect overall 6 // configurations where the speed of the CPU and GPU greatly affect overall
7 // performance. Spanning several threads, the process of capturing has been 7 // performance. Spanning several threads, the process of capturing has been
8 // split up into four conceptual stages: 8 // split up into four conceptual stages:
9 // 9 //
10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create( 1230 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create(
1231 const std::string& device_id) { 1231 const std::string& device_id) {
1232 // Parse device_id into render_process_id and render_view_id. 1232 // Parse device_id into render_process_id and render_view_id.
1233 int render_process_id = -1; 1233 int render_process_id = -1;
1234 int render_view_id = -1; 1234 int render_view_id = -1;
1235 if (!WebContentsCaptureUtil::ExtractTabCaptureTarget(device_id, 1235 if (!WebContentsCaptureUtil::ExtractTabCaptureTarget(device_id,
1236 &render_process_id, 1236 &render_process_id,
1237 &render_view_id)) 1237 &render_view_id))
1238 return NULL; 1238 return NULL;
1239 1239
1240 media::VideoCaptureDevice::Name name; 1240 std::string device_name;
1241 base::SStringPrintf(&name.device_name, 1241 base::SStringPrintf(&device_name,
1242 "WebContents[%.*s]", 1242 "WebContents[%.*s]",
1243 static_cast<int>(device_id.size()), device_id.data()); 1243 static_cast<int>(device_id.size()), device_id.data());
1244 name.unique_id = device_id;
1245
1246 return new WebContentsVideoCaptureDevice( 1244 return new WebContentsVideoCaptureDevice(
1247 name, render_process_id, render_view_id); 1245 media::VideoCaptureDevice::Name(device_name, device_id),
1246 render_process_id, render_view_id);
1248 } 1247 }
1249 1248
1250 void WebContentsVideoCaptureDevice::Allocate( 1249 void WebContentsVideoCaptureDevice::Allocate(
1251 int width, int height, int frame_rate, 1250 int width, int height, int frame_rate,
1252 VideoCaptureDevice::EventHandler* consumer) { 1251 VideoCaptureDevice::EventHandler* consumer) {
1253 impl_->Allocate(width, height, frame_rate, consumer); 1252 impl_->Allocate(width, height, frame_rate, consumer);
1254 } 1253 }
1255 1254
1256 void WebContentsVideoCaptureDevice::Start() { 1255 void WebContentsVideoCaptureDevice::Start() {
1257 impl_->Start(); 1256 impl_->Start();
1258 } 1257 }
1259 1258
1260 void WebContentsVideoCaptureDevice::Stop() { 1259 void WebContentsVideoCaptureDevice::Stop() {
1261 impl_->Stop(); 1260 impl_->Stop();
1262 } 1261 }
1263 1262
1264 void WebContentsVideoCaptureDevice::DeAllocate() { 1263 void WebContentsVideoCaptureDevice::DeAllocate() {
1265 impl_->DeAllocate(); 1264 impl_->DeAllocate();
1266 } 1265 }
1267 1266
1268 const media::VideoCaptureDevice::Name& 1267 const media::VideoCaptureDevice::Name&
1269 WebContentsVideoCaptureDevice::device_name() { 1268 WebContentsVideoCaptureDevice::device_name() {
1270 return device_name_; 1269 return device_name_;
1271 } 1270 }
1272 1271
1273 } // namespace content 1272 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698