OpenTera WebRTC API (C++) 1.2.6
VideoSink.h
1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_VIDEO_SINK_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_VIDEO_SINK_H
3 
4 #include <api/video/video_frame.h>
5 #include <api/video/video_sink_interface.h>
6 #include <api/video/video_source_interface.h>
7 #include <opencv2/core.hpp>
8 
9 namespace opentera
10 {
11 
12  using VideoSinkCallback = std::function<void(const cv::Mat&, uint64_t)>;
13 
17  class VideoSink : public rtc::VideoSinkInterface<webrtc::VideoFrame>
18  {
19  VideoSinkCallback m_onFrameReceived;
20  rtc::VideoSinkWants m_wants;
21  cv::Mat m_bgrImg;
22  cv::Mat m_bgrRotatedImg;
23 
24  public:
25  explicit VideoSink(VideoSinkCallback onFrameReceived);
26 
27  void OnFrame(const webrtc::VideoFrame& frame) override;
28  [[nodiscard]] rtc::VideoSinkWants wants() const;
29  };
30 
35  inline rtc::VideoSinkWants VideoSink::wants() const { return m_wants; }
36 
37 }
38 
39 #endif
Class that sinks frame from a webrtc stream.
Definition: VideoSink.h:18
void OnFrame(const webrtc::VideoFrame &frame) override
Process incoming frames from webrtc.
Definition: VideoSink.cpp:34
VideoSink(VideoSinkCallback onFrameReceived)
Construct a VideoSink.
Definition: VideoSink.cpp:17
rtc::VideoSinkWants wants() const
get frame requirements for this sink
Definition: VideoSink.h:35