Changeset 246


Ignore:
Timestamp:
Feb 27, 2006 11:53:34 PM (18 years ago)
Author:
bennylp
Message:

Fixed deadlock in conference when starting sound device in Linux

File:
1 edited

Legend:

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

    r234 r246  
    3131#ifdef CONF_DEBUG 
    3232#   include <stdio.h> 
    33 #   define TRACE_(x)   printf x 
     33#   define TRACE_(x)   {printf x; fflush(stdout); } 
    3434#else 
    3535#   define TRACE_(x) 
     
    267267 
    268268    /* Create mutex. */ 
    269     status = pj_mutex_create_simple(pool, "conf", &conf->mutex); 
     269    status = pj_mutex_create_recursive(pool, "conf", &conf->mutex); 
    270270    if (status != PJ_SUCCESS) 
    271271        return status; 
     
    461461{ 
    462462    struct conf_port *src_port, *dst_port; 
     463    pj_bool_t start_sound = PJ_FALSE; 
    463464 
    464465    /* Check arguments */ 
     
    481482 
    482483        if (conf->connect_cnt == 1) 
    483             resume_sound(conf); 
     484            start_sound = 1; 
    484485 
    485486        PJ_LOG(4,(THIS_FILE,"Port %.*s transmitting to port %.*s", 
     
    491492 
    492493    pj_mutex_unlock(conf->mutex); 
     494 
     495    /* Sound device must be started without mutex, otherwise the 
     496     * sound thread will deadlock (?) 
     497     */ 
     498    if (start_sound) 
     499        resume_sound(conf); 
    493500 
    494501    return PJ_SUCCESS; 
     
    681688    PJ_UNUSED_ARG(size); 
    682689 
     690    pj_mutex_lock(conf->mutex); 
     691 
    683692    TRACE_(("p")); 
    684  
    685     pj_mutex_lock(conf->mutex); 
    686693 
    687694    /* Zero all port's temporary buffers. */ 
     
    914921 
    915922    /* Skip if this port is muted/disabled. */ 
    916     if (snd_port->rx_setting != PJMEDIA_PORT_ENABLE) 
     923    if (snd_port->rx_setting != PJMEDIA_PORT_ENABLE) { 
    917924        return PJ_SUCCESS; 
     925    } 
    918926 
    919927    /* Skip if no port is listening to the microphone */ 
    920     if (snd_port->listener_cnt == 0) 
     928    if (snd_port->listener_cnt == 0) { 
    921929        return PJ_SUCCESS; 
     930    } 
    922931 
    923932 
Note: See TracChangeset for help on using the changeset viewer.