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 <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 DCHECK_EQ(PIXEL_STORAGE_CPU, capture_format_.pixel_storage); | 329 DCHECK_EQ(PIXEL_STORAGE_CPU, capture_format_.pixel_storage); |
330 uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data()); | 330 uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data()); |
331 memset(data_ptr, 0, capture_buffer->mapped_size()); | 331 memset(data_ptr, 0, capture_buffer->mapped_size()); |
332 DrawPacman(capture_format_.pixel_format, data_ptr, elapsed_time_, | 332 DrawPacman(capture_format_.pixel_format, data_ptr, elapsed_time_, |
333 fake_capture_rate_, capture_format_.frame_size, current_zoom_); | 333 fake_capture_rate_, capture_format_.frame_size, current_zoom_); |
334 | 334 |
335 // Give the captured frame to the client. | 335 // Give the captured frame to the client. |
336 base::TimeTicks now = base::TimeTicks::Now(); | 336 base::TimeTicks now = base::TimeTicks::Now(); |
337 if (first_ref_time_.is_null()) | 337 if (first_ref_time_.is_null()) |
338 first_ref_time_ = now; | 338 first_ref_time_ = now; |
| 339 const int arbitrary_frame_id = 0; |
339 client_->OnIncomingCapturedBuffer(std::move(capture_buffer), capture_format_, | 340 client_->OnIncomingCapturedBuffer(std::move(capture_buffer), capture_format_, |
340 now, now - first_ref_time_); | 341 now, now - first_ref_time_, |
| 342 arbitrary_frame_id); |
341 | 343 |
342 BeepAndScheduleNextCapture( | 344 BeepAndScheduleNextCapture( |
343 expected_execution_time, | 345 expected_execution_time, |
344 base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers, | 346 base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers, |
345 weak_factory_.GetWeakPtr())); | 347 weak_factory_.GetWeakPtr())); |
346 } | 348 } |
347 | 349 |
348 void FakeVideoCaptureDevice::BeepAndScheduleNextCapture( | 350 void FakeVideoCaptureDevice::BeepAndScheduleNextCapture( |
349 base::TimeTicks expected_execution_time, | 351 base::TimeTicks expected_execution_time, |
350 const base::Callback<void(base::TimeTicks)>& next_capture) { | 352 const base::Callback<void(base::TimeTicks)>& next_capture) { |
(...skipping 15 matching lines...) Expand all Loading... |
366 // Don't accumulate any debt if we are lagging behind - just post the next | 368 // Don't accumulate any debt if we are lagging behind - just post the next |
367 // frame immediately and continue as normal. | 369 // frame immediately and continue as normal. |
368 const base::TimeTicks next_execution_time = | 370 const base::TimeTicks next_execution_time = |
369 std::max(current_time, expected_execution_time + frame_interval); | 371 std::max(current_time, expected_execution_time + frame_interval); |
370 const base::TimeDelta delay = next_execution_time - current_time; | 372 const base::TimeDelta delay = next_execution_time - current_time; |
371 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 373 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
372 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); | 374 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); |
373 } | 375 } |
374 | 376 |
375 } // namespace media | 377 } // namespace media |
OLD | NEW |