plugin::injector_paced

🚀

SDK Beta

This interface is a part of the Beta program.

Module: Default Media Injector Plugin

The interface for the Default Paced Media Injector.

#include <injector.h>

Inherits from dolbyio::comms::plugin::injector, dolbyio::comms::media_source_interface, dolbyio::comms::video_source, dolbyio::comms::audio_source

Public Functions

Name
~injector_paced()
voidstop_video_injection(bool force =true)
Stops the video injection pacing thread from taking video frames from the queue and injecting them into the conference. There are two options for stopping injection; the default option considered forceful stoppage will stop the video pacing thread immediately. Frames that are on the queue when a force stop is invoked remain. The second option considered graceful stoppage allows the caller to wait until all the frames on the queue are popped off by the video pacing thread, then stops the thread.
voidstop_audio_injection(bool force =true)
Stops the audio injection pacing thread from taking audio frames from the queue and injecting them into the conference. There are two options for stopping injection; the default option considered forceful stoppage will stop the audio pacing thread immediately. Frames that are on the queue when a force stop is invoked remain. The second option considered graceful stoppage allows the caller to wait until all the frames on the queue are popped off by the audio pacing thread, then stops the thread.
voidstart_video_injection()
Enables the video injection pacing thread for taking video frames from the queue and injecting them into the conference.
voidstart_audio_silence_injection(int sample_rate, int channels)
Start injecting audio silence into the conference. This should be used if the injection source wants to pause the injection of media while not removing the audio track. In order to keep AV sync on point when the media injection is resumed, calling this function will start the audio injection pacing thread to provide Webrtc with silent audio frames. The silence injection is stopped the same way as regular injection via the stop_audio_injection method.
voidstart_audio_injection()
Enables the audio injection pacing thread for taking audio frames from the queue and injecting them into the conference.
voidset_video_frame_interval(std::chrono::milliseconds interval)
Sets the video frame interval for injecting video frames into the conference. The pacing injector provides frames to Webrtc at the interval specified by this method, provided the frames are available on the queue.
injector_paced(media_injection_status_cb && status_cb)
Constructor for the passthrough injector.
virtual boolinject_video_frame(std::unique_ptr< video_frame > && frame) override
Inject a raw video frame into the conference. The video frame must contain YUV pixels.
virtual boolinject_audio_frame(std::unique_ptr< audio_frame > && frame) override
Inject an audio frame into the conference. The audio frame must contain 10ms of PCM data.
voidclear_video_queue()
Clears the video queue which is holding video frames awaiting their injection into conference. This method unblocks any threads which are blocked with the inject_video_frame method.
voidclear_audio_queue()
Clears the audio queue which is holding audio frames awaiting their injection into conference. This method unblocks any threads which are blocked with the inject_audio_frame method.

Additional inherited members

Public Types inherited from dolbyio::comms::plugin::injector

Name
using std::function< void(const media_injection_status &)>media_injection_status_cb

Public Functions inherited from dolbyio::comms::plugin::injector

Name
~injector()
The destructor of the injector.
injector(media_injection_status_cb && status_cb)
Constructor for the injector base abstract class.

Public Functions inherited from dolbyio::comms::media_source_interface

Name
virtual video_source *video() =0
Gets the video source interface. Override this method to provide access to the Video Source implementation.
virtual audio_source *audio() =0
Gets the audio source interface. Override this method to provide access to the Audio Source implementation.

Public Functions inherited from dolbyio::comms::video_source

Name
virtual voidregister_video_frame_rtc_source(rtc_video_source * source) =0
Connects the rtc_video_source to the video source, in essence creating the video injection pipeline. This method will be called by the media_engine when a Video Track is attached to the active Peer Connection.
virtual voidderegister_video_frame_rtc_source() =0
Disconnects the RTC Video Source from the Video Source, in essence destructing the video pipeline. This method is called by the media_engine whenever a Video Track is to be detached from the active Peer Connection.

Public Functions inherited from dolbyio::comms::audio_source

Name
virtual voidregister_audio_frame_rtc_source(rtc_audio_source * source) =0
Connects the RTC Audio Source to the audio source, in essence creating the audio injection pipeline. This method will be called by the media_engine when an Audio Track is attached to the active Peer Connection.
virtual voidderegister_audio_frame_rtc_source() =0
Disconnects the RTC Audio Source from the Audio Source, in essence destructing the audio pipeline. This method is called by the media_engine whenever an Audio Track is to be detached from the active Peer Connection.
class dolbyio::comms::plugin::injector_paced;

