Changeset 6074


Ignore:
Timestamp:
Sep 23, 2019 10:47:05 PM (5 years ago)
Author:
riza
Message:

Close #2232: Crash on Endpoint::libDestroy() when there is an active call.

Location:
pjproject/trunk/pjsip
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/account.hpp

    r6051 r6074  
    17991799    void presNotify(const PresNotifyParam &prm) PJSUA2_THROW(Error); 
    18001800     
     1801#if !DEPRECATED_FOR_TICKET_2232 
    18011802    /** 
    18021803     * Warning: deprecated, use enumBuddies2() instead. This function is not 
     
    18081809     */ 
    18091810    const BuddyVector& enumBuddies() const PJSUA2_THROW(Error); 
     1811#endif 
    18101812 
    18111813    /** 
     
    18161818    BuddyVector2 enumBuddies2() const PJSUA2_THROW(Error); 
    18171819 
     1820#if !DEPRECATED_FOR_TICKET_2232 
    18181821    /** 
    18191822     * Warning: deprecated, use findBuddy2 instead. This function is not 
     
    18311834    Buddy* findBuddy(string uri, FindBuddyMatch *buddy_match = NULL) const 
    18321835                    PJSUA2_THROW(Error); 
     1836#endif 
    18331837 
    18341838    /** 
     
    19691973    pjsua_acc_id         id; 
    19701974    string               tmpReason;     // for saving response's reason 
     1975#if !DEPRECATED_FOR_TICKET_2232 
    19711976    BuddyVector          buddyList; 
     1977#endif 
    19721978}; 
    19731979 
  • pjproject/trunk/pjsip/include/pjsua2/config.hpp

    r6026 r6074  
    4848#endif 
    4949 
     50/** 
     51 * Ticket #2189 described some lists of objects which is not thread safe. 
     52 * The ticket deprecated some APIs which uses those lists and introduce new one 
     53 * to replace them. This settings will disable the deprecated API all together. 
     54 * See also https://trac.pjsip.org/repos/ticket/2232 
     55 */ 
     56#ifndef DEPRECATED_FOR_TICKET_2232 
     57#   define DEPRECATED_FOR_TICKET_2232           1 
     58#endif 
    5059 
    5160/* 
  • pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp

    r6051 r6074  
    13891389    unsigned mediaActivePorts() const; 
    13901390 
     1391#if !DEPRECATED_FOR_TICKET_2232 
    13911392    /** 
    13921393     * Warning: deprecated, use mediaEnumPorts2() instead. This function is 
     
    13981399     */ 
    13991400    const AudioMediaVector &mediaEnumPorts() const PJSUA2_THROW(Error); 
     1401#endif 
    14001402 
    14011403    /** 
     
    14311433     */ 
    14321434 
     1435#if !DEPRECATED_FOR_TICKET_2232 
    14331436    /** 
    14341437     * Warning: deprecated, use codecEnum2() instead. This function is not 
     
    14401443     */ 
    14411444    const CodecInfoVector &codecEnum() PJSUA2_THROW(Error); 
     1445#endif 
    14421446 
    14431447    /** 
     
    14821486                       const CodecParam param) PJSUA2_THROW(Error); 
    14831487 
     1488#if !DEPRECATED_FOR_TICKET_2232 
    14841489    /** 
    14851490     * Warning: deprecated, use videoCodecEnum2() instead. This function is 
     
    14911496     */ 
    14921497    const CodecInfoVector &videoCodecEnum() PJSUA2_THROW(Error); 
     1498#endif 
    14931499 
    14941500    /** 
     
    16621668    static Endpoint             *instance_;     // static instance 
    16631669    LogWriter                   *writer;        // Custom writer, if any 
    1664     AudioMediaVector             mediaList; 
    16651670    AudDevManager                audioDevMgr; 
    16661671    VidDevManager                videoDevMgr; 
     1672#if !DEPRECATED_FOR_TICKET_2232 
    16671673    CodecInfoVector              codecInfoList; 
    16681674    CodecInfoVector              videoCodecInfoList; 
     1675#endif 
    16691676    std::map<pj_thread_t*, pj_thread_desc*> threadDescMap; 
    16701677    pj_mutex_t                  *threadDescMutex; 
     1678#if !DEPRECATED_FOR_TICKET_2232 
     1679    AudioMediaVector             mediaList; 
    16711680    pj_mutex_t                  *mediaListMutex; 
     1681#endif 
    16721682 
    16731683    /* Pending logging */ 
  • pjproject/trunk/pjsip/include/pjsua2/media.hpp

    r6051 r6074  
    911911    void setPlaybackDev(int playback_dev) const PJSUA2_THROW(Error); 
    912912 
     913#if !DEPRECATED_FOR_TICKET_2232 
    913914    /** 
    914915     * Warning: deprecated, use enumDev2 instead. This function is not 
     
    921922     */ 
    922923    const AudioDevInfoVector &enumDev() PJSUA2_THROW(Error); 
     924#endif 
    923925 
    924926    /** 
     
    14661468 
    14671469private: 
     1470#if !DEPRECATED_FOR_TICKET_2232 
    14681471    AudioDevInfoVector           audioDevList; 
     1472#endif 
    14691473    AudioMedia                  *devMedia; 
    14701474 
     
    20692073    VideoDevInfo getDevInfo(int dev_id) const PJSUA2_THROW(Error); 
    20702074 
     2075#if !DEPRECATED_FOR_TICKET_2232 
    20712076    /** 
    20722077     * Warning: deprecated, use enumDev2() instead. This function is not 
     
    20782083     */ 
    20792084    const VideoDevInfoVector &enumDev() PJSUA2_THROW(Error); 
     2085#endif 
    20802086 
    20812087    /** 
     
    22762282 
    22772283private: 
     2284#if !DEPRECATED_FOR_TICKET_2232 
    22782285    VideoDevInfoVector videoDevList; 
     2286#endif 
    22792287 
    22802288    void clearVideoDevList(); 
  • pjproject/trunk/pjsip/src/pjsua2/account.cpp

    r6068 r6074  
    968968{ 
    969969    if (isValid() && pjsua_get_state() < PJSUA_STATE_CLOSING) { 
     970#if !DEPRECATED_FOR_TICKET_2232 
    970971        // Cleanup buddies in the buddy list 
    971972        while(buddyList.size() > 0) { 
     
    973974            delete b; /* this will remove itself from the list */ 
    974975        } 
     976#endif 
    975977 
    976978        // This caused error message of "Error: cannot find Account.." 
     
    10651067} 
    10661068 
     1069#if !DEPRECATED_FOR_TICKET_2232 
    10671070const BuddyVector& Account::enumBuddies() const PJSUA2_THROW(Error) 
    10681071{ 
    10691072    return buddyList; 
    10701073} 
     1074#endif 
    10711075 
    10721076BuddyVector2 Account::enumBuddies2() const PJSUA2_THROW(Error) 
     
    10841088} 
    10851089 
     1090#if !DEPRECATED_FOR_TICKET_2232 
    10861091Buddy* Account::findBuddy(string uri, FindBuddyMatch *buddy_match) const 
    10871092                PJSUA2_THROW(Error) 
     
    10981103    PJSUA2_RAISE_ERROR(PJ_ENOTFOUND); 
    10991104} 
     1105#endif 
    11001106 
    11011107Buddy Account::findBuddy2(string uri) const PJSUA2_THROW(Error) 
     
    11171123void Account::addBuddy(Buddy *buddy) 
    11181124{ 
     1125#if !DEPRECATED_FOR_TICKET_2232 
    11191126    pj_assert(buddy); 
    11201127 
    11211128    buddyList.push_back(buddy); 
     1129#else 
     1130    PJ_UNUSED_ARG(buddy); 
     1131#endif 
    11221132} 
    11231133 
    11241134void Account::removeBuddy(Buddy *buddy) 
    11251135{ 
     1136#if !DEPRECATED_FOR_TICKET_2232 
    11261137    pj_assert(buddy); 
    11271138 
     
    11351146 
    11361147    pj_assert(!"Bug! Buddy to be removed is not in the buddy list!"); 
    1137 } 
     1148#else 
     1149    PJ_UNUSED_ARG(buddy); 
     1150#endif 
     1151} 
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r6051 r6074  
    479479 * Endpoint instance 
    480480 */ 
    481 Endpoint::Endpoint() 
    482 : writer(NULL), threadDescMutex(NULL), mediaListMutex(NULL),  
    483   mainThreadOnly(false), mainThread(NULL), pendingJobSize(0) 
     481Endpoint::Endpoint(): 
     482#if !DEPRECATED_FOR_TICKET_2232 
     483mediaListMutex(NULL), 
     484#endif 
     485writer(NULL), threadDescMutex(NULL), mainThreadOnly(false), 
     486mainThread(NULL), pendingJobSize(0) 
    484487{ 
    485488    if (instance_) { 
     
    505508    } 
    506509 
     510#if !DEPRECATED_FOR_TICKET_2232 
    507511    clearCodecInfoList(codecInfoList); 
    508512    clearCodecInfoList(videoCodecInfoList); 
     513#endif 
    509514 
    510515    try { 
     
    17141719                                              &threadDescMutex) ); 
    17151720 
     1721#if !DEPRECATED_FOR_TICKET_2232 
    17161722    PJSUA2_CHECK_EXPR( pj_mutex_create_recursive(pjsua_var.pool, "mediaList", 
    17171723                                                 &mediaListMutex) ); 
     1724#endif 
    17181725} 
    17191726 
     
    17831790    } 
    17841791 
     1792#if !DEPRECATED_FOR_TICKET_2232 
    17851793    while(mediaList.size() > 0) { 
    17861794        AudioMedia *cur_media = mediaList[0]; 
     
    17921800        mediaListMutex = NULL; 
    17931801    } 
     1802#endif 
    17941803 
    17951804    status = pjsua_destroy2(flags); 
     
    20472056} 
    20482057 
     2058#if !DEPRECATED_FOR_TICKET_2232 
    20492059const AudioMediaVector &Endpoint::mediaEnumPorts() const PJSUA2_THROW(Error) 
    20502060{ 
    20512061    return mediaList; 
    20522062} 
     2063#endif 
    20532064 
    20542065AudioMediaVector2 Endpoint::mediaEnumPorts2() const PJSUA2_THROW(Error) 
     
    20902101void Endpoint::mediaAdd(AudioMedia &media) 
    20912102{ 
     2103#if !DEPRECATED_FOR_TICKET_2232 
    20922104    /* mediaList serves mediaEnumPorts() only, once mediaEnumPorts() 
    20932105     * is removed, this function implementation should be no-op. 
     
    21022114        mediaList.push_back(&media); 
    21032115    pj_mutex_unlock(mediaListMutex); 
     2116#else 
     2117    PJ_UNUSED_ARG(media); 
     2118#endif 
    21042119} 
    21052120 
    21062121void Endpoint::mediaRemove(AudioMedia &media) 
    21072122{ 
     2123#if !DEPRECATED_FOR_TICKET_2232 
    21082124    /* mediaList serves mediaEnumPorts() only, once mediaEnumPorts() 
    21092125     * is removed, this function implementation should be no-op. 
     
    21172133        mediaList.erase(it); 
    21182134    pj_mutex_unlock(mediaListMutex); 
     2135#else 
     2136    PJ_UNUSED_ARG(media); 
     2137#endif 
    21192138} 
    21202139 
     
    21422161 * Codec operations. 
    21432162 */ 
     2163 
     2164#if !DEPRECATED_FOR_TICKET_2232 
    21442165const CodecInfoVector &Endpoint::codecEnum() PJSUA2_THROW(Error) 
    21452166{ 
     
    21522173    return codecInfoList; 
    21532174} 
     2175#endif 
    21542176 
    21552177CodecInfoVector2 Endpoint::codecEnum2() const PJSUA2_THROW(Error) 
     
    22202242} 
    22212243 
     2244#if !DEPRECATED_FOR_TICKET_2232 
    22222245const CodecInfoVector &Endpoint::videoCodecEnum() PJSUA2_THROW(Error) 
    22232246{ 
     
    22322255    return videoCodecInfoList; 
    22332256} 
     2257#endif 
    22342258 
    22352259CodecInfoVector2 Endpoint::videoCodecEnum2() const PJSUA2_THROW(Error) 
  • pjproject/trunk/pjsip/src/pjsua2/media.cpp

    r6026 r6074  
    749749} 
    750750 
     751#if !DEPRECATED_FOR_TICKET_2232 
    751752const AudioDevInfoVector &AudDevManager::enumDev() PJSUA2_THROW(Error) 
    752753{ 
     
    766767    return audioDevList; 
    767768} 
     769#endif 
    768770 
    769771AudioDevInfoVector2 AudDevManager::enumDev2() const PJSUA2_THROW(Error) 
     
    10841086void AudDevManager::clearAudioDevList() 
    10851087{ 
     1088#if !DEPRECATED_FOR_TICKET_2232 
    10861089    for(unsigned i=0;i<audioDevList.size();++i) { 
    10871090        delete audioDevList[i]; 
    10881091    } 
    10891092    audioDevList.clear(); 
     1093#endif 
    10901094} 
    10911095 
     
    14811485} 
    14821486 
     1487#if !DEPRECATED_FOR_TICKET_2232 
    14831488const VideoDevInfoVector &VidDevManager::enumDev() PJSUA2_THROW(Error) 
    14841489{ 
     
    15001505    return videoDevList; 
    15011506} 
     1507#endif 
    15021508 
    15031509VideoDevInfoVector2 VidDevManager::enumDev2() const PJSUA2_THROW(Error) 
     
    16661672void VidDevManager::clearVideoDevList() 
    16671673{ 
    1668 #if PJSUA_HAS_VIDEO 
     1674#if PJSUA_HAS_VIDEO && !DEPRECATED_FOR_TICKET_2232 
    16691675    for (unsigned i = 0;i<videoDevList.size();++i) { 
    16701676        delete videoDevList[i]; 
Note: See TracChangeset for help on using the changeset viewer.