Rewrite FakeVideoTrackSource to not use VideoCapturer.

Bug: webrtc:6353
Change-Id: I992048868eebca1889e697950003b537b344bb53
Reviewed-on: https://webrtc-review.googlesource.com/49163
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21955}
This commit is contained in:
Niels Möller 2018-02-08 09:44:42 +01:00 committed by Commit Bot
parent 8595993c5b
commit 6f7bc08457

View File

@ -12,11 +12,13 @@
#define PC_TEST_FAKEVIDEOTRACKSOURCE_H_
#include "api/mediastreaminterface.h"
#include "media/base/fakevideocapturer.h"
#include "api/videosourceinterface.h"
#include "pc/videotracksource.h"
namespace webrtc {
// A minimal implementation of VideoTrackSource, which doesn't produce
// any frames.
class FakeVideoTrackSource : public VideoTrackSource {
public:
static rtc::scoped_refptr<FakeVideoTrackSource> Create(bool is_screencast) {
@ -27,20 +29,24 @@ class FakeVideoTrackSource : public VideoTrackSource {
return Create(false);
}
cricket::FakeVideoCapturer* fake_video_capturer() {
return &fake_video_capturer_;
}
bool is_screencast() const override { return is_screencast_; }
protected:
explicit FakeVideoTrackSource(bool is_screencast)
: VideoTrackSource(&fake_video_capturer_, false /* remote */),
: VideoTrackSource(&source_, false /* remote */),
is_screencast_(is_screencast) {}
virtual ~FakeVideoTrackSource() {}
private:
cricket::FakeVideoCapturer fake_video_capturer_;
class Source : public rtc::VideoSourceInterface<VideoFrame> {
public:
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {}
void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {}
};
Source source_;
const bool is_screencast_;
};