| 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 30 matching lines...) Expand all Loading... |
| 41 // thread1: |-Capture-f1------v |-Capture-f2------v |-Capture-f3----v |-Capt | 41 // thread1: |-Capture-f1------v |-Capture-f2------v |-Capture-f3----v |-Capt |
| 42 // thread2: |-Render-f1-----v |-Render-f2-----v |-Render-f3 | 42 // thread2: |-Render-f1-----v |-Render-f2-----v |-Render-f3 |
| 43 // | 43 // |
| 44 // In the above example, both capturing and rendering *each* take almost the | 44 // In the above example, both capturing and rendering *each* take almost the |
| 45 // full 33 ms available between frames, yet we see that the required throughput | 45 // full 33 ms available between frames, yet we see that the required throughput |
| 46 // is obtained. | 46 // is obtained. |
| 47 // | 47 // |
| 48 // Turning on verbose logging will cause the effective frame rate to be logged | 48 // Turning on verbose logging will cause the effective frame rate to be logged |
| 49 // at 5-second intervals. | 49 // at 5-second intervals. |
| 50 | 50 |
| 51 #include "content/browser/renderer_host/media/web_contents_video_capture_device.
h" | 51 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
| 52 | 52 |
| 53 #include "base/basictypes.h" | 53 #include "base/basictypes.h" |
| 54 #include "base/bind.h" | 54 #include "base/bind.h" |
| 55 #include "base/callback_helpers.h" | 55 #include "base/callback_helpers.h" |
| 56 #include "base/logging.h" | 56 #include "base/logging.h" |
| 57 #include "base/memory/scoped_ptr.h" | 57 #include "base/memory/scoped_ptr.h" |
| 58 #include "base/memory/weak_ptr.h" | 58 #include "base/memory/weak_ptr.h" |
| 59 #include "base/message_loop/message_loop_proxy.h" | 59 #include "base/message_loop/message_loop_proxy.h" |
| 60 #include "base/metrics/histogram.h" | 60 #include "base/metrics/histogram.h" |
| 61 #include "base/sequenced_task_runner.h" | 61 #include "base/sequenced_task_runner.h" |
| 62 #include "base/threading/thread.h" | 62 #include "base/threading/thread.h" |
| 63 #include "base/threading/thread_checker.h" | 63 #include "base/threading/thread_checker.h" |
| 64 #include "base/time/time.h" | 64 #include "base/time/time.h" |
| 65 #include "content/browser/renderer_host/media/content_video_capture_device_core.
h" | 65 #include "content/browser/media/capture/content_video_capture_device_core.h" |
| 66 #include "content/browser/renderer_host/media/video_capture_oracle.h" | 66 #include "content/browser/media/capture/video_capture_oracle.h" |
| 67 #include "content/browser/renderer_host/media/web_contents_capture_util.h" | 67 #include "content/browser/media/capture/web_contents_capture_util.h" |
| 68 #include "content/browser/renderer_host/render_widget_host_impl.h" | 68 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 69 #include "content/browser/web_contents/web_contents_impl.h" | 69 #include "content/browser/web_contents/web_contents_impl.h" |
| 70 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" | 70 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" |
| 71 #include "content/port/browser/render_widget_host_view_port.h" | 71 #include "content/port/browser/render_widget_host_view_port.h" |
| 72 #include "content/public/browser/browser_thread.h" | 72 #include "content/public/browser/browser_thread.h" |
| 73 #include "content/public/browser/notification_source.h" | 73 #include "content/public/browser/notification_source.h" |
| 74 #include "content/public/browser/notification_types.h" | 74 #include "content/public/browser/notification_types.h" |
| 75 #include "content/public/browser/render_view_host.h" | 75 #include "content/public/browser/render_view_host.h" |
| 76 #include "content/public/browser/render_widget_host_view.h" | 76 #include "content/public/browser/render_widget_host_view.h" |
| 77 #include "content/public/browser/web_contents_observer.h" | 77 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 scoped_ptr<Client> client) { | 818 scoped_ptr<Client> client) { |
| 819 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 819 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 820 core_->AllocateAndStart(params, client.Pass()); | 820 core_->AllocateAndStart(params, client.Pass()); |
| 821 } | 821 } |
| 822 | 822 |
| 823 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { | 823 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { |
| 824 core_->StopAndDeAllocate(); | 824 core_->StopAndDeAllocate(); |
| 825 } | 825 } |
| 826 | 826 |
| 827 } // namespace content | 827 } // namespace content |
| OLD | NEW |