Ignore:
Timestamp:
Mar 17, 2011 4:34:43 AM (11 years ago)
Author:
bennylp
Message:

Modifications in PJSUA-LIB to support multiple media streams (multiple audio and/or video) and dynamic creation of media transports. This closed #1185 and closed #1201.

1185: Dynamic creation of media transports
============================================
Done:

  • media transports are created on demand now

Todo:

  • media transport creation is still blocking

1201: Video support in PJSUA-LIB
===================================
Done:

  • call now supports N media (N audio and M video)
  • number of audio/video streams is configurable per acc
  • extra audio stream info in pjsua_call_info to support multiple audio streams

in one call

  • video subsys and ffmpeg initialization in PJSUA-LIB
  • ability to offer and create video SDP answer
  • "dq" for more than 1 audio streams
  • introducing pjsua_state and pjsua_get_state()

API change:

  • on_stream_created() and on_stream_destroyed() callbacks: changed session to

stream

Todo:

  • many others features are disabled, just search for DISABLED_FOR_TICKET_1185

macro (these have also been added to ticket #1193 (Issues & Todos)). Notable
missing features are:

  • creation of duplicate SDP m= lines for optional SRTP
  • mm.. that's it?
  • whole lot of testings

pjsua:
===============

  • Added --extra-audio and --video options. Specify these more than once and

each time an extra audio/video streams will be added. :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua.h

    r3366 r3457  
    251251#define PJSUA_INVALID_ID            (-1) 
    252252 
     253/** Disabled features temporarily for media reorganization */ 
     254#define DISABLED_FOR_TICKET_1185        0 
     255 
    253256/** Call identification */ 
    254257typedef int pjsua_call_id; 
     
    282285#   define PJSUA_ACC_MAX_PROXIES    8 
    283286#endif 
    284  
    285 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
    286287 
    287288/** 
     
    304305#endif 
    305306 
    306 #endif 
    307  
    308307/** 
    309308 * Controls whether PJSUA-LIB should add ICE media feature tag 
     
    325324#   define PJSUA_ACQUIRE_CALL_TIMEOUT 2000 
    326325#endif 
     326 
     327 
     328/** 
     329 * This enumeration represents pjsua state. 
     330 */ 
     331typedef enum pjsua_state 
     332{ 
     333    /** 
     334     * The library has not been initialized. 
     335     */ 
     336    PJSUA_STATE_NULL, 
     337 
     338    /** 
     339     * After pjsua_create() is called but before pjsua_init() is called. 
     340     */ 
     341    PJSUA_STATE_CREATED, 
     342 
     343    /** 
     344     * After pjsua_init() is called but before pjsua_start() is called. 
     345     */ 
     346    PJSUA_STATE_INIT, 
     347 
     348    /** 
     349     * After pjsua_start() is called but before everything is running. 
     350     */ 
     351    PJSUA_STATE_STARTING, 
     352 
     353    /** 
     354     * After pjsua_start() is called and before pjsua_destroy() is called. 
     355     */ 
     356    PJSUA_STATE_RUNNING, 
     357 
     358    /** 
     359     * After pjsua_destroy() is called but before the function returns. 
     360     */ 
     361    PJSUA_STATE_CLOSING 
     362 
     363} pjsua_state; 
    327364 
    328365 
     
    484521     * 
    485522     * @param call_id       Call identification. 
    486      * @param sess          Media session for the call. 
     523     * @param strm          Media stream. 
    487524     * @param stream_idx    Stream index in the media session. 
    488525     * @param p_port        On input, it specifies the media port of the 
     
    492529     */ 
    493530    void (*on_stream_created)(pjsua_call_id call_id,  
    494                               pjmedia_session *sess, 
     531                              pjmedia_stream *strm, 
    495532                              unsigned stream_idx,  
    496533                              pjmedia_port **p_port); 
     
    501538     * 
    502539     * @param call_id       Call identification. 
    503      * @param sess          Media session for the call. 
     540     * @param strm          Media stream. 
    504541     * @param stream_idx    Stream index in the media session. 
    505542     */ 
    506543    void (*on_stream_destroyed)(pjsua_call_id call_id, 
    507                                 pjmedia_session *sess,  
     544                                pjmedia_stream *strm, 
    508545                                unsigned stream_idx); 
    509546 
     
    11551192    pj_str_t        user_agent; 
    11561193 
    1157 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
    11581194    /** 
    11591195     * Specify default value of secure media transport usage.  
     
    11851221 
    11861222    /** 
    1187      * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose  
     1223     * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose 
    11881224     * duplicated media in SDP offer, i.e: unsecured and secured version. 
    1189      * Otherwise, the SDP media will be composed as unsecured media but  
     1225     * Otherwise, the SDP media will be composed as unsecured media but 
    11901226     * with SDP "crypto" attribute. 
    11911227     * 
     
    11931229     */ 
    11941230    pj_bool_t        srtp_optional_dup_offer; 
    1195 #endif 
    11961231 
    11971232    /** 
     
    13511386 */ 
    13521387PJ_DECL(pj_status_t) pjsua_destroy(void); 
     1388 
     1389 
     1390/** 
     1391 * Retrieve pjsua state. 
     1392 * 
     1393 * @return      pjsua state. 
     1394 */ 
     1395PJ_DECL(pjsua_state) pjsua_get_state(void); 
    13531396 
    13541397 
     
    20942137#endif 
    20952138 
    2096  
    20972139/** 
    20982140 * This structure describes account configuration to be specified when 
     
    23852427    pj_str_t         ka_data; 
    23862428 
    2387 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     2429    /** 
     2430     * Maximum number of simultaneous active audio streams to be allowed 
     2431     * for calls on this account. Setting this to zero will disable audio 
     2432     * in calls on this account. 
     2433     * 
     2434     * Default: 1 
     2435     */ 
     2436    unsigned         max_audio_cnt; 
     2437 
     2438    /** 
     2439     * Maximum number of simultaneous active video streams to be allowed 
     2440     * for calls on this account. Setting this to zero will disable video 
     2441     * in calls on this account. 
     2442     * 
     2443     * Default: 0 
     2444     */ 
     2445    unsigned         max_video_cnt; 
     2446 
     2447    /** 
     2448     * Media transport config. 
     2449     */ 
     2450    pjsua_transport_config rtp_cfg; 
     2451 
    23882452    /** 
    23892453     * Specify whether secure media transport should be used for this account. 
     
    24092473 
    24102474    /** 
    2411      * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose  
     2475     * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose 
    24122476     * duplicated media in SDP offer, i.e: unsecured and secured version. 
    2413      * Otherwise, the SDP media will be composed as unsecured media but  
     2477     * Otherwise, the SDP media will be composed as unsecured media but 
    24142478     * with SDP "crypto" attribute. 
    24152479     * 
     
    24172481     */ 
    24182482    pj_bool_t        srtp_optional_dup_offer; 
    2419 #endif 
    24202483 
    24212484    /** 
     
    29212984typedef enum pjsua_call_media_status 
    29222985{ 
    2923     /** Call currently has no media */ 
     2986    /** 
     2987     * Call currently has no media, or the media is not used. 
     2988     */ 
    29242989    PJSUA_CALL_MEDIA_NONE, 
    29252990 
    2926     /** The media is active */ 
     2991    /** 
     2992     * The media is active 
     2993     */ 
    29272994    PJSUA_CALL_MEDIA_ACTIVE, 
    29282995 
    2929     /** The media is currently put on hold by local endpoint */ 
     2996    /** 
     2997     * The media is currently put on hold by local endpoint 
     2998     */ 
    29302999    PJSUA_CALL_MEDIA_LOCAL_HOLD, 
    29313000 
    2932     /** The media is currently put on hold by remote endpoint */ 
     3001    /** 
     3002     * The media is currently put on hold by remote endpoint 
     3003     */ 
    29333004    PJSUA_CALL_MEDIA_REMOTE_HOLD, 
    29343005 
    2935     /** The media has reported error (e.g. ICE negotiation) */ 
     3006    /** 
     3007     * The media has reported error (e.g. ICE negotiation) 
     3008     */ 
    29363009    PJSUA_CALL_MEDIA_ERROR 
    29373010 
     
    29833056    pjsua_call_media_status media_status; 
    29843057 
    2985     /** Media direction */ 
     3058    /** Number of active audio streams in this call */ 
     3059    unsigned            audio_cnt; 
     3060 
     3061    /** Media direction of the first audio stream. */ 
    29863062    pjmedia_dir         media_dir; 
    29873063 
    2988     /** The conference port number for the call */ 
     3064    /** The conference port number for the first audio stream. */ 
    29893065    pjsua_conf_port_id  conf_slot; 
     3066 
     3067    /** Array of audio media stream information */ 
     3068    struct 
     3069    { 
     3070        /** Media index in SDP. */ 
     3071        unsigned                index; 
     3072 
     3073        /** Call media status. */ 
     3074        pjsua_call_media_status media_status; 
     3075 
     3076        /** Media direction. */ 
     3077        pjmedia_dir             media_dir; 
     3078 
     3079        /** The conference port number for the call. */ 
     3080        pjsua_conf_port_id      conf_slot; 
     3081 
     3082    } audio[4]; 
    29903083 
    29913084    /** Up-to-date call connected duration (zero when call is not  
     
    30833176 
    30843177 
     3178#if DISABLED_FOR_TICKET_1185 
    30853179/** 
    30863180 * Retrieve the media session associated with this call. Note that the media 
     
    30963190PJ_DECL(pjmedia_session*) pjsua_call_get_media_session(pjsua_call_id call_id); 
    30973191 
    3098  
    30993192/** 
    31003193 * Retrieve the media transport instance that is used for this call.  
     
    31073200 */ 
    31083201PJ_DECL(pjmedia_transport*) pjsua_call_get_media_transport(pjsua_call_id cid); 
    3109  
     3202#endif /* DISABLED_FOR_TICKET_1185 */ 
    31103203 
    31113204/** 
     
    48834976                                            const pjmedia_codec_param *param); 
    48844977 
    4885  
    4886  
    4887  
     4978#if DISABLED_FOR_TICKET_1185 
    48884979/** 
    48894980 * Create UDP media transports for all the calls. This function creates 
     
    49175008                               unsigned count, 
    49185009                               pj_bool_t auto_delete); 
     5010#endif 
    49195011 
    49205012 
Note: See TracChangeset for help on using the changeset viewer.