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_platform_video_capture.h" | 5 #include "content/renderer/pepper/pepper_platform_video_capture.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "content/renderer/media/video_capture_impl_manager.h" | 10 #include "content/renderer/media/video_capture_impl_manager.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 PP_DEVICETYPE_DEV_VIDEOCAPTURE, | 39 PP_DEVICETYPE_DEV_VIDEOCAPTURE, |
40 device_id, | 40 device_id, |
41 document_url, | 41 document_url, |
42 base::Bind(&PepperPlatformVideoCapture::OnDeviceOpened, this)); | 42 base::Bind(&PepperPlatformVideoCapture::OnDeviceOpened, this)); |
43 pending_open_device_ = true; | 43 pending_open_device_ = true; |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 void PepperPlatformVideoCapture::StartCapture( | 47 void PepperPlatformVideoCapture::StartCapture( |
48 media::VideoCapture::EventHandler* handler, | 48 media::VideoCapture::EventHandler* handler, |
49 const media::VideoCaptureCapability& capability) { | 49 const media::VideoCaptureParams& params) { |
50 DCHECK(handler == handler_); | 50 DCHECK(handler == handler_); |
51 | 51 |
52 if (unbalanced_start_) | 52 if (unbalanced_start_) |
53 return; | 53 return; |
54 | 54 |
55 if (video_capture_) { | 55 if (video_capture_) { |
56 unbalanced_start_ = true; | 56 unbalanced_start_ = true; |
57 AddRef(); // Will be balanced in OnRemoved(). | 57 AddRef(); // Will be balanced in OnRemoved(). |
58 video_capture_->StartCapture(handler_proxy_.get(), capability); | 58 video_capture_->StartCapture(handler_proxy_.get(), params); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void PepperPlatformVideoCapture::StopCapture( | 62 void PepperPlatformVideoCapture::StopCapture( |
63 media::VideoCapture::EventHandler* handler) { | 63 media::VideoCapture::EventHandler* handler) { |
64 DCHECK(handler == handler_); | 64 DCHECK(handler == handler_); |
65 if (!unbalanced_start_) | 65 if (!unbalanced_start_) |
66 return; | 66 return; |
67 | 67 |
68 if (video_capture_) { | 68 if (video_capture_) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 void PepperPlatformVideoCapture::OnFrameReady( | 142 void PepperPlatformVideoCapture::OnFrameReady( |
143 VideoCapture* capture, | 143 VideoCapture* capture, |
144 const scoped_refptr<media::VideoFrame>& frame) { | 144 const scoped_refptr<media::VideoFrame>& frame) { |
145 if (handler_) | 145 if (handler_) |
146 handler_->OnFrameReady(capture, frame); | 146 handler_->OnFrameReady(capture, frame); |
147 } | 147 } |
148 | 148 |
149 void PepperPlatformVideoCapture::OnDeviceInfoReceived( | 149 void PepperPlatformVideoCapture::OnDeviceInfoReceived( |
150 VideoCapture* capture, | 150 VideoCapture* capture, |
151 const media::VideoCaptureParams& device_info) { | 151 const media::VideoCaptureFormat& device_info) { |
152 if (handler_) | 152 if (handler_) |
153 handler_->OnDeviceInfoReceived(capture, device_info); | 153 handler_->OnDeviceInfoReceived(capture, device_info); |
154 } | 154 } |
155 | 155 |
156 PepperPlatformVideoCapture::~PepperPlatformVideoCapture() { | 156 PepperPlatformVideoCapture::~PepperPlatformVideoCapture() { |
157 DCHECK(!video_capture_); | 157 DCHECK(!video_capture_); |
158 DCHECK(label_.empty()); | 158 DCHECK(label_.empty()); |
159 DCHECK(!pending_open_device_); | 159 DCHECK(!pending_open_device_); |
160 } | 160 } |
161 | 161 |
(...skipping 20 matching lines...) Expand all Loading... |
182 if (handler_) | 182 if (handler_) |
183 handler_->OnInitialized(this, succeeded); | 183 handler_->OnInitialized(this, succeeded); |
184 } | 184 } |
185 | 185 |
186 PepperMediaDeviceManager* | 186 PepperMediaDeviceManager* |
187 PepperPlatformVideoCapture::GetMediaDeviceManager() { | 187 PepperPlatformVideoCapture::GetMediaDeviceManager() { |
188 return PepperMediaDeviceManager::GetForRenderView(render_view_.get()); | 188 return PepperMediaDeviceManager::GetForRenderView(render_view_.get()); |
189 } | 189 } |
190 | 190 |
191 } // namespace content | 191 } // namespace content |
OLD | NEW |