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 11 matching lines...) Expand all Loading... |
22 MediaStreamVideoSource::kDefaultHeight), | 22 MediaStreamVideoSource::kDefaultHeight), |
23 MediaStreamVideoSource::kDefaultFrameRate, | 23 MediaStreamVideoSource::kDefaultFrameRate, |
24 media::PIXEL_FORMAT_I420)); | 24 media::PIXEL_FORMAT_I420)); |
25 } | 25 } |
26 | 26 |
27 MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {} | 27 MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {} |
28 | 28 |
29 void MockMediaStreamVideoSource::StartMockedSource() { | 29 void MockMediaStreamVideoSource::StartMockedSource() { |
30 DCHECK(attempted_to_start_); | 30 DCHECK(attempted_to_start_); |
31 attempted_to_start_ = false; | 31 attempted_to_start_ = false; |
32 OnStartDone(true); | 32 OnStartDone(MEDIA_DEVICE_OK); |
33 } | 33 } |
34 | 34 |
35 void MockMediaStreamVideoSource::FailToStartMockedSource() { | 35 void MockMediaStreamVideoSource::FailToStartMockedSource() { |
36 DCHECK(attempted_to_start_); | 36 DCHECK(attempted_to_start_); |
37 attempted_to_start_ = false; | 37 attempted_to_start_ = false; |
38 OnStartDone(false); | 38 OnStartDone(MEDIA_DEVICE_SOURCE_START_FAILURE); |
39 } | 39 } |
40 | 40 |
41 void MockMediaStreamVideoSource::CompleteGetSupportedFormats() { | 41 void MockMediaStreamVideoSource::CompleteGetSupportedFormats() { |
42 DCHECK(!formats_callback_.is_null()); | 42 DCHECK(!formats_callback_.is_null()); |
43 base::ResetAndReturn(&formats_callback_).Run(supported_formats_); | 43 base::ResetAndReturn(&formats_callback_).Run(supported_formats_); |
44 } | 44 } |
45 | 45 |
46 void MockMediaStreamVideoSource::GetCurrentSupportedFormats( | 46 void MockMediaStreamVideoSource::GetCurrentSupportedFormats( |
47 int max_requested_height, | 47 int max_requested_height, |
48 int max_requested_width, | 48 int max_requested_width, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 void MockMediaStreamVideoSource::DeliverVideoFrameOnIO( | 83 void MockMediaStreamVideoSource::DeliverVideoFrameOnIO( |
84 const scoped_refptr<media::VideoFrame>& frame, | 84 const scoped_refptr<media::VideoFrame>& frame, |
85 media::VideoCaptureFormat format, | 85 media::VideoCaptureFormat format, |
86 const base::TimeTicks& estimated_capture_time, | 86 const base::TimeTicks& estimated_capture_time, |
87 const VideoCaptureDeliverFrameCB& frame_callback) { | 87 const VideoCaptureDeliverFrameCB& frame_callback) { |
88 frame_callback.Run(frame, format, estimated_capture_time); | 88 frame_callback.Run(frame, format, estimated_capture_time); |
89 } | 89 } |
90 | 90 |
91 } // namespace content | 91 } // namespace content |
OLD | NEW |