Ticket #844: on_rx_rtp.patch

File on_rx_rtp.patch, 895 bytes (added by bennylp, 15 years ago)

Potential fix to protect the race condition. It should be safe from deadlock situation (see ticket #460), though still needs some more review

  • pjmedia/src/pjmedia/transport_udp.c

     
    637637    /* Must not be "attached" to existing application */ 
    638638    PJ_ASSERT_RETURN(!udp->attached, PJ_EINVALIDOP); 
    639639 
     640    /* Lock the ioqueue keys to make sure that callbacks are 
     641     * not executed. See ticket #844 for details. 
     642     */ 
     643    pj_ioqueue_lock_key(udp->rtp_key); 
     644    pj_ioqueue_lock_key(udp->rtcp_key); 
     645 
    640646    /* "Attach" the application: */ 
    641647 
    642648    /* Copy remote RTP address */ 
     
    672678    pj_bzero(&udp->rtcp_src_addr, sizeof(udp->rtcp_src_addr)); 
    673679    udp->rtp_src_cnt = 0; 
    674680 
     681    /* Unlock keys */ 
     682    pj_ioqueue_unlock_key(udp->rtcp_key); 
     683    pj_ioqueue_unlock_key(udp->rtp_key); 
     684 
    675685    return PJ_SUCCESS; 
    676686} 
    677687