| 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create( | 953 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create( |
| 954 const std::string& device_id) { | 954 const std::string& device_id) { |
| 955 // Parse device_id into render_process_id and main_render_frame_id. | 955 // Parse device_id into render_process_id and main_render_frame_id. |
| 956 int render_process_id = -1; | 956 int render_process_id = -1; |
| 957 int main_render_frame_id = -1; | 957 int main_render_frame_id = -1; |
| 958 if (!WebContentsMediaCaptureId::ExtractTabCaptureTarget( | 958 if (!WebContentsMediaCaptureId::ExtractTabCaptureTarget( |
| 959 device_id, &render_process_id, &main_render_frame_id)) { | 959 device_id, &render_process_id, &main_render_frame_id)) { |
| 960 return NULL; | 960 return NULL; |
| 961 } | 961 } |
| 962 | 962 |
| 963 bool auto_throttling; |
| 964 WebContentsMediaCaptureId::ExtractOptions(device_id, &auto_throttling, |
| 965 nullptr); |
| 963 return new WebContentsVideoCaptureDevice( | 966 return new WebContentsVideoCaptureDevice( |
| 964 render_process_id, main_render_frame_id, | 967 render_process_id, main_render_frame_id, auto_throttling); |
| 965 WebContentsMediaCaptureId::IsAutoThrottlingOptionSet(device_id)); | |
| 966 } | 968 } |
| 967 | 969 |
| 968 void WebContentsVideoCaptureDevice::AllocateAndStart( | 970 void WebContentsVideoCaptureDevice::AllocateAndStart( |
| 969 const media::VideoCaptureParams& params, | 971 const media::VideoCaptureParams& params, |
| 970 std::unique_ptr<Client> client) { | 972 std::unique_ptr<Client> client) { |
| 971 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 973 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 972 core_->AllocateAndStart(params, std::move(client)); | 974 core_->AllocateAndStart(params, std::move(client)); |
| 973 } | 975 } |
| 974 | 976 |
| 975 void WebContentsVideoCaptureDevice::RequestRefreshFrame() { | 977 void WebContentsVideoCaptureDevice::RequestRefreshFrame() { |
| 976 core_->RequestRefreshFrame(); | 978 core_->RequestRefreshFrame(); |
| 977 } | 979 } |
| 978 | 980 |
| 979 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { | 981 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { |
| 980 core_->StopAndDeAllocate(); | 982 core_->StopAndDeAllocate(); |
| 981 } | 983 } |
| 982 | 984 |
| 983 } // namespace content | 985 } // namespace content |
| OLD | NEW |