Adds non-forwarding frame tap to video frame matcher.

Bug: webrtc:10839
Change-Id: I9cf348435db6edf7b2e81f262ffb6cb9b87cb98f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147273
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28723}
This commit is contained in:
Sebastian Jansson
2019-07-30 18:12:54 +02:00
committed by Commit Bot
parent 53571c75c6
commit e05ae5bbbb
2 changed files with 25 additions and 0 deletions

View File

@ -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,

View File

@ -76,6 +76,21 @@ class VideoFrameMatcher {
TaskQueueForTest task_queue_;
};
class CapturedFrameTap : public rtc::VideoSinkInterface<VideoFrame> {
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<VideoFrame>,
public rtc::VideoSourceInterface<VideoFrame> {