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

Side by Side Diff: content/renderer/pepper/pepper_video_capture_host.cc

Issue 22876027: Consolidate duplicated frame / capability structures in video_capture_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased: changed media::VideoCaptureCapability::kI420 -> media::PIXEL_FORMAT_I420 etc. Created 7 years, 3 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
« no previous file with comments | « content/renderer/media/video_capture_message_filter_unittest.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 #include "content/renderer/pepper/pepper_video_capture_host.h" 5 #include "content/renderer/pepper/pepper_video_capture_host.h"
6 6
7 #include "content/renderer/pepper/host_globals.h" 7 #include "content/renderer/pepper/host_globals.h"
8 #include "content/renderer/pepper/pepper_media_device_manager.h" 8 #include "content/renderer/pepper/pepper_media_device_manager.h"
9 #include "content/renderer/pepper/pepper_platform_video_capture.h" 9 #include "content/renderer/pepper/pepper_platform_video_capture.h"
10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // re-use the buffer. 153 // re-use the buffer.
154 platform_video_capture_->FeedBuffer(buffer); 154 platform_video_capture_->FeedBuffer(buffer);
155 } 155 }
156 156
157 void PepperVideoCaptureHost::OnDeviceInfoReceived( 157 void PepperVideoCaptureHost::OnDeviceInfoReceived(
158 media::VideoCapture* capture, 158 media::VideoCapture* capture,
159 const media::VideoCaptureParams& device_info) { 159 const media::VideoCaptureParams& device_info) {
160 PP_VideoCaptureDeviceInfo_Dev info = { 160 PP_VideoCaptureDeviceInfo_Dev info = {
161 static_cast<uint32_t>(device_info.width), 161 static_cast<uint32_t>(device_info.width),
162 static_cast<uint32_t>(device_info.height), 162 static_cast<uint32_t>(device_info.height),
163 static_cast<uint32_t>(device_info.frame_per_second) 163 static_cast<uint32_t>(device_info.frame_rate)
164 }; 164 };
165 ReleaseBuffers(); 165 ReleaseBuffers();
166 166
167 // YUV 4:2:0 167 // YUV 4:2:0
168 int uv_width = info.width / 2; 168 int uv_width = info.width / 2;
169 int uv_height = info.height / 2; 169 int uv_height = info.height / 2;
170 size_t size = info.width * info.height + 2 * uv_width * uv_height; 170 size_t size = info.width * info.height + 2 * uv_width * uv_height;
171 171
172 ppapi::proxy::ResourceMessageReplyParams params(pp_resource(), 0); 172 ppapi::proxy::ResourceMessageReplyParams params(pp_resource(), 0);
173 173
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 void PepperVideoCaptureHost::SetRequestedInfo( 346 void PepperVideoCaptureHost::SetRequestedInfo(
347 const PP_VideoCaptureDeviceInfo_Dev& device_info, 347 const PP_VideoCaptureDeviceInfo_Dev& device_info,
348 uint32_t buffer_count) { 348 uint32_t buffer_count) {
349 // Clamp the buffer count to between 1 and |kMaxBuffers|. 349 // Clamp the buffer count to between 1 and |kMaxBuffers|.
350 buffer_count_hint_ = std::min(std::max(buffer_count, 1U), kMaxBuffers); 350 buffer_count_hint_ = std::min(std::max(buffer_count, 1U), kMaxBuffers);
351 351
352 capability_.width = device_info.width; 352 capability_.width = device_info.width;
353 capability_.height = device_info.height; 353 capability_.height = device_info.height;
354 capability_.frame_rate = device_info.frames_per_second; 354 capability_.frame_rate = device_info.frames_per_second;
355 capability_.expected_capture_delay = 0; // Ignored. 355 capability_.expected_capture_delay = 0; // Ignored.
356 capability_.color = media::VideoCaptureCapability::kI420; 356 capability_.color = media::PIXEL_FORMAT_I420;
357 capability_.interlaced = false; // Ignored. 357 capability_.interlaced = false; // Ignored.
358 } 358 }
359 359
360 void PepperVideoCaptureHost::DetachPlatformVideoCapture() { 360 void PepperVideoCaptureHost::DetachPlatformVideoCapture() {
361 if (platform_video_capture_.get()) { 361 if (platform_video_capture_.get()) {
362 platform_video_capture_->DetachEventHandler(); 362 platform_video_capture_->DetachEventHandler();
363 platform_video_capture_ = NULL; 363 platform_video_capture_ = NULL;
364 } 364 }
365 } 365 }
366 366
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 PepperVideoCaptureHost::BufferInfo::BufferInfo() 414 PepperVideoCaptureHost::BufferInfo::BufferInfo()
415 : in_use(false), 415 : in_use(false),
416 data(NULL), 416 data(NULL),
417 buffer() { 417 buffer() {
418 } 418 }
419 419
420 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { 420 PepperVideoCaptureHost::BufferInfo::~BufferInfo() {
421 } 421 }
422 422
423 } // namespace content 423 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_message_filter_unittest.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698