Encoded Video

#include <dolbyio/comms/media_engine/media_engine.h>

The interface for handling encoded video frames. Application must set listeners which override both of the virtual functions. The handle_frame_encoded function is called after the RTP data is depacktized and an encoded frame is constructed. This function will be executed on the Webrtc DecodingQueue thread created for the track to which the encoded frames belong. The Encoded Video Sink must be provided to the SDK using the Set Encoded Sink function.

class video_sink_encoded

The interface for receiving the encoded video frames.

Subclassed by dolbyio::comms::plugin::recorder

Public Types

enum class decoder_config

The desired configuration of the decoder passing frames to this encoded sink.


enumerator full_decoding

The decoder will decode every single frame. In this case applications can connect both a video_sink and a video_sink_encoded to recieve video streams. This allows them to both dump video to file and render it on screen for instance.

enumerator optimized_decoding

The decoder will only decode the first frame. In this case applications will not receive any decoded video frames if they set a video_sink. This decoder configuration greatly optimized CPU load by not decoding every frame but is useful for applications which only want to dump encoded video to file.

Public Functions

virtual decoder_config configure_encoded_sink(const std::string &codec, const std::string &track_id) = 0

The callback that is invoked when a new video track is available. The callback allows setting the corresponding codec for the video track.

  • codec – The codec of the video track.

  • track_id – The ID of the video track.

Return values:
  • true – The sink would like to use optimized decoding, meaning that all incoming video frames are discarded and not decoded after being passed to the handle_frame_encoded function.

  • false – The sink would like to use full decoding, meaning that all the incoming frames are decoded.

virtual decoder_config decoder_configuration() const = 0

The callback that is invoked to check the set decoder configuration. This allows the SDK to check if optimized decoding has been configured, if optimized decoding is set then the decoder will only decode the first frame. This means that applications can only connect an encoded video sink. When using full_decoding an application can connect a video_sink and an video_sink_encoded so it can render video frames and also dump them to file for instance.


The desired decoder configuration for the Encoded Video Sink.

virtual void handle_frame_encoded(const std::string &track_id, std::unique_ptr<encoded_video_frame> frame) = 0

The callback that is invoked when a new encoded video frame is ready to be processed.

  • track_id – The ID of the video track.

  • frame – The encoded video frame.

class encoded_video_frame

The interface that wraps encoded video frames received from the conference.

Public Functions

virtual ~encoded_video_frame() = default
virtual const uint8_t *data() const = 0

Returns the binary data containing the frame payload.


The non-null pointer to the payload data.

virtual size_t size() const = 0

Returns the size of the payload.


The size of the payload in bytes.

virtual int width() const = 0

Gets the width of the frame.


The width of the frame.

virtual int height() const = 0

Gets the height of the video frame.


The height of the frame.

virtual bool is_keyframe() const = 0

Checks if the frame is a key frame.


true if keyframe, false otherwise.

See Example Recorder Implementation for a template for child recording class for all possible media.