Changeset 2728 for pjproject


Ignore:
Timestamp:
Jun 1, 2009 1:56:09 PM (15 years ago)
Author:
nanang
Message:

Ticket #834:

  • Added calls to delay buf destructor in conference.c and echo_common.c.
  • Moved mutex creation to the end of pjmedia_delay_buf_create().
  • Deprecated pjmedia_conf_add_passive_port().
Location:
pjproject/trunk/pjmedia
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/conference.h

    r2506 r2728  
    239239 
    240240/** 
     241 * <i><b>Warning:</b> This API has been deprecated since 1.3 and will be 
     242 * removed in the future release, use #PJMEDIA_SPLITCOMB instead.</i> 
     243 * 
    241244 * Create and add a passive media port to the conference bridge. Unlike 
    242245 * "normal" media port that is added with #pjmedia_conf_add_port(), media 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r2696 r2728  
    572572    /* Create port zero for sound device. */ 
    573573    status = create_sound_port(pool, conf); 
    574     if (status != PJ_SUCCESS) 
     574    if (status != PJ_SUCCESS) { 
     575        pjmedia_conf_destroy(conf); 
    575576        return status; 
     577    } 
    576578 
    577579    /* Create mutex. */ 
    578580    status = pj_mutex_create_recursive(pool, "conf", &conf->mutex); 
    579     if (status != PJ_SUCCESS) 
     581    if (status != PJ_SUCCESS) { 
     582        pjmedia_conf_destroy(conf); 
    580583        return status; 
     584    } 
    581585 
    582586    /* If sound device was created, connect sound device to the 
     
    627631PJ_DEF(pj_status_t) pjmedia_conf_destroy( pjmedia_conf *conf ) 
    628632{ 
     633    unsigned i, ci; 
     634 
    629635    PJ_ASSERT_RETURN(conf != NULL, PJ_EINVAL); 
    630636 
     
    635641    } 
    636642 
     643    /* Destroy delay buf of all (passive) ports. */ 
     644    for (i=0, ci=0; i<conf->max_ports && ci<conf->port_cnt; ++i) { 
     645        struct conf_port *cport; 
     646 
     647        cport = conf->ports[i]; 
     648        if (!cport) 
     649            continue; 
     650         
     651        ++ci; 
     652        if (cport->delay_buf) { 
     653            pjmedia_delay_buf_destroy(cport->delay_buf); 
     654            cport->delay_buf = NULL; 
     655        } 
     656    } 
     657 
    637658    /* Destroy mutex */ 
    638     pj_mutex_destroy(conf->mutex); 
     659    if (conf->mutex) 
     660        pj_mutex_destroy(conf->mutex); 
    639661 
    640662    return PJ_SUCCESS; 
     
    794816    pj_status_t status; 
    795817 
     818    PJ_LOG(1, (THIS_FILE, "This API has been deprecated since 1.3 and will " 
     819                          "be removed in the future release!")); 
     820 
    796821    PJ_ASSERT_RETURN(conf && pool, PJ_EINVAL); 
    797822 
     
    11221147        pj_assert(conf->connect_cnt > 0); 
    11231148        --conf->connect_cnt; 
     1149    } 
     1150 
     1151    /* Destroy pjmedia port if this conf port is passive port, 
     1152     * i.e: has delay buf. 
     1153     */ 
     1154    if (conf_port->delay_buf) { 
     1155        pjmedia_port_destroy(conf_port->port); 
     1156        conf_port->port = NULL; 
    11241157    } 
    11251158 
  • pjproject/trunk/pjmedia/src/pjmedia/delaybuf.c

    r2394 r2728  
    122122    b->recalc_timer = RECALC_TIME; 
    123123 
    124     status = pj_lock_create_recursive_mutex(pool, b->obj_name,  
    125                                             &b->lock); 
    126     if (status != PJ_SUCCESS) 
    127         return status; 
    128  
     124    /* Create circular buffer */ 
    129125    status = pjmedia_circ_buf_create(pool, b->max_cnt, &b->circ_buf); 
    130126    if (status != PJ_SUCCESS) 
    131127        return status; 
    132128 
     129    /* Create WSOLA */ 
    133130    status = pjmedia_wsola_create(pool, clock_rate, samples_per_frame, 1, 
    134131                                  0, &b->wsola); 
     132    if (status != PJ_SUCCESS) 
     133        return status; 
     134 
     135    /* Finally, create mutex */ 
     136    status = pj_lock_create_recursive_mutex(pool, b->obj_name,  
     137                                            &b->lock); 
    135138    if (status != PJ_SUCCESS) 
    136139        return status; 
  • pjproject/trunk/pjmedia/src/pjmedia/echo_common.c

    r2394 r2728  
    240240{ 
    241241    (*echo->op->ec_destroy)(echo->state); 
     242 
     243    if (echo->delay_buf) { 
     244        pjmedia_delay_buf_destroy(echo->delay_buf); 
     245        echo->delay_buf = NULL; 
     246    } 
     247 
    242248    pj_pool_release(echo->pool); 
    243249    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.