{{{ #!html
}}} = Media Transport Adapter = '''Table of Contents''' [[PageOutline(2-3,,inline)]] This article describes the media transport adapter and how to implement and integrate your custom adapter to your application. [[BR]] == Introduction == '''Media transport''' is an object to connect the media application to the network. The most obvious tasks of the media transport are of course to send and receive RTP and RTCP packets. But media transports task can be more than that; the ICE media transport, for example, also takes care of NAT traversal, while the SRTP transport secures your media communication. See [http://www.pjsip.org/docs/latest/pjmedia/docs/html/group__PJMEDIA__TRANSPORT.htm Media Transport reference documentation] for more info. The media transport also has access to SDP during SDP negotiation; it has access to both local and remote offer and answer, and may add or modify local SDP offer or answer. But note that this feature is only available if PJSUA-LIB is used at the higher level. '''Media transport adapter''' is a variant of media transport, where instead of transmitting and receiving packets directly to/from the network, it uses another media transport to do that. The adapter is installed between the media stream object and another transport adapter, and have full access to the RTP/RTCP packets that are exchanged between the two. The adapter may even inject it's own packets to either direction if it wants to, or drop them. Because of this arrangement, the obvious use of the adapter is to add processing to the media packets without having to be burdened with the actual management of the network. Once the adapter is implemented, it will immediately be able to take advantage of existing and future media transports in PJMEDIA, such as UDP and ICE media transports, including other transport adapters! The SRTP support is implemented as a media transport adapter. Apart from the actual encoding and decoding of packets, it also reads and writes the SDP session descriptor, and the mechanism provided by the media transport API is capable to support this. [[BR]] = Implementing Your Own Adapter = The following steps provide rough guidance to implementing your own adapter: - start with the transport adapter sample from pjmedia directory. - copy this to your application directory (you don't need to work in pjmedia directory) - implement the media transport operations as necessary. See the media transport reference documentation for more information. - integrate your adapter to your PJSUA-LIB based application (see the next section) = Integrating Your Adapter = The following step(s) show how to integrate your adapter so that it can be recognized by PJSUA-LIB and used for your application: - implement {{{on_create_media_transport()}}} callback. This callback notifies application when media transport needs to be created. Please note the following: - the callback is only available in version 1.12 or later. - {{{ #!html
}}}