| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/media/base/videoframe.h" | 22 #include "webrtc/media/base/videoframe.h" |
| 23 #ifdef HAVE_WEBRTC_VIDEO | 23 #ifdef HAVE_WEBRTC_VIDEO |
| 24 #include "webrtc/media/engine/webrtcvideoframefactory.h" | 24 #include "webrtc/media/engine/webrtcvideoframefactory.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 namespace cricket { | 27 namespace cricket { |
| 28 | 28 |
| 29 // Fake video capturer that allows the test to manually pump in frames. | 29 // Fake video capturer that allows the test to manually pump in frames. |
| 30 class FakeVideoCapturer : public cricket::VideoCapturer { | 30 class FakeVideoCapturer : public cricket::VideoCapturer { |
| 31 public: | 31 public: |
| 32 explicit FakeVideoCapturer(bool is_screencast) | 32 FakeVideoCapturer(bool is_screencast) |
| 33 : running_(false), | 33 : running_(false), |
| 34 initial_timestamp_(rtc::TimeNanos()), | 34 initial_timestamp_(rtc::TimeNanos()), |
| 35 next_timestamp_(rtc::kNumNanosecsPerMillisec), | 35 next_timestamp_(rtc::kNumNanosecsPerMillisec), |
| 36 is_screencast_(is_screencast), | 36 is_screencast_(is_screencast), |
| 37 rotation_(webrtc::kVideoRotation_0) { | 37 rotation_(webrtc::kVideoRotation_0) { |
| 38 #ifdef HAVE_WEBRTC_VIDEO | 38 #ifdef HAVE_WEBRTC_VIDEO |
| 39 set_frame_factory(new cricket::WebRtcVideoFrameFactory()); | 39 set_frame_factory(new cricket::WebRtcVideoFrameFactory()); |
| 40 #endif | 40 #endif |
| 41 // Default supported formats. Use ResetSupportedFormats to over write. | 41 // Default supported formats. Use ResetSupportedFormats to over write. |
| 42 std::vector<cricket::VideoFormat> formats; | 42 std::vector<cricket::VideoFormat> formats; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void SignalCapturedFrame(cricket::CapturedFrame* frame) { | 120 void SignalCapturedFrame(cricket::CapturedFrame* frame) { |
| 121 SignalFrameCaptured(this, frame); | 121 SignalFrameCaptured(this, frame); |
| 122 } | 122 } |
| 123 | 123 |
| 124 sigslot::signal1<FakeVideoCapturer*> SignalDestroyed; | 124 sigslot::signal1<FakeVideoCapturer*> SignalDestroyed; |
| 125 | 125 |
| 126 cricket::CaptureState Start(const cricket::VideoFormat& format) override { | 126 cricket::CaptureState Start(const cricket::VideoFormat& format) override { |
| 127 SetCaptureFormat(&format); | 127 cricket::VideoFormat supported; |
| 128 if (GetBestCaptureFormat(format, &supported)) { |
| 129 SetCaptureFormat(&supported); |
| 130 } |
| 128 running_ = true; | 131 running_ = true; |
| 129 SetCaptureState(cricket::CS_RUNNING); | 132 SetCaptureState(cricket::CS_RUNNING); |
| 130 return cricket::CS_RUNNING; | 133 return cricket::CS_RUNNING; |
| 131 } | 134 } |
| 132 void Stop() override { | 135 void Stop() override { |
| 133 running_ = false; | 136 running_ = false; |
| 134 SetCaptureFormat(NULL); | 137 SetCaptureFormat(NULL); |
| 135 SetCaptureState(cricket::CS_STOPPED); | 138 SetCaptureState(cricket::CS_STOPPED); |
| 136 } | 139 } |
| 137 bool IsRunning() override { return running_; } | 140 bool IsRunning() override { return running_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 160 int64_t initial_timestamp_; | 163 int64_t initial_timestamp_; |
| 161 int64_t next_timestamp_; | 164 int64_t next_timestamp_; |
| 162 const bool is_screencast_; | 165 const bool is_screencast_; |
| 163 rtc::Optional<bool> needs_denoising_; | 166 rtc::Optional<bool> needs_denoising_; |
| 164 webrtc::VideoRotation rotation_; | 167 webrtc::VideoRotation rotation_; |
| 165 }; | 168 }; |
| 166 | 169 |
| 167 } // namespace cricket | 170 } // namespace cricket |
| 168 | 171 |
| 169 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 172 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ |
| OLD | NEW |