Changeset 6076


Ignore:
Timestamp:
Sep 24, 2019 2:46:12 PM (7 months ago)
Author:
riza
Message:

Fix #2234: Memory leak with third party resampling.

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

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

    r5792 r6076  
    4343 
    4444PJ_BEGIN_DECL 
     45 
     46/* Since 1.3 pjmedia_conf_add_passive_port() has been deprecated 
     47 * and replaced by splitcomb. 
     48 * See also https://trac.pjsip.org/repos/ticket/2234. 
     49 */ 
     50#ifndef DEPRECATED_FOR_TICKET_2234 
     51#  define DEPRECATED_FOR_TICKET_2234    1 
     52#endif 
    4553 
    4654/** 
     
    238246 
    239247 
     248#if !DEPRECATED_FOR_TICKET_2234 
    240249/** 
    241250 * <i><b>Warning:</b> This API has been deprecated since 1.3 and will be 
     
    280289                                                    pjmedia_port **p_port ); 
    281290 
     291#endif 
    282292 
    283293/** 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r5792 r6076  
    252252static pj_status_t get_frame(pjmedia_port *this_port,  
    253253                             pjmedia_frame *frame); 
     254static pj_status_t destroy_port(pjmedia_port *this_port); 
     255 
     256#if !DEPRECATED_FOR_TICKET_2234 
    254257static pj_status_t get_frame_pasv(pjmedia_port *this_port,  
    255258                                  pjmedia_frame *frame); 
    256 static pj_status_t destroy_port(pjmedia_port *this_port); 
    257259static pj_status_t destroy_port_pasv(pjmedia_port *this_port); 
     260#endif 
    258261 
    259262 
     
    668671         
    669672        ++ci; 
     673 
     674        if (cport->rx_resample) { 
     675            pjmedia_resample_destroy(cport->rx_resample); 
     676            cport->rx_resample = NULL; 
     677        } 
     678        if (cport->tx_resample) { 
     679            pjmedia_resample_destroy(cport->tx_resample); 
     680            cport->tx_resample = NULL; 
     681        } 
    670682        if (cport->delay_buf) { 
    671683            pjmedia_delay_buf_destroy(cport->delay_buf); 
     
    691703} 
    692704 
     705#if !DEPRECATED_FOR_TICKET_2234 
    693706static pj_status_t destroy_port_pasv(pjmedia_port *this_port) { 
    694707    pjmedia_conf *conf = (pjmedia_conf*) this_port->port_data.pdata; 
     
    702715    return status; 
    703716} 
     717#endif 
    704718 
    705719/* 
     
    815829 
    816830 
     831#if !DEPRECATED_FOR_TICKET_2234 
    817832/* 
    818833 * Add passive port. 
     
    916931    return PJ_SUCCESS; 
    917932} 
     933#endif 
    918934 
    919935 
     
    11741190    } 
    11751191 
     1192    /* Destroy resample if this conf port has it. */ 
     1193    if (conf_port->rx_resample) { 
     1194        pjmedia_resample_destroy(conf_port->rx_resample); 
     1195        conf_port->rx_resample = NULL; 
     1196    } 
     1197    if (conf_port->tx_resample) { 
     1198        pjmedia_resample_destroy(conf_port->tx_resample); 
     1199        conf_port->tx_resample = NULL; 
     1200    } 
     1201 
    11761202    /* Destroy pjmedia port if this conf port is passive port, 
    11771203     * i.e: has delay buf. 
    11781204     */ 
    11791205    if (conf_port->delay_buf) { 
     1206        pjmedia_delay_buf_destroy(conf_port->delay_buf); 
     1207        conf_port->delay_buf = NULL; 
     1208 
    11801209        pjmedia_port_destroy(conf_port->port); 
    11811210        conf_port->port = NULL; 
     
    21742203 
    21752204 
     2205#if !DEPRECATED_FOR_TICKET_2234 
    21762206/* 
    21772207 * get_frame() for passive port 
     
    21852215    return -1; 
    21862216} 
     2217#endif 
    21872218 
    21882219 
Note: See TracChangeset for help on using the changeset viewer.