#pragma once #include #include #include "../include/cap_interface.h" class COverlayVideo:public IOverlayVideo,public rtc::VideoSourceInterface { public: COverlayVideo(); virtual void OnVideoData(const webrtc::VideoFrame& frame) override; virtual void AddOrUpdateSink(rtc::VideoSinkInterface* sink, const rtc::VideoSinkWants& wants) override; virtual void RemoveSink(rtc::VideoSinkInterface* sink) override; private: rtc::VideoBroadcaster _broadcaster; }; class COverlayTrackSource :public webrtc::VideoTrackSource { public: static rtc::scoped_refptr Create(std::unique_ptr capturer) { return new rtc::RefCountedObject(std::move(capturer)); } protected: explicit COverlayTrackSource(std::unique_ptr capturer) : VideoTrackSource(false), capturer_(std::move(capturer)) {} ~COverlayTrackSource() { //capturer_->Stop(); } private: rtc::VideoSourceInterface* source() override { return capturer_.get(); } std::unique_ptr capturer_; }; rtc::scoped_refptr OpenOverlayVideoTrack(IOverlayVideo*); IOverlayVideo* CreateOverlayVideo();