| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/renderer_host/media/web_contents_video_capture_device.
h" |
| 52 | 52 |
| 53 #include <algorithm> | 53 #include <algorithm> |
| 54 #include <list> | 54 #include <list> |
| 55 #include <string> | 55 #include <string> |
| 56 | 56 |
| 57 #include "base/basictypes.h" | 57 #include "base/basictypes.h" |
| 58 #include "base/bind.h" | 58 #include "base/bind.h" |
| 59 #include "base/bind_helpers.h" | |
| 60 #include "base/callback_forward.h" | 59 #include "base/callback_forward.h" |
| 60 #include "base/callback_helpers.h" |
| 61 #include "base/debug/trace_event.h" | 61 #include "base/debug/trace_event.h" |
| 62 #include "base/logging.h" | 62 #include "base/logging.h" |
| 63 #include "base/memory/scoped_ptr.h" | 63 #include "base/memory/scoped_ptr.h" |
| 64 #include "base/memory/weak_ptr.h" | 64 #include "base/memory/weak_ptr.h" |
| 65 #include "base/message_loop/message_loop_proxy.h" | 65 #include "base/message_loop/message_loop_proxy.h" |
| 66 #include "base/metrics/histogram.h" | 66 #include "base/metrics/histogram.h" |
| 67 #include "base/sequenced_task_runner.h" | 67 #include "base/sequenced_task_runner.h" |
| 68 #include "base/strings/stringprintf.h" | 68 #include "base/strings/stringprintf.h" |
| 69 #include "base/synchronization/lock.h" | 69 #include "base/synchronization/lock.h" |
| 70 #include "base/threading/thread.h" | 70 #include "base/threading/thread.h" |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 SkAutoLockPixels scaled_bitmap_locker(scaled_bitmap); | 686 SkAutoLockPixels scaled_bitmap_locker(scaled_bitmap); |
| 687 | 687 |
| 688 media::CopyRGBToVideoFrame( | 688 media::CopyRGBToVideoFrame( |
| 689 reinterpret_cast<uint8*>(scaled_bitmap.getPixels()), | 689 reinterpret_cast<uint8*>(scaled_bitmap.getPixels()), |
| 690 scaled_bitmap.rowBytes(), | 690 scaled_bitmap.rowBytes(), |
| 691 region_in_frame, | 691 region_in_frame, |
| 692 output.get()); | 692 output.get()); |
| 693 } | 693 } |
| 694 | 694 |
| 695 // The result is now ready. | 695 // The result is now ready. |
| 696 failure_handler.Release(); | 696 ignore_result(failure_handler.Release()); |
| 697 done_cb.Run(true); | 697 done_cb.Run(true); |
| 698 } | 698 } |
| 699 | 699 |
| 700 VideoFrameDeliveryLog::VideoFrameDeliveryLog() | 700 VideoFrameDeliveryLog::VideoFrameDeliveryLog() |
| 701 : last_frame_rate_log_time_(), | 701 : last_frame_rate_log_time_(), |
| 702 count_frames_rendered_(0), | 702 count_frames_rendered_(0), |
| 703 last_frame_number_(0) { | 703 last_frame_number_(0) { |
| 704 } | 704 } |
| 705 | 705 |
| 706 void VideoFrameDeliveryLog::ChronicleFrameDelivery(int frame_number) { | 706 void VideoFrameDeliveryLog::ChronicleFrameDelivery(int frame_number) { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 void WebContentsVideoCaptureDevice::DeAllocate() { | 1269 void WebContentsVideoCaptureDevice::DeAllocate() { |
| 1270 impl_->DeAllocate(); | 1270 impl_->DeAllocate(); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 const media::VideoCaptureDevice::Name& | 1273 const media::VideoCaptureDevice::Name& |
| 1274 WebContentsVideoCaptureDevice::device_name() { | 1274 WebContentsVideoCaptureDevice::device_name() { |
| 1275 return device_name_; | 1275 return device_name_; |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 } // namespace content | 1278 } // namespace content |
| OLD | NEW |