Ignore:
Timestamp:
May 10, 2019 8:27:22 AM (4 years ago)
Author:
ming
Message:

Re #2189: Fixing various bugs:

  • assertion: !Endpoint::instance().mediaExists(*this) in Media::registerMediaPort() when using AudioMedia?

Sound device is already registered in the conference bridge, while AudioMediaPlayer/Recorder? creation function, i.e. pjsua_player_create(), pjsua_playlist_create(), and pjsua_recorder_create() already call pjmedia_conf_add_port(), so mediaExists() will always return TRUE.

  • Endpoint.mediaAdd() should check in its own internal list if the media exists, rather than querying pjsua.
  • Calling Endpoint::libDestroy() first, then deleting Endpoint will cause crash, since the mutex to remove the medias has been deleted in libDestroy().

The introduction of the mutex is in r5964.

  • DevAudioMedia? never removes itself from mediaList, potentially causing infinite loop/crash.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5976 r5986  
    503503        delete pendingJobs.front(); 
    504504        pendingJobs.pop_front(); 
    505     } 
    506  
    507     while(mediaList.size() > 0) { 
    508         AudioMedia *cur_media = mediaList[0]; 
    509         delete cur_media; /* this will remove itself from the list */ 
    510505    } 
    511506 
     
    17881783    } 
    17891784 
     1785    while(mediaList.size() > 0) { 
     1786        AudioMedia *cur_media = mediaList[0]; 
     1787        delete cur_media; /* this will remove itself from the list */ 
     1788    } 
     1789 
    17901790    if (mediaListMutex) { 
    17911791        pj_mutex_destroy(mediaListMutex); 
     
    20892089    pj_mutex_lock(mediaListMutex); 
    20902090 
    2091     if (mediaExists(media)) { 
    2092         pj_mutex_unlock(mediaListMutex); 
    2093         return; 
    2094     } 
    2095  
    2096     mediaList.push_back(&media); 
     2091    AudioMediaVector::iterator it = std::find(mediaList.begin(), 
     2092                                              mediaList.end(), 
     2093                                              &media); 
     2094 
     2095    if (it == mediaList.end()) 
     2096        mediaList.push_back(&media); 
    20972097    pj_mutex_unlock(mediaListMutex); 
    20982098} 
Note: See TracChangeset for help on using the changeset viewer.