| 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 // Implementation notes: This needs to work on a variety of hardware | 5 // Implementation notes: This needs to work on a variety of hardware |
| 6 // configurations where the speed of the CPU and GPU greatly affect overall | 6 // configurations where the speed of the CPU and GPU greatly affect overall |
| 7 // performance. Spanning several threads, the process of capturing has been | 7 // performance. Spanning several threads, the process of capturing has been |
| 8 // split up into four conceptual stages: | 8 // split up into four conceptual stages: |
| 9 // | 9 // |
| 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's | 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 "WebContents and/or main frame are gone."); | 870 "WebContents and/or main frame are gone."); |
| 871 } | 871 } |
| 872 return; | 872 return; |
| 873 } | 873 } |
| 874 | 874 |
| 875 if (frame_capture_active_) { | 875 if (frame_capture_active_) { |
| 876 DVLOG(1) << "Renewing ContentCaptureSubscription to RWH@" << rwh; | 876 DVLOG(1) << "Renewing ContentCaptureSubscription to RWH@" << rwh; |
| 877 subscription_.reset(new ContentCaptureSubscription( | 877 subscription_.reset(new ContentCaptureSubscription( |
| 878 *rwh, oracle_proxy_, base::Bind(&WebContentsCaptureMachine::Capture, | 878 *rwh, oracle_proxy_, base::Bind(&WebContentsCaptureMachine::Capture, |
| 879 weak_ptr_factory_.GetWeakPtr()))); | 879 weak_ptr_factory_.GetWeakPtr()))); |
| 880 // Whenever the target changes, capture a refresh frame immediately to make | |
| 881 // sure the latest frame in the video stream has the correct content. | |
| 882 subscription_->MaybeCaptureForRefresh(); | |
| 883 } | 880 } |
| 884 } | 881 } |
| 885 | 882 |
| 886 void WebContentsCaptureMachine::UpdateCaptureSize() { | 883 void WebContentsCaptureMachine::UpdateCaptureSize() { |
| 887 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 884 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 888 | 885 |
| 889 if (!oracle_proxy_) | 886 if (!oracle_proxy_) |
| 890 return; | 887 return; |
| 891 RenderWidgetHost* const rwh = tracker_->GetTargetRenderWidgetHost(); | 888 RenderWidgetHost* const rwh = tracker_->GetTargetRenderWidgetHost(); |
| 892 RenderWidgetHostView* const view = rwh ? rwh->GetView() : nullptr; | 889 RenderWidgetHostView* const view = rwh ? rwh->GetView() : nullptr; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { | 956 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { |
| 960 core_->StopAndDeAllocate(); | 957 core_->StopAndDeAllocate(); |
| 961 } | 958 } |
| 962 | 959 |
| 963 void WebContentsVideoCaptureDevice::OnUtilizationReport(int frame_feedback_id, | 960 void WebContentsVideoCaptureDevice::OnUtilizationReport(int frame_feedback_id, |
| 964 double utilization) { | 961 double utilization) { |
| 965 core_->OnConsumerReportingUtilization(frame_feedback_id, utilization); | 962 core_->OnConsumerReportingUtilization(frame_feedback_id, utilization); |
| 966 } | 963 } |
| 967 | 964 |
| 968 } // namespace content | 965 } // namespace content |
| OLD | NEW |