MediaChannel Class

Transports peer-to-peer data between P2PTransportChannel (wrapped by VoiceChannel) and the hardware (wrapped by a MediaEngine subclass). This is a virtual class that must be implemented by a subclass for each MediaEngine subclass. This object is created by MediaEngine at the request of ChannelManager. Each VoiceChannel object has its own MediaChannel object. The methods shown are not thread-safe, and can be called on any thread.


class MediaChannel : public sigslot::has_slots<>


Name Description

This interface defines a single method, SendPacket, which is called by the MediaEngine subclass to send a packet of data to the P2PTransportChannel through VoiceChannel.

void SendPacket(const void *data, size_t len) = 0
Sends a block of data of size_t bytes out to the other computer. This method is implemented by VoiceChannel.


Name Description
virtual int GetOutputLevel() = 0 Returns a number indicating the output volume.
MediaChannel() Constructor. Sets the initial network interface to NULL; you must call SetInterface before you can use the object.
~MediaChannel Destructor.
NetworkInterface* network_interface() Returns the NetworkInterface object used to send peer-to-peer data to another computer.
virtual void OnPacketReceived(const void *data, int len)=0 Called by VoiceChannel with an incoming packet of audio data.
virtual void SetCodecs(const std::vector<Codec> &codecs)=0 Specifies the codecs that the MediaEngine should use.
void SetInterface(NetworkInterface *iface) Sets the NetworkInterface object that handles sending packets of data. VoiceChannel calls this method, passing in a pointer to itself.
virtual void SetPlayout(bool playout)=0 Specifies whether to enable audio rendering. True means that it should be enabled.
virtual void SetSend(bool send)=0 Specifies whether to enable audio capture. True means that it should be enabled.


Attributes: public

Declaration file: talk/session/phone/mediachannel.h