OpenTera WebRTC API (C++) 1.2.6
EncodedVideoSink.h
1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_ENCODED_VIDEO_SINK_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_ENCODED_VIDEO_SINK_H
3 
4 #include <api/video/recordable_encoded_frame.h>
5 #include <api/video/video_sink_interface.h>
6 
7 namespace opentera
8 {
9  enum class VideoCodecType
10  {
11  Generic = 0,
12  VP8,
13  VP9,
14  AV1,
15  H264,
16  Multiplex,
17  };
18 
19  using EncodedVideoSinkCallback = std::function<void(
20  const uint8_t* data,
21  size_t dataSize,
22  VideoCodecType codecType,
23  bool isKeyFrame,
24  uint32_t width,
25  uint32_t height,
26  uint64_t timestampUs)>;
27 
31  class EncodedVideoSink : public rtc::VideoSinkInterface<webrtc::RecordableEncodedFrame>
32  {
33  EncodedVideoSinkCallback m_onFrameReceived;
34 
35  public:
36  explicit EncodedVideoSink(EncodedVideoSinkCallback onFrameReceived);
37 
38  void OnFrame(const webrtc::RecordableEncodedFrame& frame) override;
39  };
40 }
41 
42 #endif
Class that sinks frame from a webrtc stream.
Definition: EncodedVideoSink.h:32
EncodedVideoSink(EncodedVideoSinkCallback onFrameReceived)
Construct a VideoSink.
Definition: EncodedVideoSink.cpp:15
void OnFrame(const webrtc::RecordableEncodedFrame &frame) override
Process incoming frames from webrtc.
Definition: EncodedVideoSink.cpp:28