Changeset 6139


Ignore:
Timestamp:
Jan 28, 2020 3:51:50 AM (5 years ago)
Author:
riza
Message:

Close #2263: Add callback to notify when first valid pair is found on ICE negotiation.

Location:
pjproject/trunk/pjnath
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/ice_session.h

    r6071 r6139  
    469469    /** 
    470470     * An optional callback that will be called by the ICE session when 
     471     * a valid pair has been found during ICE negotiation. 
     472     * 
     473     * @param ice           The ICE session. 
     474     */ 
     475    void        (*on_valid_pair)(pj_ice_sess *ice); 
     476 
     477    /** 
     478     * An optional callback that will be called by the ICE session when 
    471479     * ICE negotiation has completed, successfully or with failure. 
    472480     * 
     
    626634    pj_bool_t            is_complete;               /**< Complete?          */ 
    627635    pj_bool_t            is_destroying;             /**< Destroy is called  */ 
     636    pj_bool_t            valid_pair_found;          /**< First pair found   */ 
    628637    pj_status_t          ice_status;                /**< Error status.      */ 
    629638    pj_timer_entry       timer;                     /**< ICE timer.         */ 
  • pjproject/trunk/pjnath/src/pjnath/ice_session.c

    r5850 r6139  
    419419    pj_list_init(&ice->early_check); 
    420420 
     421    ice->valid_pair_found = PJ_FALSE; 
     422 
    421423    /* Done */ 
    422424    *p_ice = ice; 
     
    13491351             (check->nominated ? "  and nominated" : ""))); 
    13501352 
     1353        /* On the first valid pair, we call the callback, if present */ 
     1354        if (ice->valid_pair_found == PJ_FALSE) { 
     1355            ice->valid_pair_found = PJ_TRUE; 
     1356 
     1357            if (ice->cb.on_valid_pair) { 
     1358                (*ice->cb.on_valid_pair)(ice); 
     1359            } 
     1360        } 
    13511361    } 
    13521362 
Note: See TracChangeset for help on using the changeset viewer.