| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/media/mock_media_stream_video_source.h" | 5 #include "content/renderer/media/mock_media_stream_video_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (respond_to_request_refresh_frame_) { | 50 if (respond_to_request_refresh_frame_) { |
| 51 const scoped_refptr<media::VideoFrame> frame = | 51 const scoped_refptr<media::VideoFrame> frame = |
| 52 media::VideoFrame::CreateColorFrame(format_.frame_size, 0, 0, 0, | 52 media::VideoFrame::CreateColorFrame(format_.frame_size, 0, 0, 0, |
| 53 base::TimeDelta()); | 53 base::TimeDelta()); |
| 54 io_task_runner()->PostTask( | 54 io_task_runner()->PostTask( |
| 55 FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks())); | 55 FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks())); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 void MockMediaStreamVideoSource::StartSourceImpl( | 59 void MockMediaStreamVideoSource::StartSourceImpl( |
| 60 const media::VideoCaptureFormat& format, | |
| 61 const blink::WebMediaConstraints& constraints, | |
| 62 const VideoCaptureDeliverFrameCB& frame_callback) { | 60 const VideoCaptureDeliverFrameCB& frame_callback) { |
| 63 DCHECK(frame_callback_.is_null()); | 61 DCHECK(frame_callback_.is_null()); |
| 64 attempted_to_start_ = true; | 62 attempted_to_start_ = true; |
| 65 frame_callback_ = frame_callback; | 63 frame_callback_ = frame_callback; |
| 66 } | 64 } |
| 67 | 65 |
| 68 void MockMediaStreamVideoSource::StopSourceImpl() { | 66 void MockMediaStreamVideoSource::StopSourceImpl() { |
| 69 } | 67 } |
| 70 | 68 |
| 71 base::Optional<media::VideoCaptureFormat> | 69 base::Optional<media::VideoCaptureFormat> |
| 72 MockMediaStreamVideoSource::GetCurrentFormatImpl() const { | 70 MockMediaStreamVideoSource::GetCurrentFormatImpl() const { |
| 73 return base::Optional<media::VideoCaptureFormat>(format_); | 71 return base::Optional<media::VideoCaptureFormat>(format_); |
| 74 } | 72 } |
| 75 | 73 |
| 76 void MockMediaStreamVideoSource::DeliverVideoFrame( | 74 void MockMediaStreamVideoSource::DeliverVideoFrame( |
| 77 const scoped_refptr<media::VideoFrame>& frame) { | 75 const scoped_refptr<media::VideoFrame>& frame) { |
| 78 DCHECK(!frame_callback_.is_null()); | 76 DCHECK(!frame_callback_.is_null()); |
| 79 io_task_runner()->PostTask( | 77 io_task_runner()->PostTask( |
| 80 FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks())); | 78 FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks())); |
| 81 } | 79 } |
| 82 | 80 |
| 83 } // namespace content | 81 } // namespace content |
| OLD | NEW |