| OLD | NEW |
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void PepperVideoCaptureHost::OnError() { | 107 void PepperVideoCaptureHost::OnError() { |
| 108 PostErrorReply(); | 108 PostErrorReply(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void PepperVideoCaptureHost::PostErrorReply() { | 111 void PepperVideoCaptureHost::PostErrorReply() { |
| 112 // It either comes because some error was detected while starting (e.g. 2 | 112 // It either comes because some error was detected while starting (e.g. 2 |
| 113 // conflicting "master" resolution), or because the browser failed to start | 113 // conflicting "master" resolution), or because the browser failed to start |
| 114 // the capture. | 114 // the capture. |
| 115 SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPED, true); | 115 SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPED, true); |
| 116 host()->SendUnsolicitedReply( | 116 host()->SendUnsolicitedReply( |
| 117 pp_resource(), PpapiPluginMsg_VideoCapture_OnError(PP_ERROR_FAILED)); | 117 pp_resource(), |
| 118 PpapiPluginMsg_VideoCapture_OnError( |
| 119 static_cast<uint32_t>(PP_ERROR_FAILED))); |
| 118 } | 120 } |
| 119 | 121 |
| 120 void PepperVideoCaptureHost::OnFrameReady( | 122 void PepperVideoCaptureHost::OnFrameReady( |
| 121 const scoped_refptr<media::VideoFrame>& frame, | 123 const scoped_refptr<media::VideoFrame>& frame, |
| 122 media::VideoCaptureFormat format) { | 124 media::VideoCaptureFormat format) { |
| 123 DCHECK(frame.get()); | 125 DCHECK(frame.get()); |
| 124 | 126 |
| 125 if (alloc_size_ != frame->coded_size() || buffers_.empty()) { | 127 if (alloc_size_ != frame->coded_size() || buffers_.empty()) { |
| 126 AllocBuffers(frame->coded_size(), format.frame_rate); | 128 AllocBuffers(frame->coded_size(), format.frame_rate); |
| 127 alloc_size_ = frame->coded_size(); | 129 alloc_size_ = frame->coded_size(); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 414 } |
| 413 | 415 |
| 414 PepperVideoCaptureHost::BufferInfo::BufferInfo() | 416 PepperVideoCaptureHost::BufferInfo::BufferInfo() |
| 415 : in_use(false), data(NULL), buffer() { | 417 : in_use(false), data(NULL), buffer() { |
| 416 } | 418 } |
| 417 | 419 |
| 418 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { | 420 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { |
| 419 } | 421 } |
| 420 | 422 |
| 421 } // namespace content | 423 } // namespace content |
| OLD | NEW |