Public Member Functions

virtual ~IMediaEngine ()
 
virtual void release ()=0
 
virtual int registerAudioFrameObserver (IAudioFrameObserver *observer)=0
 
virtual int registerVideoFrameObserver (IVideoFrameObserver *observer)=0
 
virtual int registerVideoRenderFactory (IExternalVideoRenderFactory *factory)=0
 
virtual int pushAudioFrame (MEDIA_SOURCE_TYPE type, IAudioFrameObserver::AudioFrame *frame, bool wrap)=0
 
virtual int pushAudioFrame (IAudioFrameObserver::AudioFrame *frame)=0
 
virtual int pullAudioFrame (IAudioFrameObserver::AudioFrame *frame)=0
 
virtual int setExternalVideoSource (bool enable, bool useTexture)=0
 
virtual int pushVideoFrame (ExternalVideoFrame *frame)=0
 

Constructor & Destructor Documentation

◆ ~IMediaEngine()

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

Member Function Documentation

◆ release()

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

◆ registerAudioFrameObserver()

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

Registers an audio frame observer object.

This method is used to register an audio frame observer object (register a callback). This method is required to register callbacks when the engine is required to provide an onRecordAudioFrame or onPlaybackAudioFrame callback.

Parameters
observerAudio frame observer object instance. See IAudioFrameObserver. Set the value as NULL to release the audio observer object. Agora recommends calling registerAudioFrameObserver(NULL) after receiving the onLeaveChannel callback.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerVideoFrameObserver()

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

Registers a video frame observer object.

You need to implement the IVideoFrameObserver class in this method, and register callbacks according to your scenarios.

After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.

Note
When handling the video data returned in the callbacks, pay attention to the changes in the width and height parameters, which may be adapted under the following circumstances:
  • When the network condition deteriorates, the video resolution decreases incrementally.
  • If the user adjusts the video profile, the resolution of the video returned in the callbacks also changes.
Parameters
observerVideo frame observer object instance. If NULL is passed in, the registration is canceled.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerVideoRenderFactory()

virtual int agora::media::IMediaEngine::registerVideoRenderFactory ( IExternalVideoRenderFactory factory)
pure virtual

DEPRECATED

◆ pushAudioFrame() [1/2]

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

DEPRECATED Use pushAudioFrame(IAudioFrameObserver::AudioFrame* frame) instead.

Pushes the external audio frame.

Parameters
typeType of audio capture device: MEDIA_SOURCE_TYPE.
frameAudio frame pointer: AudioFrame.
wrapWhether to use the placeholder. We recommend setting the default value.
  • true: Use.
  • false: (Default) Not use.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pushAudioFrame() [2/2]

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

Pushes the external audio frame.

Parameters
framePointer to the audio frame: AudioFrame.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pullAudioFrame()

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

Pulls the remote audio data.

Before calling this method, call the setExternalAudioSink(enabled: true) method to enable and set the external audio sink.

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

Note
  • Once you call the pullAudioFrame method successfully, the app will not retrieve any audio data from the onPlaybackAudioFrame callback.
  • The difference between the onPlaybackAudioFrame callback and the pullAudioFrame method is as follows:
    • onPlaybackAudioFrame: The SDK sends the audio data to the app through this callback. 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
framePointers to the audio frame. See: AudioFrame.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setExternalVideoSource()

virtual int agora::media::IMediaEngine::setExternalVideoSource ( bool  enable,
bool  useTexture 
)
pure virtual

Configures the external video source.

Parameters
enableSets whether to use the external video source:
  • true: Use the external video source.
  • false: (Default) Do not use the external video source.
useTextureSets whether to use texture as an input:
  • true: Use texture as an input.
  • false: (Default) Do not use texture as an input.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pushVideoFrame()

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

Pushes the video frame using the ExternalVideoFrame and passes the video frame to the Agora SDK.

Parameters
frameVideo frame to be pushed. See ExternalVideoFrame.
Note
In the COMMUNICATION profile, this method does not support video frames in the Texture format.
Returns
  • 0: Success.
  • < 0: Failure.