Changeset 3780


Ignore:
Timestamp:
Oct 3, 2011 8:22:48 AM (12 years ago)
Author:
ming
Message:

Re #1266: Modified pjsua_media_channel_deinit() to resume deinit in the callback (instead of returning PJ_EBUSY) and make sure the right transport is used before calling dlg_respond()

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r3777 r3780  
    157157        pjmedia_sdp_session *rem_sdp;/**< Remote SDP.                       */ 
    158158        pj_pool_t           *pool_prov;/**< Provisional pool.               */ 
     159        pj_bool_t            med_ch_deinit;/**< Media channel de-init-ed?   */ 
    159160        union { 
    160161            struct { 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r3778 r3780  
    358358    } 
    359359 
     360    /* pjsua_media_channel_deinit() has been called. */ 
     361    if (call->async_call.med_ch_deinit) 
     362        goto on_error; 
     363 
    360364    /* Create offer */ 
    361365    status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, 
     
    709713        goto on_return; 
    710714    } 
    711      
     715 
     716    /* pjsua_media_channel_deinit() has been called. */ 
     717    if (call->async_call.med_ch_deinit) { 
     718        pjsua_media_channel_deinit(call->index); 
     719        call->med_ch_cb = NULL; 
     720        PJSUA_UNLOCK(); 
     721        return PJ_SUCCESS; 
     722    } 
     723 
    712724    /* Get remote SDP offer (if any). */ 
    713725    if (call->inv->neg) 
     
    10561068        pjsua_media_channel_deinit(call->index); 
    10571069        goto on_return; 
     1070    } 
     1071 
     1072    /* If account is locked to specific transport, then lock dialog 
     1073     * to this transport too. 
     1074     */ 
     1075    if (pjsua_var.acc[acc_id].cfg.transport_id != PJSUA_INVALID_ID) { 
     1076        pjsip_tpselector tp_sel; 
     1077 
     1078        pjsua_init_tpselector(pjsua_var.acc[acc_id].cfg.transport_id, &tp_sel); 
     1079        pjsip_dlg_set_transport(dlg, &tp_sel); 
    10581080    } 
    10591081 
     
    11271149        if (pjmedia_sdp_neg_get_neg_remote(inv->neg, &remote_sdp)==PJ_SUCCESS) 
    11281150            update_remote_nat_type(call, remote_sdp); 
    1129     } 
    1130  
    1131     /* If account is locked to specific transport, then lock dialog 
    1132      * to this transport too. 
    1133      */ 
    1134     if (pjsua_var.acc[acc_id].cfg.transport_id != PJSUA_INVALID_ID) { 
    1135         pjsip_tpselector tp_sel; 
    1136  
    1137         pjsua_init_tpselector(pjsua_var.acc[acc_id].cfg.transport_id, &tp_sel); 
    1138         pjsip_dlg_set_transport(dlg, &tp_sel); 
    11391151    } 
    11401152 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r3778 r3780  
    21142114    unsigned mi; 
    21152115 
     2116    PJSUA_LOCK(); 
    21162117    for (mi=0; mi<call->med_cnt; ++mi) { 
    21172118        pjsua_call_media *call_med = &call->media[mi]; 
    21182119 
    2119         if (call_med->tp_st == PJSUA_MED_TP_CREATING) 
    2120             return PJ_EBUSY; 
    2121     } 
     2120        if (call_med->tp_st == PJSUA_MED_TP_CREATING) { 
     2121            /* We will do the deinitialization after media transport 
     2122             * creation is completed. 
     2123             */ 
     2124            call->async_call.med_ch_deinit = PJ_TRUE; 
     2125            PJSUA_UNLOCK(); 
     2126            return PJ_SUCCESS; 
     2127        } 
     2128    } 
     2129    PJSUA_UNLOCK(); 
    21222130 
    21232131    PJ_LOG(4,(THIS_FILE, "Call %d: deinitializing media..", call_id)); 
Note: See TracChangeset for help on using the changeset viewer.