#pragma once #include "pc/video_track_source.h" template class VideoFilter : public webrtc::VideoTrackSource { public: static rtc::scoped_refptr Create(rtc::scoped_refptr videoSource, const std::map &opts) { std::unique_ptr source = absl::WrapUnique(new T(videoSource, opts)); if (!source) { return nullptr; } return new rtc::RefCountedObject(std::move(source)); } protected: explicit VideoFilter(std::unique_ptr source) : webrtc::VideoTrackSource(/*remote=*/false), m_source(std::move(source)) {} SourceState state() const override { return kLive; } bool GetStats(Stats* stats) override { bool result = false; T* source = m_source.get(); if (source) { // stats->input_height = source->height(); // stats->input_width = source->width(); result = true; } return result; } private: rtc::VideoSourceInterface* source() override { return m_source.get(); } std::unique_ptr m_source; };