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 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 MockMediaStreamVideoSource::MockMediaStreamVideoSource( | 13 MockMediaStreamVideoSource::MockMediaStreamVideoSource( |
14 bool manual_get_supported_formats) | 14 bool manual_get_supported_formats) |
15 : manual_get_supported_formats_(manual_get_supported_formats), | 15 : manual_get_supported_formats_(manual_get_supported_formats), |
16 max_requested_height_(0), | 16 max_requested_height_(0), |
17 max_requested_width_(0), | 17 max_requested_width_(0), |
| 18 max_requested_frame_rate_(0.0), |
18 attempted_to_start_(false) { | 19 attempted_to_start_(false) { |
19 supported_formats_.push_back( | 20 supported_formats_.push_back( |
20 media::VideoCaptureFormat( | 21 media::VideoCaptureFormat( |
21 gfx::Size(MediaStreamVideoSource::kDefaultWidth, | 22 gfx::Size(MediaStreamVideoSource::kDefaultWidth, |
22 MediaStreamVideoSource::kDefaultHeight), | 23 MediaStreamVideoSource::kDefaultHeight), |
23 MediaStreamVideoSource::kDefaultFrameRate, | 24 MediaStreamVideoSource::kDefaultFrameRate, |
24 media::PIXEL_FORMAT_I420)); | 25 media::PIXEL_FORMAT_I420)); |
25 } | 26 } |
26 | 27 |
27 MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {} | 28 MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {} |
(...skipping 11 matching lines...) Expand all Loading... |
39 } | 40 } |
40 | 41 |
41 void MockMediaStreamVideoSource::CompleteGetSupportedFormats() { | 42 void MockMediaStreamVideoSource::CompleteGetSupportedFormats() { |
42 DCHECK(!formats_callback_.is_null()); | 43 DCHECK(!formats_callback_.is_null()); |
43 base::ResetAndReturn(&formats_callback_).Run(supported_formats_); | 44 base::ResetAndReturn(&formats_callback_).Run(supported_formats_); |
44 } | 45 } |
45 | 46 |
46 void MockMediaStreamVideoSource::GetCurrentSupportedFormats( | 47 void MockMediaStreamVideoSource::GetCurrentSupportedFormats( |
47 int max_requested_height, | 48 int max_requested_height, |
48 int max_requested_width, | 49 int max_requested_width, |
| 50 double max_requested_frame_rate, |
49 const VideoCaptureDeviceFormatsCB& callback) { | 51 const VideoCaptureDeviceFormatsCB& callback) { |
50 DCHECK(formats_callback_.is_null()); | 52 DCHECK(formats_callback_.is_null()); |
51 max_requested_height_ = max_requested_height; | 53 max_requested_height_ = max_requested_height; |
52 max_requested_width_ = max_requested_width; | 54 max_requested_width_ = max_requested_width; |
| 55 max_requested_frame_rate_ = max_requested_frame_rate; |
53 | 56 |
54 if (manual_get_supported_formats_) { | 57 if (manual_get_supported_formats_) { |
55 formats_callback_ = callback; | 58 formats_callback_ = callback; |
56 return; | 59 return; |
57 } | 60 } |
58 callback.Run(supported_formats_); | 61 callback.Run(supported_formats_); |
59 } | 62 } |
60 | 63 |
61 void MockMediaStreamVideoSource::StartSourceImpl( | 64 void MockMediaStreamVideoSource::StartSourceImpl( |
62 const media::VideoCaptureParams& params, | 65 const media::VideoCaptureParams& params, |
(...skipping 19 matching lines...) Expand all Loading... |
82 | 85 |
83 void MockMediaStreamVideoSource::DeliverVideoFrameOnIO( | 86 void MockMediaStreamVideoSource::DeliverVideoFrameOnIO( |
84 const scoped_refptr<media::VideoFrame>& frame, | 87 const scoped_refptr<media::VideoFrame>& frame, |
85 media::VideoCaptureFormat format, | 88 media::VideoCaptureFormat format, |
86 const base::TimeTicks& estimated_capture_time, | 89 const base::TimeTicks& estimated_capture_time, |
87 const VideoCaptureDeliverFrameCB& frame_callback) { | 90 const VideoCaptureDeliverFrameCB& frame_callback) { |
88 frame_callback.Run(frame, format, estimated_capture_time); | 91 frame_callback.Run(frame, format, estimated_capture_time); |
89 } | 92 } |
90 | 93 |
91 } // namespace content | 94 } // namespace content |
OLD | NEW |