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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 OwnBufferFrameDeliverer::~OwnBufferFrameDeliverer() = default; | 521 OwnBufferFrameDeliverer::~OwnBufferFrameDeliverer() = default; |
522 | 522 |
523 void OwnBufferFrameDeliverer::Initialize( | 523 void OwnBufferFrameDeliverer::Initialize( |
524 VideoPixelFormat pixel_format, | 524 VideoPixelFormat pixel_format, |
525 std::unique_ptr<VideoCaptureDevice::Client> client, | 525 std::unique_ptr<VideoCaptureDevice::Client> client, |
526 const FakeDeviceState* device_state) { | 526 const FakeDeviceState* device_state) { |
527 client_ = std::move(client); | 527 client_ = std::move(client); |
528 device_state_ = device_state; | 528 device_state_ = device_state; |
529 buffer_.reset(new uint8_t[VideoFrame::AllocationSize( | 529 buffer_.reset(new uint8_t[VideoFrame::AllocationSize( |
530 pixel_format, device_state_->format.frame_size)]); | 530 pixel_format, device_state_->format.frame_size)]); |
| 531 client_->OnStarted(); |
531 } | 532 } |
532 | 533 |
533 void OwnBufferFrameDeliverer::Uninitialize() { | 534 void OwnBufferFrameDeliverer::Uninitialize() { |
534 client_.reset(); | 535 client_.reset(); |
535 device_state_ = nullptr; | 536 device_state_ = nullptr; |
536 buffer_.reset(); | 537 buffer_.reset(); |
537 } | 538 } |
538 | 539 |
539 void OwnBufferFrameDeliverer::PaintAndDeliverNextFrame( | 540 void OwnBufferFrameDeliverer::PaintAndDeliverNextFrame( |
540 base::TimeDelta timestamp_to_paint) { | 541 base::TimeDelta timestamp_to_paint) { |
(...skipping 13 matching lines...) Expand all Loading... |
554 : FrameDeliverer(std::move(frame_painter)) {} | 555 : FrameDeliverer(std::move(frame_painter)) {} |
555 | 556 |
556 ClientBufferFrameDeliverer::~ClientBufferFrameDeliverer() = default; | 557 ClientBufferFrameDeliverer::~ClientBufferFrameDeliverer() = default; |
557 | 558 |
558 void ClientBufferFrameDeliverer::Initialize( | 559 void ClientBufferFrameDeliverer::Initialize( |
559 VideoPixelFormat, | 560 VideoPixelFormat, |
560 std::unique_ptr<VideoCaptureDevice::Client> client, | 561 std::unique_ptr<VideoCaptureDevice::Client> client, |
561 const FakeDeviceState* device_state) { | 562 const FakeDeviceState* device_state) { |
562 client_ = std::move(client); | 563 client_ = std::move(client); |
563 device_state_ = device_state; | 564 device_state_ = device_state; |
| 565 client_->OnStarted(); |
564 } | 566 } |
565 | 567 |
566 void ClientBufferFrameDeliverer::Uninitialize() { | 568 void ClientBufferFrameDeliverer::Uninitialize() { |
567 client_.reset(); | 569 client_.reset(); |
568 device_state_ = nullptr; | 570 device_state_ = nullptr; |
569 } | 571 } |
570 | 572 |
571 void ClientBufferFrameDeliverer::PaintAndDeliverNextFrame( | 573 void ClientBufferFrameDeliverer::PaintAndDeliverNextFrame( |
572 base::TimeDelta timestamp_to_paint) { | 574 base::TimeDelta timestamp_to_paint) { |
573 if (client_ == nullptr) | 575 if (client_ == nullptr) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 int session_id) { | 632 int session_id) { |
631 DCHECK(thread_checker_.CalledOnValidThread()); | 633 DCHECK(thread_checker_.CalledOnValidThread()); |
632 if (session_id != current_session_id_) | 634 if (session_id != current_session_id_) |
633 return; | 635 return; |
634 | 636 |
635 frame_deliverer_->PaintAndDeliverNextFrame(elapsed_time_); | 637 frame_deliverer_->PaintAndDeliverNextFrame(elapsed_time_); |
636 BeepAndScheduleNextCapture(expected_execution_time); | 638 BeepAndScheduleNextCapture(expected_execution_time); |
637 } | 639 } |
638 | 640 |
639 } // namespace media | 641 } // namespace media |
OLD | NEW |