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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 started_ = false; | 239 started_ = false; |
240 | 240 |
241 callback.Run(); | 241 callback.Run(); |
242 } | 242 } |
243 | 243 |
244 void DesktopVideoCaptureMachine::UpdateCaptureSize() { | 244 void DesktopVideoCaptureMachine::UpdateCaptureSize() { |
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
246 if (oracle_proxy_ && desktop_window_) { | 246 if (oracle_proxy_ && desktop_window_) { |
247 ui::Layer* layer = desktop_window_->layer(); | 247 ui::Layer* layer = desktop_window_->layer(); |
248 oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel( | 248 gfx::Size capture_size = |
249 layer, layer->bounds().size())); | 249 ui::ConvertSizeToPixel(layer, layer->bounds().size()); |
| 250 #if defined(OS_CHROMEOS) |
| 251 // Pad desktop capture size to multiples of 16 pixels to accommodate HW |
| 252 // encoder. TODO(hshi): remove this hack. See http://crbug.com/402151 |
| 253 capture_size.SetSize((capture_size.width() + 15) & ~15, |
| 254 (capture_size.height() + 15) & ~15); |
| 255 #endif |
| 256 oracle_proxy_->UpdateCaptureSize(capture_size); |
250 } | 257 } |
251 ClearCursorState(); | 258 ClearCursorState(); |
252 } | 259 } |
253 | 260 |
254 void DesktopVideoCaptureMachine::Capture(bool dirty) { | 261 void DesktopVideoCaptureMachine::Capture(bool dirty) { |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
256 | 263 |
257 // Do not capture if the desktop window is already destroyed. | 264 // Do not capture if the desktop window is already destroyed. |
258 if (!desktop_window_) | 265 if (!desktop_window_) |
259 return; | 266 return; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 scoped_ptr<Client> client) { | 531 scoped_ptr<Client> client) { |
525 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 532 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
526 core_->AllocateAndStart(params, client.Pass()); | 533 core_->AllocateAndStart(params, client.Pass()); |
527 } | 534 } |
528 | 535 |
529 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 536 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
530 core_->StopAndDeAllocate(); | 537 core_->StopAndDeAllocate(); |
531 } | 538 } |
532 | 539 |
533 } // namespace content | 540 } // namespace content |
OLD | NEW |