OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 UpdateCaptureSize(); | 207 UpdateCaptureSize(); |
208 | 208 |
209 // Start observing window events. | 209 // Start observing window events. |
210 desktop_window_->AddObserver(this); | 210 desktop_window_->AddObserver(this); |
211 | 211 |
212 // Start observing compositor updates. | 212 // Start observing compositor updates. |
213 if (desktop_window_->GetHost()) | 213 if (desktop_window_->GetHost()) |
214 desktop_window_->GetHost()->compositor()->AddObserver(this); | 214 desktop_window_->GetHost()->compositor()->AddObserver(this); |
215 | 215 |
216 // Starts timer. | 216 // Starts timer. |
217 timer_.Start(FROM_HERE, oracle_proxy_->capture_period(), | 217 timer_.Start(FROM_HERE, oracle_proxy_->min_capture_period(), |
218 base::Bind(&DesktopVideoCaptureMachine::Capture, AsWeakPtr(), | 218 base::Bind(&DesktopVideoCaptureMachine::Capture, AsWeakPtr(), |
219 false)); | 219 false)); |
220 | 220 |
221 started_ = true; | 221 started_ = true; |
222 return true; | 222 return true; |
223 } | 223 } |
224 | 224 |
225 void DesktopVideoCaptureMachine::Stop(const base::Closure& callback) { | 225 void DesktopVideoCaptureMachine::Stop(const base::Closure& callback) { |
226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
227 | 227 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return; | 259 return; |
260 | 260 |
261 scoped_refptr<media::VideoFrame> frame; | 261 scoped_refptr<media::VideoFrame> frame; |
262 ThreadSafeCaptureOracle::CaptureFrameCallback capture_frame_cb; | 262 ThreadSafeCaptureOracle::CaptureFrameCallback capture_frame_cb; |
263 | 263 |
264 const base::TimeTicks start_time = base::TimeTicks::Now(); | 264 const base::TimeTicks start_time = base::TimeTicks::Now(); |
265 const VideoCaptureOracle::Event event = | 265 const VideoCaptureOracle::Event event = |
266 dirty ? VideoCaptureOracle::kCompositorUpdate | 266 dirty ? VideoCaptureOracle::kCompositorUpdate |
267 : VideoCaptureOracle::kTimerPoll; | 267 : VideoCaptureOracle::kTimerPoll; |
268 if (oracle_proxy_->ObserveEventAndDecideCapture( | 268 if (oracle_proxy_->ObserveEventAndDecideCapture( |
269 event, start_time, &frame, &capture_frame_cb)) { | 269 event, gfx::Rect(), start_time, &frame, &capture_frame_cb)) { |
270 scoped_ptr<cc::CopyOutputRequest> request = | 270 scoped_ptr<cc::CopyOutputRequest> request = |
271 cc::CopyOutputRequest::CreateRequest( | 271 cc::CopyOutputRequest::CreateRequest( |
272 base::Bind(&DesktopVideoCaptureMachine::DidCopyOutput, | 272 base::Bind(&DesktopVideoCaptureMachine::DidCopyOutput, |
273 AsWeakPtr(), frame, start_time, capture_frame_cb)); | 273 AsWeakPtr(), frame, start_time, capture_frame_cb)); |
274 gfx::Rect window_rect = | 274 gfx::Rect window_rect = |
275 ui::ConvertRectToPixel(desktop_window_->layer(), | 275 ui::ConvertRectToPixel(desktop_window_->layer(), |
276 gfx::Rect(desktop_window_->bounds().width(), | 276 gfx::Rect(desktop_window_->bounds().width(), |
277 desktop_window_->bounds().height())); | 277 desktop_window_->bounds().height())); |
278 request->set_area(window_rect); | 278 request->set_area(window_rect); |
279 desktop_window_->layer()->RequestCopyOfOutput(request.Pass()); | 279 desktop_window_->layer()->RequestCopyOfOutput(request.Pass()); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 scoped_ptr<Client> client) { | 524 scoped_ptr<Client> client) { |
525 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 525 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
526 core_->AllocateAndStart(params, client.Pass()); | 526 core_->AllocateAndStart(params, client.Pass()); |
527 } | 527 } |
528 | 528 |
529 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 529 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
530 core_->StopAndDeAllocate(); | 530 core_->StopAndDeAllocate(); |
531 } | 531 } |
532 | 532 |
533 } // namespace content | 533 } // namespace content |
OLD | NEW |