diff --git a/test/scenario/video_frame_matcher.cc b/test/scenario/video_frame_matcher.cc index a1faa81d4c..912459183f 100644 --- a/test/scenario/video_frame_matcher.cc +++ b/test/scenario/video_frame_matcher.cc @@ -128,6 +128,16 @@ void VideoFrameMatcher::Finalize() { } } +CapturedFrameTap::CapturedFrameTap(Clock* clock, VideoFrameMatcher* matcher) + : clock_(clock), matcher_(matcher) {} + +void CapturedFrameTap::OnFrame(const VideoFrame& frame) { + matcher_->OnCapturedFrame(frame, clock_->CurrentTime()); +} +void CapturedFrameTap::OnDiscardedFrame() { + discarded_count_++; +} + ForwardingCapturedFrameTap::ForwardingCapturedFrameTap( Clock* clock, VideoFrameMatcher* matcher, diff --git a/test/scenario/video_frame_matcher.h b/test/scenario/video_frame_matcher.h index d27ed8f4b8..20a0ccca8b 100644 --- a/test/scenario/video_frame_matcher.h +++ b/test/scenario/video_frame_matcher.h @@ -76,6 +76,21 @@ class VideoFrameMatcher { TaskQueueForTest task_queue_; }; +class CapturedFrameTap : public rtc::VideoSinkInterface { + public: + CapturedFrameTap(Clock* clock, VideoFrameMatcher* matcher); + CapturedFrameTap(CapturedFrameTap&) = delete; + CapturedFrameTap& operator=(CapturedFrameTap&) = delete; + + void OnFrame(const VideoFrame& frame) override; + void OnDiscardedFrame() override; + + private: + Clock* const clock_; + VideoFrameMatcher* const matcher_; + int discarded_count_ = 0; +}; + class ForwardingCapturedFrameTap : public rtc::VideoSinkInterface, public rtc::VideoSourceInterface {