Changeset 1893


Ignore:
Timestamp:
Mar 25, 2008 5:05:59 PM (16 years ago)
Author:
bennylp
Message:

Ticket #516: Assertion in sound device when headset is plugged/unplugged in MacOS X (thanks Alexei Kuznetsov)

File:
1 edited

Legend:

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

    r1848 r1893  
    7070 
    7171    pj_bool_t            rec_thread_exited; 
    72     pj_bool_t            rec_thread_initialized; 
     72    //pj_bool_t          rec_thread_initialized; 
    7373    pj_thread_desc       rec_thread_desc; 
    7474    pj_thread_t         *rec_thread; 
    7575 
    7676    pj_bool_t            play_thread_exited; 
    77     pj_bool_t            play_thread_initialized; 
     77    //pj_bool_t          play_thread_initialized; 
    7878    pj_thread_desc       play_thread_desc; 
    7979    pj_thread_t         *play_thread; 
     
    102102        return paContinue; 
    103103 
    104     if (stream->rec_thread_initialized == 0) { 
     104    // Sometime the thread, where this callback called from, is changed 
     105    // (e.g: in MacOS this happens when plugging/unplugging headphone) 
     106    // if (stream->rec_thread_initialized == 0) { 
     107    if (!pj_thread_is_registered()) { 
    105108        status = pj_thread_register("pa_rec", stream->rec_thread_desc,  
    106109                                    &stream->rec_thread); 
    107         stream->rec_thread_initialized = 1; 
     110        //stream->rec_thread_initialized = 1; 
    108111        PJ_LOG(5,(THIS_FILE, "Recorder thread started")); 
    109112    } 
     
    152155        return paContinue; 
    153156 
    154     if (stream->play_thread_initialized == 0) { 
     157    // Sometime the thread, where this callback called from, is changed 
     158    // (e.g: in MacOS this happens when plugging/unplugging headphone) 
     159    // if (stream->play_thread_initialized == 0) { 
     160    if (!pj_thread_is_registered()) { 
    155161        status = pj_thread_register("portaudio", stream->play_thread_desc, 
    156162                                    &stream->play_thread); 
    157         stream->play_thread_initialized = 1; 
     163        //stream->play_thread_initialized = 1; 
    158164        PJ_LOG(5,(THIS_FILE, "Player thread started")); 
    159165    } 
Note: See TracChangeset for help on using the changeset viewer.