| 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 | 
| 11 #ifndef WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 
| 12 #define WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 12 #define WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 
| 13 | 13 | 
| 14 #include <string.h> | 14 #include <string.h> | 
| 15 | 15 | 
| 16 #include <memory> | 16 #include <memory> | 
| 17 #include <vector> | 17 #include <vector> | 
| 18 | 18 | 
| 19 #include "webrtc/base/timeutils.h" | 19 #include "webrtc/base/timeutils.h" | 
| 20 #include "webrtc/media/base/videocapturer.h" | 20 #include "webrtc/media/base/videocapturer.h" | 
| 21 #include "webrtc/media/base/videocommon.h" | 21 #include "webrtc/media/base/videocommon.h" | 
| 22 #include "webrtc/media/base/videoframe.h" | 22 #include "webrtc/media/base/videoframe.h" | 
| 23 | 23 | 
| 24 namespace cricket { | 24 namespace cricket { | 
| 25 | 25 | 
| 26 // Fake video capturer that allows the test to manually pump in frames. | 26 // Fake video capturer that allows the test to manually pump in frames. | 
| 27 class FakeVideoCapturer : public cricket::VideoCapturer { | 27 class FakeVideoCapturer : public cricket::VideoCapturer { | 
| 28  public: | 28  public: | 
| 29   FakeVideoCapturer(bool is_screencast) | 29   explicit FakeVideoCapturer(bool is_screencast) | 
| 30       : running_(false), | 30       : running_(false), | 
| 31         initial_timestamp_(rtc::TimeNanos()), | 31         initial_timestamp_(rtc::TimeNanos()), | 
| 32         next_timestamp_(rtc::kNumNanosecsPerMillisec), | 32         next_timestamp_(rtc::kNumNanosecsPerMillisec), | 
| 33         is_screencast_(is_screencast), | 33         is_screencast_(is_screencast), | 
| 34         rotation_(webrtc::kVideoRotation_0) { | 34         rotation_(webrtc::kVideoRotation_0) { | 
| 35     // Default supported formats. Use ResetSupportedFormats to over write. | 35     // Default supported formats. Use ResetSupportedFormats to over write. | 
| 36     std::vector<cricket::VideoFormat> formats; | 36     std::vector<cricket::VideoFormat> formats; | 
| 37     formats.push_back(cricket::VideoFormat(1280, 720, | 37     formats.push_back(cricket::VideoFormat(1280, 720, | 
| 38         cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 38         cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 
| 39     formats.push_back(cricket::VideoFormat(640, 480, | 39     formats.push_back(cricket::VideoFormat(640, 480, | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102               width, height); | 102               width, height); | 
| 103     } | 103     } | 
| 104     next_timestamp_ += timestamp_interval; | 104     next_timestamp_ += timestamp_interval; | 
| 105 | 105 | 
| 106     return true; | 106     return true; | 
| 107   } | 107   } | 
| 108 | 108 | 
| 109   sigslot::signal1<FakeVideoCapturer*> SignalDestroyed; | 109   sigslot::signal1<FakeVideoCapturer*> SignalDestroyed; | 
| 110 | 110 | 
| 111   cricket::CaptureState Start(const cricket::VideoFormat& format) override { | 111   cricket::CaptureState Start(const cricket::VideoFormat& format) override { | 
| 112     cricket::VideoFormat supported; | 112     SetCaptureFormat(&format); | 
| 113     if (GetBestCaptureFormat(format, &supported)) { |  | 
| 114       SetCaptureFormat(&supported); |  | 
| 115     } |  | 
| 116     running_ = true; | 113     running_ = true; | 
| 117     SetCaptureState(cricket::CS_RUNNING); | 114     SetCaptureState(cricket::CS_RUNNING); | 
| 118     return cricket::CS_RUNNING; | 115     return cricket::CS_RUNNING; | 
| 119   } | 116   } | 
| 120   void Stop() override { | 117   void Stop() override { | 
| 121     running_ = false; | 118     running_ = false; | 
| 122     SetCaptureFormat(NULL); | 119     SetCaptureFormat(NULL); | 
| 123     SetCaptureState(cricket::CS_STOPPED); | 120     SetCaptureState(cricket::CS_STOPPED); | 
| 124   } | 121   } | 
| 125   bool IsRunning() override { return running_; } | 122   bool IsRunning() override { return running_; } | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 148   int64_t initial_timestamp_; | 145   int64_t initial_timestamp_; | 
| 149   int64_t next_timestamp_; | 146   int64_t next_timestamp_; | 
| 150   const bool is_screencast_; | 147   const bool is_screencast_; | 
| 151   rtc::Optional<bool> needs_denoising_; | 148   rtc::Optional<bool> needs_denoising_; | 
| 152   webrtc::VideoRotation rotation_; | 149   webrtc::VideoRotation rotation_; | 
| 153 }; | 150 }; | 
| 154 | 151 | 
| 155 }  // namespace cricket | 152 }  // namespace cricket | 
| 156 | 153 | 
| 157 #endif  // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 154 #endif  // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 
| OLD | NEW | 
|---|