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

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

Issue 23551011: From Video Capture, abolish OnFrameInfo and enable resolution changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Two more comment fixes. Created 7 years, 2 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_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
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_) {
69 unbalanced_start_ = false; 69 unbalanced_start_ = false;
70 video_capture_->StopCapture(handler_proxy_.get()); 70 video_capture_->StopCapture(handler_proxy_.get());
71 } 71 }
72 } 72 }
73 73
74 bool PepperPlatformVideoCapture::CaptureStarted() { 74 bool PepperPlatformVideoCapture::CaptureStarted() {
75 return handler_proxy_->state().started; 75 return handler_proxy_->state().started;
76 } 76 }
77 77
78 int PepperPlatformVideoCapture::CaptureWidth() {
79 return handler_proxy_->state().width;
80 }
81
82 int PepperPlatformVideoCapture::CaptureHeight() {
83 return handler_proxy_->state().height;
84 }
85
86 int PepperPlatformVideoCapture::CaptureFrameRate() { 78 int PepperPlatformVideoCapture::CaptureFrameRate() {
87 return handler_proxy_->state().frame_rate; 79 return handler_proxy_->state().frame_rate;
88 } 80 }
89 81
90 void PepperPlatformVideoCapture::DetachEventHandler() { 82 void PepperPlatformVideoCapture::DetachEventHandler() {
91 handler_ = NULL; 83 handler_ = NULL;
92 StopCapture(NULL); 84 StopCapture(NULL);
93 85
94 if (video_capture_) { 86 if (video_capture_) {
95 VideoCaptureImplManager* manager = 87 VideoCaptureImplManager* manager =
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 Release(); // Balance the AddRef() in StartCapture(). 131 Release(); // Balance the AddRef() in StartCapture().
140 } 132 }
141 133
142 void PepperPlatformVideoCapture::OnFrameReady( 134 void PepperPlatformVideoCapture::OnFrameReady(
143 VideoCapture* capture, 135 VideoCapture* capture,
144 const scoped_refptr<media::VideoFrame>& frame) { 136 const scoped_refptr<media::VideoFrame>& frame) {
145 if (handler_) 137 if (handler_)
146 handler_->OnFrameReady(capture, frame); 138 handler_->OnFrameReady(capture, frame);
147 } 139 }
148 140
149 void PepperPlatformVideoCapture::OnDeviceInfoReceived(
150 VideoCapture* capture,
151 const media::VideoCaptureParams& device_info) {
152 if (handler_)
153 handler_->OnDeviceInfoReceived(capture, device_info);
154 }
155
156 PepperPlatformVideoCapture::~PepperPlatformVideoCapture() { 141 PepperPlatformVideoCapture::~PepperPlatformVideoCapture() {
157 DCHECK(!video_capture_); 142 DCHECK(!video_capture_);
158 DCHECK(label_.empty()); 143 DCHECK(label_.empty());
159 DCHECK(!pending_open_device_); 144 DCHECK(!pending_open_device_);
160 } 145 }
161 146
162 void PepperPlatformVideoCapture::Initialize() { 147 void PepperPlatformVideoCapture::Initialize() {
163 VideoCaptureImplManager* manager = 148 VideoCaptureImplManager* manager =
164 RenderThreadImpl::current()->video_capture_impl_manager(); 149 RenderThreadImpl::current()->video_capture_impl_manager();
165 video_capture_ = manager->AddDevice(session_id_, handler_proxy_.get()); 150 video_capture_ = manager->AddDevice(session_id_, handler_proxy_.get());
(...skipping 16 matching lines...) Expand all
182 if (handler_) 167 if (handler_)
183 handler_->OnInitialized(this, succeeded); 168 handler_->OnInitialized(this, succeeded);
184 } 169 }
185 170
186 PepperMediaDeviceManager* 171 PepperMediaDeviceManager*
187 PepperPlatformVideoCapture::GetMediaDeviceManager() { 172 PepperPlatformVideoCapture::GetMediaDeviceManager() {
188 return PepperMediaDeviceManager::GetForRenderView(render_view_.get()); 173 return PepperMediaDeviceManager::GetForRenderView(render_view_.get());
189 } 174 }
190 175
191 } // namespace content 176 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698