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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 DCHECK(thread_checker_.CalledOnValidThread()); | 319 DCHECK(thread_checker_.CalledOnValidThread()); |
320 | 320 |
321 const int arbitrary_frame_feedback_id = 0; | 321 const int arbitrary_frame_feedback_id = 0; |
322 VideoCaptureDevice::Client::Buffer capture_buffer = | 322 VideoCaptureDevice::Client::Buffer capture_buffer = |
323 client_->ReserveOutputBuffer( | 323 client_->ReserveOutputBuffer( |
324 capture_format_.frame_size, capture_format_.pixel_format, | 324 capture_format_.frame_size, capture_format_.pixel_format, |
325 capture_format_.pixel_storage, arbitrary_frame_feedback_id); | 325 capture_format_.pixel_storage, arbitrary_frame_feedback_id); |
326 DLOG_IF(ERROR, !capture_buffer.is_valid()) | 326 DLOG_IF(ERROR, !capture_buffer.is_valid()) |
327 << "Couldn't allocate Capture Buffer"; | 327 << "Couldn't allocate Capture Buffer"; |
328 auto buffer_access = | 328 auto buffer_access = |
329 capture_buffer.handle_provider()->GetHandleForInProcessAccess(); | 329 capture_buffer.handle_provider->GetHandleForInProcessAccess(); |
330 DCHECK(buffer_access->data()) << "Buffer has NO backing memory"; | 330 DCHECK(buffer_access->data()) << "Buffer has NO backing memory"; |
331 | 331 |
332 DCHECK_EQ(PIXEL_STORAGE_CPU, capture_format_.pixel_storage); | 332 DCHECK_EQ(PIXEL_STORAGE_CPU, capture_format_.pixel_storage); |
333 uint8_t* data_ptr = buffer_access->data(); | 333 uint8_t* data_ptr = buffer_access->data(); |
334 memset(data_ptr, 0, buffer_access->mapped_size()); | 334 memset(data_ptr, 0, buffer_access->mapped_size()); |
335 DrawPacman(capture_format_.pixel_format, data_ptr, elapsed_time_, | 335 DrawPacman(capture_format_.pixel_format, data_ptr, elapsed_time_, |
336 fake_capture_rate_, capture_format_.frame_size, current_zoom_); | 336 fake_capture_rate_, capture_format_.frame_size, current_zoom_); |
337 | 337 |
338 // Give the captured frame to the client. | 338 // Give the captured frame to the client. |
339 base::TimeTicks now = base::TimeTicks::Now(); | 339 base::TimeTicks now = base::TimeTicks::Now(); |
(...skipping 29 matching lines...) Expand all Loading... |
369 // Don't accumulate any debt if we are lagging behind - just post the next | 369 // Don't accumulate any debt if we are lagging behind - just post the next |
370 // frame immediately and continue as normal. | 370 // frame immediately and continue as normal. |
371 const base::TimeTicks next_execution_time = | 371 const base::TimeTicks next_execution_time = |
372 std::max(current_time, expected_execution_time + frame_interval); | 372 std::max(current_time, expected_execution_time + frame_interval); |
373 const base::TimeDelta delay = next_execution_time - current_time; | 373 const base::TimeDelta delay = next_execution_time - current_time; |
374 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 374 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
375 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); | 375 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); |
376 } | 376 } |
377 | 377 |
378 } // namespace media | 378 } // namespace media |
OLD | NEW |