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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 BeepAndScheduleNextCapture( | 312 BeepAndScheduleNextCapture( |
313 expected_execution_time, | 313 expected_execution_time, |
314 base::Bind(&FakeVideoCaptureDevice::CaptureUsingOwnBuffers, | 314 base::Bind(&FakeVideoCaptureDevice::CaptureUsingOwnBuffers, |
315 weak_factory_.GetWeakPtr())); | 315 weak_factory_.GetWeakPtr())); |
316 } | 316 } |
317 | 317 |
318 void FakeVideoCaptureDevice::CaptureUsingClientBuffers( | 318 void FakeVideoCaptureDevice::CaptureUsingClientBuffers( |
319 base::TimeTicks expected_execution_time) { | 319 base::TimeTicks expected_execution_time) { |
320 DCHECK(thread_checker_.CalledOnValidThread()); | 320 DCHECK(thread_checker_.CalledOnValidThread()); |
321 | 321 |
| 322 const int arbitrary_frame_feedback_id = 0; |
322 std::unique_ptr<VideoCaptureDevice::Client::Buffer> capture_buffer( | 323 std::unique_ptr<VideoCaptureDevice::Client::Buffer> capture_buffer( |
323 client_->ReserveOutputBuffer(capture_format_.frame_size, | 324 client_->ReserveOutputBuffer( |
324 capture_format_.pixel_format, | 325 capture_format_.frame_size, capture_format_.pixel_format, |
325 capture_format_.pixel_storage)); | 326 capture_format_.pixel_storage, arbitrary_frame_feedback_id)); |
326 DLOG_IF(ERROR, !capture_buffer) << "Couldn't allocate Capture Buffer"; | 327 DLOG_IF(ERROR, !capture_buffer) << "Couldn't allocate Capture Buffer"; |
327 DCHECK(capture_buffer->data()) << "Buffer has NO backing memory"; | 328 DCHECK(capture_buffer->data()) << "Buffer has NO backing memory"; |
328 | 329 |
329 DCHECK_EQ(PIXEL_STORAGE_CPU, capture_format_.pixel_storage); | 330 DCHECK_EQ(PIXEL_STORAGE_CPU, capture_format_.pixel_storage); |
330 uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data()); | 331 uint8_t* data_ptr = static_cast<uint8_t*>(capture_buffer->data()); |
331 memset(data_ptr, 0, capture_buffer->mapped_size()); | 332 memset(data_ptr, 0, capture_buffer->mapped_size()); |
332 DrawPacman(capture_format_.pixel_format, data_ptr, elapsed_time_, | 333 DrawPacman(capture_format_.pixel_format, data_ptr, elapsed_time_, |
333 fake_capture_rate_, capture_format_.frame_size, current_zoom_); | 334 fake_capture_rate_, capture_format_.frame_size, current_zoom_); |
334 | 335 |
335 // Give the captured frame to the client. | 336 // Give the captured frame to the client. |
(...skipping 30 matching lines...) Expand all Loading... |
366 // Don't accumulate any debt if we are lagging behind - just post the next | 367 // Don't accumulate any debt if we are lagging behind - just post the next |
367 // frame immediately and continue as normal. | 368 // frame immediately and continue as normal. |
368 const base::TimeTicks next_execution_time = | 369 const base::TimeTicks next_execution_time = |
369 std::max(current_time, expected_execution_time + frame_interval); | 370 std::max(current_time, expected_execution_time + frame_interval); |
370 const base::TimeDelta delay = next_execution_time - current_time; | 371 const base::TimeDelta delay = next_execution_time - current_time; |
371 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 372 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
372 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); | 373 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); |
373 } | 374 } |
374 | 375 |
375 } // namespace media | 376 } // namespace media |
OLD | NEW |