MediaEngine Class

MediaEngine is the lowest libjingle wrapper class around the third-party package that controls the render/capture hardware on the computer. MediaEngine is a virtual class that must be subclassed to work with specific third party applications (such as Linphone and GIPS). libjingle defines two subclasses: GipsLiteMediaEngine to work with GIPS, and LinphoneMediaEngine to work with Linphone. MediaEngine handles audio settings and creation of MediaChannels. You can create your own subclass if you have another media engine to use. MediaEngine is specialized for audio data, but you could use it as a model to support other media types. The methods shown are not thread-safe, and can be called on any thread, but you should call them from the signaling thread.

MediaEngine is created by ChannelManager when that object is instantiated. There is only one MediaEngine instance per libjingle application. No destructor is defined for this base class.


class MediaEngine 


Name Description
std::vector<Codec>& codecs() = 0 Retrieves a vector of Codec structs representing the codecs supported by the MediaEngine.
MediaChannel* CreateChannel() = 0 Creates a new MediaChannel subclass, representing the media stream for one session (peer-to-peer connection).
bool FindCodec(Codec &codec) = 0 Returns True if the submitted codec is supported by the underlying MediaEngine subclass. codec is the name of the codec to search for.
int GetCodecPreference(Codec codec) Returns an integer preference for a codec, where the higher the number is, the higher the preference.
virtual int GetInputLevel() = 0 Returns a volume level, specific to the implementation.
virtual bool Init() = 0 Initializes the media library and populates the engine's list of supported codecs. This is called by ChannelManager when ChannelManager is instantiated.
MediaEngine() Constructor. It performs no actions, and should be overridden by subclasses.
virtual SetAudioOptions(int options) = 0 Sets audio options found in the MediaEngineOptions enumeration. This isn't used by libjingle, but can be used by your application. options should be a MediaEngineOptions enumerated value described in the table below.
virtual int SetSoundDevices(int wave_in_device, int wave_out_device) = 0 Sets the sound hardware to use. This is specific to the implementation.
  • wave_in_device Pointer to an audio capture device.
  • wave_out_device Pointer to an audio rendering device.
virtual int Terminate()=0 Performs the opposite actions to Init, and releases resources used by MediaEngine. This is called by ChannelManager before destroying a MediaChannel object.


Name Description

Used by SetAudioOptions to specify various audio options. The following values are specified:

  • AUTO_GAIN_CONTROL   Enable auto gain control.


Attributes: public

Declaration file: libjingle-0.3.0/talk/session/phone/mediaengine.h