| Index: media/capture/video/fake_video_capture_device.cc
|
| diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc
|
| index 3bbd18486aa6bbab13d1d709dc2220e1a17f8d3b..37730cc30bca63f3f7cf5b54f5c10c9ca2e8db7a 100644
|
| --- a/media/capture/video/fake_video_capture_device.cc
|
| +++ b/media/capture/video/fake_video_capture_device.cc
|
| @@ -97,7 +97,7 @@ class PacmanFramePainter {
|
| class FrameDeliverer {
|
| public:
|
| FrameDeliverer(std::unique_ptr<PacmanFramePainter> frame_painter)
|
| - : frame_painter_(std::move(frame_painter)) {}
|
| + : frame_painter_(std::move(frame_painter)), capture_(false) {}
|
| virtual ~FrameDeliverer() {}
|
| virtual void Initialize(VideoPixelFormat pixel_format,
|
| std::unique_ptr<VideoCaptureDevice::Client> client,
|
| @@ -115,6 +115,7 @@ class FrameDeliverer {
|
| const std::unique_ptr<PacmanFramePainter> frame_painter_;
|
| const FakeDeviceState* device_state_ = nullptr;
|
| std::unique_ptr<VideoCaptureDevice::Client> client_;
|
| + bool capture_;
|
|
|
| private:
|
| base::TimeTicks first_ref_time_;
|
| @@ -528,9 +529,12 @@ void OwnBufferFrameDeliverer::Initialize(
|
| device_state_ = device_state;
|
| buffer_.reset(new uint8_t[VideoFrame::AllocationSize(
|
| pixel_format, device_state_->format.frame_size)]);
|
| + client_->OnStarted();
|
| + capture_ = true;
|
| }
|
|
|
| void OwnBufferFrameDeliverer::Uninitialize() {
|
| + capture_ = false;
|
| client_.reset();
|
| device_state_ = nullptr;
|
| buffer_.reset();
|
| @@ -538,7 +542,7 @@ void OwnBufferFrameDeliverer::Uninitialize() {
|
|
|
| void OwnBufferFrameDeliverer::PaintAndDeliverNextFrame(
|
| base::TimeDelta timestamp_to_paint) {
|
| - if (!client_)
|
| + if (!client_ || !capture_)
|
| return;
|
| const size_t frame_size = device_state_->format.ImageAllocationSize();
|
| memset(buffer_.get(), 0, frame_size);
|
| @@ -561,6 +565,7 @@ void ClientBufferFrameDeliverer::Initialize(
|
| const FakeDeviceState* device_state) {
|
| client_ = std::move(client);
|
| device_state_ = device_state;
|
| + client_->OnStarted();
|
| }
|
|
|
| void ClientBufferFrameDeliverer::Uninitialize() {
|
|
|