Public Functions Documentation

function ~injector_paced

~injector_paced()

Destructor of the paced injector.

function stop_video_injection

void stop_video_injection(
    bool force =true
)

Stops the video injection pacing thread from taking video frames from the queue and injecting them into the conference. There are two options for stopping injection; the default option considered forceful stoppage will stop the video pacing thread immediately. Frames that are on the queue when a force stop is invoked remain. The second option considered graceful stoppage allows the caller to wait until all the frames on the queue are popped off by the video pacing thread, then stops the thread.

Parameters:

  • force Boolean indicating whether to forcefully shutdown the video injection or wait for queue to become empty.

function stop_audio_injection

void stop_audio_injection(
    bool force =true
)

Stops the audio injection pacing thread from taking audio frames from the queue and injecting them into the conference. There are two options for stopping injection; the default option considered forceful stoppage will stop the audio pacing thread immediately. Frames that are on the queue when a force stop is invoked remain. The second option considered graceful stoppage allows the caller to wait until all the frames on the queue are popped off by the audio pacing thread, then stops the thread.

Parameters:

  • force Boolean indicating whether to forcefully shutdown the audio injection or wait for queue to be cleared.

function start_video_injection

void start_video_injection()

Enables the video injection pacing thread for taking video frames from the queue and injecting them into the conference.

function start_audio_silence_injection

void start_audio_silence_injection(
    int sample_rate,
    int channels
)

Start injecting audio silence into the conference. This should be used if the injection source wants to pause the injection of media while not removing the audio track. In order to keep AV sync on point when the media injection is resumed, calling this function will start the audio injection pacing thread to provide Webrtc with silent audio frames. The silence injection is stopped the same way as regular injection via the stop_audio_injection method.

Parameters:

  • sample_rate The sample rate of the audio stream which was being injected before being paused.
  • channels The number of channels of the audio stream which was being injected before being paused.

function start_audio_injection

void start_audio_injection()

Enables the audio injection pacing thread for taking audio frames from the queue and injecting them into the conference.

function set_video_frame_interval

void set_video_frame_interval(
    std::chrono::milliseconds interval
)

Sets the video frame interval for injecting video frames into the conference. The pacing injector provides frames to Webrtc at the interval specified by this method, provided the frames are available on the queue.

Parameters:

  • interval The frame interval in milliseconds.

function injector_paced

injector_paced(
    media_injection_status_cb && status_cb
)

Constructor for the passthrough injector.

Parameters:

  • status_cb Status callback function object, which the application should provide. The injector invokes the function object for any status changes it encounters and provide the media_injection_status object as a parameter. This callback is invoked on either of the injector's media injection thread, or possibly on the injection sources thread. Either way the application should ensure this callback is thread-safe.

function inject_video_frame

virtual bool inject_video_frame(
    std::unique_ptr< video_frame > && frame
) override

Inject a raw video frame into the conference. The video frame must contain YUV pixels.

Parameters:

  • frame The video frame.

Returns:

  • true On successful push of frame.
  • false On failure to push frame.

Attention: This method blocks the calling thread when the video queue is full.

Reimplements: dolbyio::comms::plugin::injector::inject_video_frame

The desired frame interval for injecting the frames into Webrtc conference should be configured via the set_video_frame_interval method. The video frames are queued and provided to Webrtc every frame interval. The queue can hold up to 10 video frames; once the queue fills this function blocks the calling thread until space on the queue is available.

function inject_audio_frame

virtual bool inject_audio_frame(
    std::unique_ptr< audio_frame > && frame
) override

Inject an audio frame into the conference. The audio frame must contain 10ms of PCM data.

Parameters:

  • frame Audio frame containing raw PCM data.

Returns:

  • true On successful push of frame.
  • false On failure to push frame.

Reimplements: dolbyio::comms::plugin::injector::inject_audio_frame

This method can be called more often than every 10ms. The audio frames are queued and provided to Webrtc every 10ms. The queue can hold up to 1 second of audio; once the queue fills, this function blocks the calling thread until space on the queue is available.

function clear_video_queue

void clear_video_queue()

Clears the video queue which is holding video frames awaiting their injection into conference. This method unblocks any threads which are blocked with the inject_video_frame method.

function clear_audio_queue

void clear_audio_queue()

Clears the audio queue which is holding audio frames awaiting their injection into conference. This method unblocks any threads which are blocked with the inject_audio_frame method.



Did this page help you?