Ignore:
Timestamp:
Jan 9, 2012 11:51:56 AM (9 years ago)
Author:
ming
Message:

Fixes #1442: Unable to make call if disabled media is included

Add an API pjsua_schedule_timer2() to allow application to schedule a callback function to be executed after a specified time interval. This enables app to post a delayed job which, in this case, allows the initialization of all media transport creations to finish first before we get the media transport creations result.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r3929 r3938  
    767767#endif 
    768768 
     769static void med_tp_timer_cb(void *user_data) 
     770{ 
     771    pjsua_call_media *call_med = (pjsua_call_media*)user_data; 
     772 
     773    PJSUA_LOCK(); 
     774 
     775    call_med->tp_ready = call_med->tp_result; 
     776    if (call_med->med_create_cb) 
     777        (*call_med->med_create_cb)(call_med, call_med->tp_ready, 
     778                                   call_med->call->secure_level, NULL); 
     779 
     780    PJSUA_UNLOCK(); 
     781} 
     782 
    769783/* This callback is called when ICE negotiation completes */ 
    770784static void on_ice_complete(pjmedia_transport *tp,  
     
    779793    switch (op) { 
    780794    case PJ_ICE_STRANS_OP_INIT: 
    781         PJSUA_LOCK(); 
    782         call_med->tp_ready = result; 
    783         if (call_med->med_create_cb) 
    784             (*call_med->med_create_cb)(call_med, result, 
    785                                        call_med->call->secure_level, NULL); 
    786         PJSUA_UNLOCK(); 
     795        call_med->tp_result = result; 
     796        pjsua_schedule_timer2(&med_tp_timer_cb, call_med, 1); 
    787797        break; 
    788798    case PJ_ICE_STRANS_OP_NEGOTIATION: 
     
    15391549            pjsua_call_media *call_med = &call->media[mi]; 
    15401550 
    1541             if (call_med->med_init_cb || 
    1542                 call_med->tp_st == PJSUA_MED_TP_NULL) 
    1543             { 
     1551            if (call_med->med_init_cb) { 
    15441552                pj_mutex_unlock(call->med_ch_mutex); 
    15451553                return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.