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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 VideoFrame::PlaneSize(PIXEL_FORMAT_I420, i, | 191 VideoFrame::PlaneSize(PIXEL_FORMAT_I420, i, |
192 capture_format_.frame_size) | 192 capture_format_.frame_size) |
193 .GetArea(); | 193 .GetArea(); |
194 memcpy(capture_buffer->data(i), fake_frame_.get() + offset, plane_size); | 194 memcpy(capture_buffer->data(i), fake_frame_.get() + offset, plane_size); |
195 offset += plane_size; | 195 offset += plane_size; |
196 } | 196 } |
197 } else { | 197 } else { |
198 DCHECK_EQ(capture_format_.pixel_storage, PIXEL_STORAGE_CPU); | 198 DCHECK_EQ(capture_format_.pixel_storage, PIXEL_STORAGE_CPU); |
199 DCHECK_EQ(capture_format_.pixel_format, VIDEO_CAPTURE_PIXEL_FORMAT_ARGB); | 199 DCHECK_EQ(capture_format_.pixel_format, VIDEO_CAPTURE_PIXEL_FORMAT_ARGB); |
200 uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data()); | 200 uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data()); |
201 memset(data_ptr, 0, capture_buffer->size()); | 201 memset(data_ptr, 0, capture_buffer->mapped_size()); |
202 DrawPacman(true /* use_argb */, data_ptr, frame_count_, | 202 DrawPacman(true /* use_argb */, data_ptr, frame_count_, |
203 kFakeCapturePeriodMs, capture_format_.frame_size); | 203 kFakeCapturePeriodMs, capture_format_.frame_size); |
204 } | 204 } |
205 | 205 |
206 // Give the captured frame to the client. | 206 // Give the captured frame to the client. |
207 client_->OnIncomingCapturedBuffer(capture_buffer.Pass(), capture_format_, | 207 client_->OnIncomingCapturedBuffer(capture_buffer.Pass(), capture_format_, |
208 base::TimeTicks::Now()); | 208 base::TimeTicks::Now()); |
209 | 209 |
210 BeepAndScheduleNextCapture( | 210 BeepAndScheduleNextCapture( |
211 expected_execution_time, | 211 expected_execution_time, |
(...skipping 15 matching lines...) Expand all Loading... |
227 // Don't accumulate any debt if we are lagging behind - just post the next | 227 // Don't accumulate any debt if we are lagging behind - just post the next |
228 // frame immediately and continue as normal. | 228 // frame immediately and continue as normal. |
229 const base::TimeTicks next_execution_time = | 229 const base::TimeTicks next_execution_time = |
230 std::max(current_time, expected_execution_time + frame_interval); | 230 std::max(current_time, expected_execution_time + frame_interval); |
231 const base::TimeDelta delay = next_execution_time - current_time; | 231 const base::TimeDelta delay = next_execution_time - current_time; |
232 base::MessageLoop::current()->PostDelayedTask( | 232 base::MessageLoop::current()->PostDelayedTask( |
233 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); | 233 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); |
234 } | 234 } |
235 | 235 |
236 } // namespace media | 236 } // namespace media |
OLD | NEW |