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/src/pjsua-lib/pjsua_core.c

    r3366 r3457  
    104104    cfg->force_lr = PJ_TRUE; 
    105105    cfg->enable_unsolicited_mwi = PJ_TRUE; 
    106 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
    107106    cfg->use_srtp = PJSUA_DEFAULT_USE_SRTP; 
    108107    cfg->srtp_secure_signaling = PJSUA_DEFAULT_SRTP_SECURE_SIGNALING; 
    109 #endif 
    110108    cfg->hangup_forked_call = PJ_TRUE; 
    111109 
     
    177175    cfg->ka_interval = 15; 
    178176    cfg->ka_data = pj_str("\r\n"); 
    179 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     177    cfg->max_audio_cnt = 1; 
     178    pjsua_transport_config_default(&cfg->rtp_cfg); 
    180179    cfg->use_srtp = pjsua_var.ua_cfg.use_srtp; 
    181180    cfg->srtp_secure_signaling = pjsua_var.ua_cfg.srtp_secure_signaling; 
    182181    cfg->srtp_optional_dup_offer = pjsua_var.ua_cfg.srtp_optional_dup_offer; 
    183 #endif 
    184182    cfg->reg_retry_interval = PJSUA_REG_RETRY_INTERVAL; 
    185183    cfg->contact_rewrite_method = PJSUA_CONTACT_REWRITE_METHOD; 
     
    224222} 
    225223 
    226  
    227224/***************************************************************************** 
    228225 * This is a very simple PJSIP module, whose sole purpose is to display 
     
    379376 
    380377    /* Get media socket info, make sure transport is ready */ 
     378#if DISABLED_FOR_TICKET_1185 
    381379    if (pjsua_var.calls[0].med_tp) { 
    382380        pjmedia_transport_info_init(&tpinfo); 
     
    390388        } 
    391389    } 
    392  
    393     /* Send response statelessly */ 
     390#endif 
     391 
     392    /* Send response */ 
    394393    pjsip_get_response_addr(tdata->pool, rdata, &res_addr); 
    395394    status = pjsip_endpt_send_response(pjsua_var.endpt, &res_addr, tdata, NULL, NULL); 
     
    660659    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    661660 
     661    pjsua_set_state(PJSUA_STATE_CREATED); 
    662662 
    663663    return PJ_SUCCESS; 
     
    919919                         pj_get_version(), PJ_OS_NAME)); 
    920920 
     921    pjsua_set_state(PJSUA_STATE_INIT); 
     922 
    921923    return PJ_SUCCESS; 
    922924 
     
    12761278    int i;  /* Must be signed */ 
    12771279 
     1280    if (pjsua_var.state > PJSUA_STATE_NULL && 
     1281        pjsua_var.state < PJSUA_STATE_CLOSING) 
     1282    { 
     1283        pjsua_set_state(PJSUA_STATE_CLOSING); 
     1284    } 
     1285 
    12781286    /* Signal threads to quit: */ 
    12791287    pjsua_var.thread_quit_flag = 1; 
     
    14531461    pj_bzero(&pjsua_var, sizeof(pjsua_var)); 
    14541462 
     1463    pjsua_set_state(PJSUA_STATE_NULL); 
     1464 
    14551465    /* Done. */ 
    14561466    return PJ_SUCCESS; 
    14571467} 
    14581468 
     1469void pjsua_set_state(pjsua_state new_state) 
     1470{ 
     1471    const char *state_name[] = { 
     1472        "NULL", 
     1473        "CREATED", 
     1474        "INIT", 
     1475        "STARTING", 
     1476        "RUNNING", 
     1477        "CLOSING" 
     1478    }; 
     1479    pjsua_state old_state = pjsua_var.state; 
     1480 
     1481    pjsua_var.state = new_state; 
     1482    PJ_LOG(4,(THIS_FILE, "PJSUA state changed: %s --> %s", 
     1483              state_name[old_state], state_name[new_state])); 
     1484} 
     1485 
     1486/* Get state */ 
     1487PJ_DEF(pjsua_state) pjsua_get_state(void) 
     1488{ 
     1489    return pjsua_var.state; 
     1490} 
    14591491 
    14601492/** 
     
    14691501    pj_status_t status; 
    14701502 
     1503    pjsua_set_state(PJSUA_STATE_STARTING); 
     1504 
    14711505    status = pjsua_call_subsys_start(); 
    14721506    if (status != PJ_SUCCESS) 
     
    14801514    if (status != PJ_SUCCESS) 
    14811515        return status; 
     1516 
     1517    pjsua_set_state(PJSUA_STATE_RUNNING); 
    14821518 
    14831519    return PJ_SUCCESS; 
     
    25642600 
    25652601    PJ_LOG(3,(THIS_FILE, "Dumping media transports:")); 
     2602#if DISABLED_FOR_TICKET_1185 
    25662603    for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 
    25672604        pjsua_call *call = &pjsua_var.calls[i]; 
     
    25802617                                    sizeof(addr_buf), 3))); 
    25812618    } 
     2619#endif 
    25822620 
    25832621    pjsip_tsx_layer_dump(detail); 
Note: See TracChangeset for help on using the changeset viewer.