Changeset 5947


Ignore:
Timestamp:
Mar 8, 2019 7:02:23 AM (3 months ago)
Author:
nanang
Message:

Re #2181: Fixed unreleased pool when disconnecting ports in video conference.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/vid_conf.c

    r5939 r5947  
    610610 
    611611    if (i != src_port->listener_cnt) { 
     612        unsigned k; 
     613 
    612614        pj_assert(j != dst_port->transmitter_cnt); 
    613615        pj_assert(src_port->listener_cnt > 0 &&  
     
    615617        pj_assert(dst_port->transmitter_cnt > 0 &&  
    616618                  dst_port->transmitter_cnt < vid_conf->opt.max_slot_cnt); 
     619 
     620        /* Cleanup all render states of the sink */ 
     621        for (k=0; k<dst_port->transmitter_cnt; ++k) 
     622            cleanup_render_state(dst_port, k); 
     623 
     624        /* Update listeners array of the source and transmitters array of 
     625         * the sink. 
     626         */ 
    617627        pj_array_erase(src_port->listener_slots, sizeof(unsigned),  
    618628                       src_port->listener_cnt, i); 
     
    622632        --dst_port->transmitter_cnt; 
    623633 
    624         cleanup_render_state(src_port, j); 
     634        /* Update render states of the sink */ 
    625635        update_render_state(vid_conf, dst_port); 
    626636 
     
    806816    if (cp->render_pool[transmitter_idx]) { 
    807817        pj_pool_safe_release(&cp->render_pool[transmitter_idx]); 
     818 
     819        TRACE_((THIS_FILE, "Cleaned up render state for connection %d->%d", 
     820                cp->transmitter_slots[transmitter_idx], cp->idx)); 
    808821    } 
    809822} 
     
    822835    unsigned i; 
    823836    pj_status_t status; 
    824     char buf[5]; 
    825837 
    826838    /* Nothing to render, just return */ 
     
    860872        render_state *rs; 
    861873        pjmedia_conversion_param cparam; 
     874        char tmp_buf[32]; 
    862875 
    863876        /* Create pool & render state */ 
    864         pool = pj_pool_create(cp->pool->factory, "vconf_rdr", 128, 128, NULL); 
     877        pj_ansi_snprintf(tmp_buf, sizeof(tmp_buf), "vcport_rs_%d->%d", 
     878                         cp->transmitter_slots[i], cp->idx); 
     879        pool = pj_pool_create(cp->pool->factory, tmp_buf, 128, 128, NULL); 
    865880        cp->render_pool[i] = pool; 
    866881        rs = cp->render_states[i] = PJ_POOL_ZALLOC_T(pool, render_state); 
     882 
     883        TRACE_((THIS_FILE, "Created render state for connection %d->%d", 
     884                           cp->transmitter_slots[i], cp->idx)); 
    867885 
    868886        /* Setup format & frame */ 
     
    963981            rs->src_rect.coord.y = (tr_size[i].h - rs->src_rect.size.h)/2; 
    964982 
    965         TRACE_((THIS_FILE, "src%d=%s/%dx%d->%dx%d@%d,%d dst=%dx%d@%d,%d", 
    966                            i, pjmedia_fourcc_name(tr_fmt_id[i], buf), 
     983        TRACE_((THIS_FILE, "src#%d=%s/%dx%d->%dx%d@%d,%d dst=%dx%d@%d,%d", 
     984                           i, pjmedia_fourcc_name(tr_fmt_id[i], tmp_buf), 
    967985                           tr_size[i].w, tr_size[i].h, 
    968986                           rs->src_rect.size.w, rs->src_rect.size.h, 
Note: See TracChangeset for help on using the changeset viewer.