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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/renderer/pepper/pepper_video_capture_host.h" 5 #include "content/renderer/pepper/pepper_video_capture_host.h"
6 6
7 #include "ppapi/host/dispatch_host_message.h" 7 #include "ppapi/host/dispatch_host_message.h"
8 #include "ppapi/host/ppapi_host.h" 8 #include "ppapi/host/ppapi_host.h"
9 #include "ppapi/proxy/host_dispatcher.h" 9 #include "ppapi/proxy/host_dispatcher.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 if (instance) 243 if (instance)
244 return instance->delegate(); 244 return instance->delegate();
245 return NULL; 245 return NULL;
246 } 246 }
247 247
248 int32_t PepperVideoCaptureHost::OnOpen( 248 int32_t PepperVideoCaptureHost::OnOpen(
249 ppapi::host::HostMessageContext* context, 249 ppapi::host::HostMessageContext* context,
250 const std::string& device_id, 250 const std::string& device_id,
251 const PP_VideoCaptureDeviceInfo_Dev& requested_info, 251 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
252 uint32_t buffer_count) { 252 uint32_t buffer_count) {
253 if (platform_video_capture_) 253 if (platform_video_capture_.get())
254 return PP_ERROR_FAILED; 254 return PP_ERROR_FAILED;
255 255
256 webkit::ppapi::PluginDelegate* plugin_delegate = GetPluginDelegate(); 256 webkit::ppapi::PluginDelegate* plugin_delegate = GetPluginDelegate();
257 if (!plugin_delegate) 257 if (!plugin_delegate)
258 return PP_ERROR_FAILED; 258 return PP_ERROR_FAILED;
259 259
260 SetRequestedInfo(requested_info, buffer_count); 260 SetRequestedInfo(requested_info, buffer_count);
261 261
262 platform_video_capture_ = 262 platform_video_capture_ =
263 plugin_delegate->CreateVideoCapture(device_id, this); 263 plugin_delegate->CreateVideoCapture(device_id, this);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 DCHECK(platform_video_capture_.get()); 315 DCHECK(platform_video_capture_.get());
316 316
317 ReleaseBuffers(); 317 ReleaseBuffers();
318 // It's safe to call this regardless it's capturing or not, because 318 // It's safe to call this regardless it's capturing or not, because
319 // PepperPlatformVideoCaptureImpl maintains the state. 319 // PepperPlatformVideoCaptureImpl maintains the state.
320 platform_video_capture_->StopCapture(this); 320 platform_video_capture_->StopCapture(this);
321 return PP_OK; 321 return PP_OK;
322 } 322 }
323 323
324 int32_t PepperVideoCaptureHost::Close() { 324 int32_t PepperVideoCaptureHost::Close() {
325 if (!platform_video_capture_) 325 if (!platform_video_capture_.get())
326 return PP_OK; 326 return PP_OK;
327 327
328 StopCapture(); 328 StopCapture();
329 DCHECK(buffers_.empty()); 329 DCHECK(buffers_.empty());
330 DetachPlatformVideoCapture(); 330 DetachPlatformVideoCapture();
331 return PP_OK; 331 return PP_OK;
332 } 332 }
333 333
334 void PepperVideoCaptureHost::ReleaseBuffers() { 334 void PepperVideoCaptureHost::ReleaseBuffers() {
335 ::ppapi::ResourceTracker* tracker = HostGlobals::Get()->GetResourceTracker(); 335 ::ppapi::ResourceTracker* tracker = HostGlobals::Get()->GetResourceTracker();
(...skipping 17 matching lines...) Expand all
353 353
354 capability_.width = device_info.width; 354 capability_.width = device_info.width;
355 capability_.height = device_info.height; 355 capability_.height = device_info.height;
356 capability_.frame_rate = device_info.frames_per_second; 356 capability_.frame_rate = device_info.frames_per_second;
357 capability_.expected_capture_delay = 0; // Ignored. 357 capability_.expected_capture_delay = 0; // Ignored.
358 capability_.color = media::VideoCaptureCapability::kI420; 358 capability_.color = media::VideoCaptureCapability::kI420;
359 capability_.interlaced = false; // Ignored. 359 capability_.interlaced = false; // Ignored.
360 } 360 }
361 361
362 void PepperVideoCaptureHost::DetachPlatformVideoCapture() { 362 void PepperVideoCaptureHost::DetachPlatformVideoCapture() {
363 if (platform_video_capture_) { 363 if (platform_video_capture_.get()) {
364 platform_video_capture_->DetachEventHandler(); 364 platform_video_capture_->DetachEventHandler();
365 platform_video_capture_ = NULL; 365 platform_video_capture_ = NULL;
366 } 366 }
367 } 367 }
368 368
369 bool PepperVideoCaptureHost::SetStatus(PP_VideoCaptureStatus_Dev status, 369 bool PepperVideoCaptureHost::SetStatus(PP_VideoCaptureStatus_Dev status,
370 bool forced) { 370 bool forced) {
371 if (!forced) { 371 if (!forced) {
372 switch (status) { 372 switch (status) {
373 case PP_VIDEO_CAPTURE_STATUS_STOPPED: 373 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 PepperVideoCaptureHost::BufferInfo::BufferInfo() 416 PepperVideoCaptureHost::BufferInfo::BufferInfo()
417 : in_use(false), 417 : in_use(false),
418 data(NULL), 418 data(NULL),
419 buffer() { 419 buffer() {
420 } 420 }
421 421
422 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { 422 PepperVideoCaptureHost::BufferInfo::~BufferInfo() {
423 } 423 }
424 424
425 } // namespace content 425 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.cc ('k') | content/renderer/plugin_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698