| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 timer_.Stop(); | 247 timer_.Stop(); |
| 248 | 248 |
| 249 started_ = false; | 249 started_ = false; |
| 250 | 250 |
| 251 callback.Run(); | 251 callback.Run(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void DesktopVideoCaptureMachine::UpdateCaptureSize() { | 254 void DesktopVideoCaptureMachine::UpdateCaptureSize() { |
| 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 256 if (oracle_proxy_.get() && desktop_window_) { | 256 if (oracle_proxy_.get() && desktop_window_) { |
| 257 ui::Layer* layer = desktop_window_->layer(); | 257 ui::Layer* layer = desktop_window_->layer(); |
| 258 gfx::Size capture_size = | 258 oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel( |
| 259 ui::ConvertSizeToPixel(layer, layer->bounds().size()); | 259 layer, layer->bounds().size())); |
| 260 #if defined(OS_CHROMEOS) | |
| 261 // Pad desktop capture size to multiples of 16 pixels to accommodate HW | |
| 262 // encoder. TODO(hshi): remove this hack. See http://crbug.com/402151 | |
| 263 capture_size.SetSize((capture_size.width() + 15) & ~15, | |
| 264 (capture_size.height() + 15) & ~15); | |
| 265 #endif | |
| 266 oracle_proxy_->UpdateCaptureSize(capture_size); | |
| 267 } | 260 } |
| 268 ClearCursorState(); | 261 ClearCursorState(); |
| 269 } | 262 } |
| 270 | 263 |
| 271 void DesktopVideoCaptureMachine::Capture(bool dirty) { | 264 void DesktopVideoCaptureMachine::Capture(bool dirty) { |
| 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 273 | 266 |
| 274 // Do not capture if the desktop window is already destroyed. | 267 // Do not capture if the desktop window is already destroyed. |
| 275 if (!desktop_window_) | 268 if (!desktop_window_) |
| 276 return; | 269 return; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 scoped_ptr<Client> client) { | 532 scoped_ptr<Client> client) { |
| 540 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 533 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 541 core_->AllocateAndStart(params, client.Pass()); | 534 core_->AllocateAndStart(params, client.Pass()); |
| 542 } | 535 } |
| 543 | 536 |
| 544 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 537 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
| 545 core_->StopAndDeAllocate(); | 538 core_->StopAndDeAllocate(); |
| 546 } | 539 } |
| 547 | 540 |
| 548 } // namespace content | 541 } // namespace content |
| OLD | NEW |