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 #include "media/capture/video/fake_video_capture_device.h" | 5 #include "media/capture/video/fake_video_capture_device.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 capture_format_.pixel_format = PIXEL_FORMAT_I420; | 112 capture_format_.pixel_format = PIXEL_FORMAT_I420; |
113 DVLOG(1) << "starting with gmb I420 buffers"; | 113 DVLOG(1) << "starting with gmb I420 buffers"; |
114 } | 114 } |
115 } else if (buffer_ownership_ == BufferOwnership::OWN_BUFFERS) { | 115 } else if (buffer_ownership_ == BufferOwnership::OWN_BUFFERS) { |
116 capture_format_.pixel_storage = PIXEL_STORAGE_CPU; | 116 capture_format_.pixel_storage = PIXEL_STORAGE_CPU; |
117 capture_format_.pixel_format = PIXEL_FORMAT_I420; | 117 capture_format_.pixel_format = PIXEL_FORMAT_I420; |
118 DVLOG(1) << "starting with own I420 buffers"; | 118 DVLOG(1) << "starting with own I420 buffers"; |
119 } | 119 } |
120 | 120 |
121 if (capture_format_.pixel_format == PIXEL_FORMAT_I420) { | 121 if (capture_format_.pixel_format == PIXEL_FORMAT_I420) { |
122 fake_frame_.reset(new uint8[VideoFrame::AllocationSize( | 122 fake_frame_.reset(new uint8_t[VideoFrame::AllocationSize( |
123 PIXEL_FORMAT_I420, capture_format_.frame_size)]); | 123 PIXEL_FORMAT_I420, capture_format_.frame_size)]); |
124 } | 124 } |
125 | 125 |
126 beep_time_ = base::TimeDelta(); | 126 beep_time_ = base::TimeDelta(); |
127 elapsed_time_ = base::TimeDelta(); | 127 elapsed_time_ = base::TimeDelta(); |
128 | 128 |
129 if (buffer_ownership_ == BufferOwnership::CLIENT_BUFFERS) | 129 if (buffer_ownership_ == BufferOwnership::CLIENT_BUFFERS) |
130 BeepAndScheduleNextCapture( | 130 BeepAndScheduleNextCapture( |
131 base::TimeTicks::Now(), | 131 base::TimeTicks::Now(), |
132 base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers, | 132 base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Don't accumulate any debt if we are lagging behind - just post the next | 242 // Don't accumulate any debt if we are lagging behind - just post the next |
243 // frame immediately and continue as normal. | 243 // frame immediately and continue as normal. |
244 const base::TimeTicks next_execution_time = | 244 const base::TimeTicks next_execution_time = |
245 std::max(current_time, expected_execution_time + frame_interval); | 245 std::max(current_time, expected_execution_time + frame_interval); |
246 const base::TimeDelta delay = next_execution_time - current_time; | 246 const base::TimeDelta delay = next_execution_time - current_time; |
247 base::MessageLoop::current()->PostDelayedTask( | 247 base::MessageLoop::current()->PostDelayedTask( |
248 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); | 248 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); |
249 } | 249 } |
250 | 250 |
251 } // namespace media | 251 } // namespace media |
OLD | NEW |