Opened 7 years ago

Closed 7 years ago

#1463 closed enhancement (fixed)

Separation of PJMEDIA specific implementation to support third party media stack/library in PJSUA-LIB

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.0-rc
Component: pjsua-lib Version: trunk
Keywords: 3rd party media Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

This ticket implements support for integrating third party media stack into PJSUA-LIB. By following these steps below, application can use third party media stack to perform audio and video functionality while still making use of the full SIP, NAT, and security (including SRTP) features provided by PJSUA-LIB API.

By disabling PJMEDIA, the following features will not be available in PJSUA-LIB (unless the equivalent implementation is provided by the third party media library):

  • sound device management
  • echo cancellation
  • codecs
  • jitter buffer
  • RTP and RTCP
  • WAV playback and recording
  • conference bridge
  • DTMF with RFC 2833
  • and so on, except explicitly mentioned below

The following features will still be available:

  • all SIP features, including SIP registration, etc.
  • SDP and SDP negotiation
  • NAT traversal features (including ICE)
  • security features including TLS and SRTP
  • media transports

Follow these steps to integrate third party media library with PJSUA-LIB:

  1. Declare this in pjlib/include/pj/config_site.h:
    #define PJSUA_MEDIA_HAS_PJMEDIA    0
    
    to exclude PJMEDIA specific implementation from PJSUA-LIB library. Understandably you will loose all media features in PJSUA-LIB (this will be handled by your third party media stack).
  2. Also copy suggested settings from pjsip-apps/src/3rdparty_media_sample/config_site.h into pjlib/include/pj/config_site.h. These settings are mostly used to exclude unneeded media components from the link process.
  3. Build the libraries, but this time using
    $ make lib
    
    instead of just make or make all. This is because most samples will no longer build due to missing media in PJSUA-LIB, hence normal make will fail on these apps. The make lib command only builds the libraries and unit tests for the libraries.
  4. Go to directory pjsip-apps/src/3rdparty_media_sample. This is a sample application with hook points to integrate third party media library. Fill in the media implementation in the alt_pjsua_xxx.c files, following the "TODO" notes. Run make to build the application. Once it's built, run alt_pjsua just as you run the usual pjsua application (it's essentially the same app!).

Change History (9)

comment:1 Changed 7 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 7 years ago by bennylp

In r3982: Initial work and it works, tested on Linux. Details:

  • add PJSUA_MEDIA_HAS_PJMEDIA macro
  • move pjmedia specific implementation in pjsua_media.c and pjsua_call.c into pjsua_aud.c
  • add pjsip-apps/src/third_party_media sample containing:
    • alt_pjsua_aud.c
    • alt_pjsua_vid.c
  • moved pjmedia_vid_stream_info_from_sdp() into pjmedia/vid_stream_info.c
  • moved pjmedia_stream_info_from_sdp() into pjmedia/stream_info.c
  • misc: fixed mips_test.c if codecs are disabled

comment:3 Changed 7 years ago by bennylp

(In [3983]) Re #1463 (3rd party media stack support): added the sample app in pjsip-apps/src/3rdparty_media_sample

comment:4 Changed 7 years ago by bennylp

  • Description modified (diff)

comment:5 Changed 7 years ago by bennylp

  • Description modified (diff)

comment:6 Changed 7 years ago by bennylp

(In [3984]) Re #1463 (3rd party media support): fixed the top most Makefile

comment:7 Changed 7 years ago by nanang

(In [3985]) Re #1463 (3rd party media support): fixed VS2005 project setting for newly added files (pjmedia/stream_info.c, pjmedia/vid_stream_info.c, pjsua-lib/pjsua_aud.c).

comment:8 Changed 7 years ago by bennylp

(In [3994]) Fixed wrong use of CC variable in Makefile (re #1463)

comment:9 Changed 7 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.