| 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" |
| 11 #include "content/renderer/pepper/pepper_media_device_manager.h" | 11 #include "content/renderer/pepper/pepper_media_device_manager.h" |
| 12 #include "content/renderer/pepper/pepper_video_capture_host.h" | 12 #include "content/renderer/pepper/pepper_video_capture_host.h" |
| 13 #include "content/renderer/render_thread_impl.h" | 13 #include "content/renderer/render_thread_impl.h" |
| 14 #include "content/renderer/render_view_impl.h" | 14 #include "content/renderer/render_view_impl.h" |
| 15 #include "media/video/capture/video_capture_proxy.h" | 15 #include "media/video/capture/video_capture_proxy.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 PepperPlatformVideoCapture::PepperPlatformVideoCapture( | 20 PepperPlatformVideoCapture::PepperPlatformVideoCapture( |
| 21 const base::WeakPtr<RenderViewImpl>& render_view, | 21 const base::WeakPtr<RenderViewImpl>& render_view, |
| 22 const std::string& device_id, | 22 const std::string& device_id, |
| 23 const GURL& document_url, | 23 const GURL& document_url, |
| 24 PepperVideoCaptureHost* handler) | 24 PepperVideoCaptureHost* handler) |
| 25 : render_view_(render_view), | 25 : render_view_(render_view), |
| 26 device_id_(device_id), | 26 device_id_(device_id), |
| 27 session_id_(0), | 27 session_id_(0), |
| 28 handler_proxy_(new media::VideoCaptureHandlerProxy( | 28 handler_proxy_(new media::VideoCaptureHandlerProxy( |
| 29 this, base::MessageLoopProxy::current())), | 29 this, |
| 30 base::MessageLoopProxy::current())), |
| 30 handler_(handler), | 31 handler_(handler), |
| 31 unbalanced_start_(false), | 32 unbalanced_start_(false), |
| 32 pending_open_device_(false), | 33 pending_open_device_(false), |
| 33 pending_open_device_id_(-1) { | 34 pending_open_device_id_(-1) { |
| 34 // We need to open the device and obtain the label and session ID before | 35 // We need to open the device and obtain the label and session ID before |
| 35 // initializing. | 36 // initializing. |
| 36 if (render_view_.get()) { | 37 if (render_view_.get()) { |
| 37 pending_open_device_id_ = GetMediaDeviceManager()->OpenDevice( | 38 pending_open_device_id_ = GetMediaDeviceManager()->OpenDevice( |
| 38 PP_DEVICETYPE_DEV_VIDEOCAPTURE, | 39 PP_DEVICETYPE_DEV_VIDEOCAPTURE, |
| 39 device_id, | 40 device_id, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 label_ = label; | 166 label_ = label; |
| 166 session_id_ = GetMediaDeviceManager()->GetSessionID( | 167 session_id_ = GetMediaDeviceManager()->GetSessionID( |
| 167 PP_DEVICETYPE_DEV_VIDEOCAPTURE, label); | 168 PP_DEVICETYPE_DEV_VIDEOCAPTURE, label); |
| 168 Initialize(); | 169 Initialize(); |
| 169 } | 170 } |
| 170 | 171 |
| 171 if (handler_) | 172 if (handler_) |
| 172 handler_->OnInitialized(this, succeeded); | 173 handler_->OnInitialized(this, succeeded); |
| 173 } | 174 } |
| 174 | 175 |
| 175 PepperMediaDeviceManager* | 176 PepperMediaDeviceManager* PepperPlatformVideoCapture::GetMediaDeviceManager() { |
| 176 PepperPlatformVideoCapture::GetMediaDeviceManager() { | |
| 177 return PepperMediaDeviceManager::GetForRenderView(render_view_.get()); | 177 return PepperMediaDeviceManager::GetForRenderView(render_view_.get()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace content | 180 } // namespace content |
| OLD | NEW |