Index: webrtc/test/frame_generator.cc |
diff --git a/webrtc/test/frame_generator.cc b/webrtc/test/frame_generator.cc |
index ed7e95a12679d2abc36da2e56a4e194206c7d198..dbf39c4e096f8c64a9b1b7ab4e2bf65ea5816c97 100644 |
--- a/webrtc/test/frame_generator.cc |
+++ b/webrtc/test/frame_generator.cc |
@@ -239,6 +239,27 @@ class ScrollingImageFrameGenerator : public FrameGenerator { |
} // namespace |
+FrameForwarder::FrameForwarder() : sink_(nullptr) {} |
+ |
+void FrameForwarder::IncomingCapturedFrame(const VideoFrame& video_frame) { |
+ rtc::CritScope lock(&crit_); |
+ if (sink_) |
+ sink_->OnFrame(video_frame); |
+} |
+ |
+void FrameForwarder::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
+ const rtc::VideoSinkWants& wants) { |
+ rtc::CritScope lock(&crit_); |
+ RTC_DCHECK(!sink_ || sink_ == sink); |
+ sink_ = sink; |
+} |
+ |
+void FrameForwarder::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) { |
+ rtc::CritScope lock(&crit_); |
+ RTC_DCHECK_EQ(sink, sink_); |
+ sink_ = nullptr; |
+} |
+ |
FrameGenerator* FrameGenerator::CreateChromaGenerator(size_t width, |
size_t height) { |
return new ChromaGenerator(width, height); |