| 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 12 matching lines...) Expand all Loading... |
| 23 MediaStreamVideoSource::kDefaultHeight), | 23 MediaStreamVideoSource::kDefaultHeight), |
| 24 MediaStreamVideoSource::kDefaultFrameRate, | 24 MediaStreamVideoSource::kDefaultFrameRate, |
| 25 media::PIXEL_FORMAT_I420)); | 25 media::PIXEL_FORMAT_I420)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {} | 28 MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {} |
| 29 | 29 |
| 30 void MockMediaStreamVideoSource::StartMockedSource() { | 30 void MockMediaStreamVideoSource::StartMockedSource() { |
| 31 DCHECK(attempted_to_start_); | 31 DCHECK(attempted_to_start_); |
| 32 attempted_to_start_ = false; | 32 attempted_to_start_ = false; |
| 33 OnStartDone(true); | 33 OnStartDone(MEDIA_DEVICE_OK); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void MockMediaStreamVideoSource::FailToStartMockedSource() { | 36 void MockMediaStreamVideoSource::FailToStartMockedSource() { |
| 37 DCHECK(attempted_to_start_); | 37 DCHECK(attempted_to_start_); |
| 38 attempted_to_start_ = false; | 38 attempted_to_start_ = false; |
| 39 OnStartDone(false); | 39 OnStartDone(MEDIA_DEVICE_TRACK_START_FAILURE); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void MockMediaStreamVideoSource::CompleteGetSupportedFormats() { | 42 void MockMediaStreamVideoSource::CompleteGetSupportedFormats() { |
| 43 DCHECK(!formats_callback_.is_null()); | 43 DCHECK(!formats_callback_.is_null()); |
| 44 base::ResetAndReturn(&formats_callback_).Run(supported_formats_); | 44 base::ResetAndReturn(&formats_callback_).Run(supported_formats_); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void MockMediaStreamVideoSource::GetCurrentSupportedFormats( | 47 void MockMediaStreamVideoSource::GetCurrentSupportedFormats( |
| 48 int max_requested_height, | 48 int max_requested_height, |
| 49 int max_requested_width, | 49 int max_requested_width, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |