Question

I'm writing an application using pjsip and I need to receive application-specific RTCP packets. I'm looking at the implementation of pjmedia_rtcp_rx_rtcp (in pjmedia/src/pjmedia/rtcp.c) and it only seems to handle certain RTCP packets and does not have a case for application-specific types. In case of an unknown packet type, it would just produce a "Received unknown RTCP packet" diagnostic message.

It looks like I may be able to install my own handler for received RTCP packets, using pjmedia_transport_attach. However, this would be called for all received RTCP packets, instead of just for application-specific ones. [Perhaps I could call the previous handler if it's not an app-specific packet, this needs further investigation.]

Is it possible to make pjsip call a callback on application-specific RTCP packets? And if not, how can I handle such RTCP packets while still using pjsip?

Was it helpful?

Solution

Although pjsip does not support application-specific RTCP packets directly, there is a way to capture all received RTCP packets and act upon those that are application-specific.

The first step is to create a Media Transport Adapter which sits between the stream and the network transport (UDP). You can create and attach one of these in the on_create_media_transport callback.

Next, in your implementation of the attach callback, call pjmedia_transport_attach() passing your own callback functions for RTP and RTCP receiving, saving the original callbacks requested in the callback arguments. Exact details can be found in the transport_adapter_sample.c (see function transport_attach).

Finally, your implementation of the RTCP callback (transport_rtcp_cb in transport_adapter_sample.c) can do whatever it wants with the received RTCP packet before passing it on to the original callback.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top