| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 max_requested_frame_rate_ = max_requested_frame_rate; | 55 max_requested_frame_rate_ = max_requested_frame_rate; |
| 56 | 56 |
| 57 if (manual_get_supported_formats_) { | 57 if (manual_get_supported_formats_) { |
| 58 formats_callback_ = callback; | 58 formats_callback_ = callback; |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 callback.Run(supported_formats_); | 61 callback.Run(supported_formats_); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void MockMediaStreamVideoSource::StartSourceImpl( | 64 void MockMediaStreamVideoSource::StartSourceImpl( |
| 65 const media::VideoCaptureParams& params, | 65 const media::VideoCaptureFormat& format, |
| 66 const VideoCaptureDeliverFrameCB& frame_callback) { | 66 const VideoCaptureDeliverFrameCB& frame_callback) { |
| 67 DCHECK(frame_callback_.is_null()); | 67 DCHECK(frame_callback_.is_null()); |
| 68 params_ = params; | 68 format_ = format; |
| 69 attempted_to_start_ = true; | 69 attempted_to_start_ = true; |
| 70 frame_callback_ = frame_callback; | 70 frame_callback_ = frame_callback; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void MockMediaStreamVideoSource::StopSourceImpl() { | 73 void MockMediaStreamVideoSource::StopSourceImpl() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 void MockMediaStreamVideoSource::DeliverVideoFrame( | 76 void MockMediaStreamVideoSource::DeliverVideoFrame( |
| 77 const scoped_refptr<media::VideoFrame>& frame) { | 77 const scoped_refptr<media::VideoFrame>& frame) { |
| 78 DCHECK(!frame_callback_.is_null()); | 78 DCHECK(!frame_callback_.is_null()); |
| 79 io_message_loop()->PostTask( | 79 io_message_loop()->PostTask( |
| 80 FROM_HERE, | 80 FROM_HERE, |
| 81 base::Bind(&MockMediaStreamVideoSource::DeliverVideoFrameOnIO, | 81 base::Bind(&MockMediaStreamVideoSource::DeliverVideoFrameOnIO, |
| 82 base::Unretained(this), frame, params_.requested_format, | 82 base::Unretained(this), frame, format_, |
| 83 base::TimeTicks(), frame_callback_)); | 83 base::TimeTicks(), frame_callback_)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void MockMediaStreamVideoSource::DeliverVideoFrameOnIO( | 86 void MockMediaStreamVideoSource::DeliverVideoFrameOnIO( |
| 87 const scoped_refptr<media::VideoFrame>& frame, | 87 const scoped_refptr<media::VideoFrame>& frame, |
| 88 media::VideoCaptureFormat format, | 88 media::VideoCaptureFormat format, |
| 89 const base::TimeTicks& estimated_capture_time, | 89 const base::TimeTicks& estimated_capture_time, |
| 90 const VideoCaptureDeliverFrameCB& frame_callback) { | 90 const VideoCaptureDeliverFrameCB& frame_callback) { |
| 91 frame_callback.Run(frame, format, estimated_capture_time); | 91 frame_callback.Run(frame, format, estimated_capture_time); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace content | 94 } // namespace content |
| OLD | NEW |