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 consumer's | 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 | 1116 |
1117 TransitionStateTo(kCapturing); | 1117 TransitionStateTo(kCapturing); |
1118 | 1118 |
1119 oracle_proxy_->Start(); | 1119 oracle_proxy_->Start(); |
1120 } | 1120 } |
1121 | 1121 |
1122 // static | 1122 // static |
1123 void WebContentsVideoCaptureDevice::Impl::AssignCaptureMachine( | 1123 void WebContentsVideoCaptureDevice::Impl::AssignCaptureMachine( |
1124 base::WeakPtr<WebContentsVideoCaptureDevice::Impl> impl, | 1124 base::WeakPtr<WebContentsVideoCaptureDevice::Impl> impl, |
1125 scoped_ptr<CaptureMachine> capture_machine) { | 1125 scoped_ptr<CaptureMachine> capture_machine) { |
1126 DCHECK(!impl || impl->thread_checker_.CalledOnValidThread()); | 1126 DCHECK(!impl.get() || impl->thread_checker_.CalledOnValidThread()); |
1127 | 1127 |
1128 if (!impl) { | 1128 if (!impl.get()) { |
1129 // If WCVD::Impl was destroyed before we got back on it's thread and | 1129 // If WCVD::Impl was destroyed before we got back on it's thread and |
1130 // capture_machine is not NULL, then we need to return to the UI thread to | 1130 // capture_machine is not NULL, then we need to return to the UI thread to |
1131 // safely cleanup the CaptureMachine. | 1131 // safely cleanup the CaptureMachine. |
1132 if (capture_machine) { | 1132 if (capture_machine) { |
1133 BrowserThread::PostTask( | 1133 BrowserThread::PostTask( |
1134 BrowserThread::UI, FROM_HERE, base::Bind( | 1134 BrowserThread::UI, FROM_HERE, base::Bind( |
1135 &DeleteCaptureMachineOnUIThread, base::Passed(&capture_machine))); | 1135 &DeleteCaptureMachineOnUIThread, base::Passed(&capture_machine))); |
1136 return; | 1136 return; |
1137 } | 1137 } |
1138 } else if (!capture_machine) { | 1138 } else if (!capture_machine) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 void WebContentsVideoCaptureDevice::DeAllocate() { | 1264 void WebContentsVideoCaptureDevice::DeAllocate() { |
1265 impl_->DeAllocate(); | 1265 impl_->DeAllocate(); |
1266 } | 1266 } |
1267 | 1267 |
1268 const media::VideoCaptureDevice::Name& | 1268 const media::VideoCaptureDevice::Name& |
1269 WebContentsVideoCaptureDevice::device_name() { | 1269 WebContentsVideoCaptureDevice::device_name() { |
1270 return device_name_; | 1270 return device_name_; |
1271 } | 1271 } |
1272 | 1272 |
1273 } // namespace content | 1273 } // namespace content |
OLD | NEW |