Agora C++ API Reference for All Platforms
Public Member Functions | Protected Member Functions | List of all members
agora::media::IMediaEngine Class Referenceabstract

Inherited by agora::media::IMediaEngineEx.

Public Member Functions

virtual int registerAudioFrameObserver (IAudioFrameObserver *observer)=0
 
virtual int registerVideoFrameObserver (IVideoFrameObserver *observer)=0
 
virtual int registerVideoEncodedImageReceiver (rtc::IVideoEncodedImageReceiver *receiver)=0
 
virtual int pushAudioFrame (MEDIA_SOURCE_TYPE type, IAudioFrameObserver::AudioFrame *frame, bool wrap=false, int sourceId=0)=0
 
virtual int pullAudioFrame (IAudioFrameObserver::AudioFrame *frame)=0
 
virtual int setExternalVideoSource (bool enabled, bool useTexture, bool encodedFrame=false)=0
 
virtual int setExternalAudioSource (bool enabled, int sampleRate, int channels, int sourceNumber, bool localPlayback=false, bool publish=true)=0
 
virtual int pushVideoFrame (base::ExternalVideoFrame *frame)=0
 
virtual int pushVideoFrame (base::ExternalVideoFrame *frame, const rtc::RtcConnection &connection)=0
 
virtual int pushEncodedVideoImage (const uint8_t *imageBuffer, size_t length, const agora::rtc::EncodedVideoFrameInfo &videoEncodedFrameInfo)=0
 
virtual int pushEncodedVideoImage (const uint8_t *imageBuffer, size_t length, const agora::rtc::EncodedVideoFrameInfo &videoEncodedFrameInfo, const rtc::RtcConnection &connection)=0
 
virtual void release ()=0
 

Protected Member Functions

virtual ~IMediaEngine ()
 

Detailed Description

The IMediaEngine class.

Constructor & Destructor Documentation

◆ ~IMediaEngine()

virtual agora::media::IMediaEngine::~IMediaEngine ( )
inlineprotectedvirtual

Member Function Documentation

◆ registerAudioFrameObserver()

virtual int agora::media::IMediaEngine::registerAudioFrameObserver ( IAudioFrameObserver observer)
pure virtual

Registers an audio frame observer object.

Note
Ensure that you call this method before joinChannel.
Parameters
observerA pointer to the audio frame observer object: IAudioFrameObserver, nullptr means unregistering observer instead.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerVideoFrameObserver()

virtual int agora::media::IMediaEngine::registerVideoFrameObserver ( IVideoFrameObserver observer)
pure virtual

Registers a video frame observer object.

Note
  • Ensure that you call this method before joining the channel.
  • If you register an observer for video raw video data, you cannot register an IVideoEncodedImageReceiver object.
Parameters
observerA pointer to the video frame observer: IVideoFrameObserver.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerVideoEncodedImageReceiver()

virtual int agora::media::IMediaEngine::registerVideoEncodedImageReceiver ( rtc::IVideoEncodedImageReceiver receiver)
pure virtual

Registers a receiver object for the encoded video image.

Note
  • Ensure that you call this method before joining the channel.
  • If you register a receiver for encoded video data, you cannot register an IVideoFrameObserver object.
Parameters
receiverA pointer to the receiver of the encoded video image: IVideoEncodedImageReceiver.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pushAudioFrame()

virtual int agora::media::IMediaEngine::pushAudioFrame ( MEDIA_SOURCE_TYPE  type,
IAudioFrameObserver::AudioFrame frame,
bool  wrap = false,
int  sourceId = 0 
)
pure virtual

Pushes the external audio data to the app.

Parameters
typedeprecated.
frameThe audio buffer data.
wrapdeprecated.
sourceIdThe audio track ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pullAudioFrame()

virtual int agora::media::IMediaEngine::pullAudioFrame ( IAudioFrameObserver::AudioFrame frame)
pure virtual

Pulls the remote audio data.

After a successful method call, the app pulls the decoded and mixed audio data for playback.

The difference between this method and the onPlaybackAudioFrame is as follows:

  • onPlaybackAudioFrame: The SDK sends the audio data to the app once every 10 ms. Any delay in processing the audio frames may result in audio jitter.
  • pullAudioFrame: The app pulls the remote audio data. After setting the audio data parameters, the SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback.
Parameters
frameThe pointer to the audio frame: AudioFrame.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setExternalVideoSource()

virtual int agora::media::IMediaEngine::setExternalVideoSource ( bool  enabled,
bool  useTexture,
bool  encodedFrame = false 
)
pure virtual

Sets the external video source.

Once the external video source is enabled, the SDK prepares to accept the external video frame.

Parameters
enabledDetermines whether to enable the external video source.
  • true: Enable the external video source. Once set, the SDK creates the external source and prepares video data from pushVideoFrame or pushEncodedVideoImage.
  • false: Disable the external video source.
useTextureDetermines whether to use textured video data.
  • true: Use texture, which is not supported now.
  • False: Do not use texture.
encodedFrameDetermines whether the external video source is encoded.
  • true: The external video source is encoded.
  • false: The external video source is not encoded.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setExternalAudioSource()

virtual int agora::media::IMediaEngine::setExternalAudioSource ( bool  enabled,
int  sampleRate,
int  channels,
int  sourceNumber,
bool  localPlayback = false,
bool  publish = true 
)
pure virtual

Sets the external audio source.

Note
Ensure that you call this method before joining the channel.
Parameters
enabledDetermines whether to enable the external audio source:
  • true: Enable the external audio source.
  • false: (default) Disable the external audio source.
sampleRateThe Sample rate (Hz) of the external audio source, which can set be as 8000, 16000, 32000, 44100, or 48000.
channelsThe number of channels of the external audio source, which can be set as 1 or 2:
  • 1: Mono.
  • 2: Stereo.
sourceNumberThe number of the external audio sources, should be greater than 0.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pushVideoFrame() [1/2]

virtual int agora::media::IMediaEngine::pushVideoFrame ( base::ExternalVideoFrame frame)
pure virtual

Pushes the external video frame to the app.

Parameters
frameThe external video frame: ExternalVideoFrame.
channelIdThe channel name.
localUidID of the local user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pushVideoFrame() [2/2]

virtual int agora::media::IMediaEngine::pushVideoFrame ( base::ExternalVideoFrame frame,
const rtc::RtcConnection connection 
)
pure virtual

◆ pushEncodedVideoImage() [1/2]

virtual int agora::media::IMediaEngine::pushEncodedVideoImage ( const uint8_t *  imageBuffer,
size_t  length,
const agora::rtc::EncodedVideoFrameInfo videoEncodedFrameInfo 
)
pure virtual

Pushes the encoded video image to the app.

Parameters
imageBufferA pointer to the video image.
lengthThe data length.
videoEncodedFrameInfoThe reference to the information of the encoded video frame: EncodedVideoFrameInfo.
channelIdThe channel name.
localUidID of the local user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pushEncodedVideoImage() [2/2]

virtual int agora::media::IMediaEngine::pushEncodedVideoImage ( const uint8_t *  imageBuffer,
size_t  length,
const agora::rtc::EncodedVideoFrameInfo videoEncodedFrameInfo,
const rtc::RtcConnection connection 
)
pure virtual

◆ release()

virtual void agora::media::IMediaEngine::release ( )
pure virtual