Changeset 4639 for pjproject


Ignore:
Timestamp:
Nov 1, 2013 7:11:48 AM (10 years ago)
Author:
bennylp
Message:

Re #1519: Major change in pjsua2.i and etc after actual test in Python:

  • Major changes in SWIG interface file (pjsua2.i).
    • The "ignore" and "unignore" approach caused link error with vector (duplicate symbols because SWIG generates two identical vector functions in the wrapper) so it cannot be used (tried with many combinations and still doesn't work).
    • So scrap that, and now we use "importing" approach, where needed symbols must be listed in symbols.lst file, then use importsym.py to import the symbol declarations to symbols.i. Then include symbols.i in pjsua.i
    • Due to the way importsym.py work, some macros and naked constants need to be placed into a named enumeration, for example:
      • #define PJ_SUCCESS 0 ==> enum pj_constants_ { PJ_SUCCESS=0 }; [types.h]
      • enum { PJMEDIA_VID_DEFAULT_CAPTURE_DEV = -1 } ==> enum pjmedia_vid_dev_std_index { PJMEDIA_VID_DEFAULT_CAPTURE_DEV = -1 }; [videodev.h]
    • Makefile was changed so that symbols.i would be generated if symbols.lst has changed
  • Added "make install" and "make uninstall" targets for swig. Only implemented on Python. This will install to user's lib dir so doesn't need sudo.
  • Deleted approachX.hpp files
  • Added libVersion() method to Endpoint along with Version struct.
  • Fix pjsua2.i to make exception (or redirection?) works in Python
  • Add polling and worker thread related API:
    • PJSUA-LIB: pjsua_register_worker_thread(), pjsua_stop_worker_threads()
    • Endpoint: libRegisterWorkerThread(), libStopWorkerThreads(), libHandleEvents();
Location:
pjproject/branches/projects/pjsua2
Files:
3 added
3 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/build.mak.in

    r4638 r4639  
    130130# variables. it will also require -lstdc++ 
    131131#  x   x  x  x  x  x  x   x  x  x  x  x  x   x  x  x  x  x  x   x  x  x  x  x 
    132 export APP_LDLIBS := \  
     132export APP_LDLIBS := \ 
    133133        -lpjsua2-$(TARGET_NAME)\ 
    134134        -lpjsua-$(TARGET_NAME)\ 
     
    154154# variables. it will also require -lstdc++ 
    155155#  x   x  x  x  x  x  x   x  x  x  x  x  x   x  x  x  x  x  x   x  x  x  x  x 
    156 export APP_LIB_FILES = \  
     156export APP_LIB_FILES = \ 
    157157        $(PJ_DIR)/pjsip/lib/libpjsua2-$(LIB_SUFFIX) \ 
    158158        $(PJ_DIR)/pjsip/lib/libpjsua-$(LIB_SUFFIX) \ 
  • pjproject/branches/projects/pjsua2/pjlib/include/pj/types.h

    r4537 r4639  
    8787#endif 
    8888 
    89  
    90 /** Status is OK. */ 
    91 #define PJ_SUCCESS  0 
    92  
    93 /** True value. */ 
    94 #define PJ_TRUE     1 
    95  
    96 /** False value. */ 
    97 #define PJ_FALSE    0 
     89/** Some constants */ 
     90enum pj_constants_ 
     91{ 
     92    /** Status is OK. */ 
     93    PJ_SUCCESS=0, 
     94 
     95    /** True value. */ 
     96    PJ_TRUE=1, 
     97 
     98    /** False value. */ 
     99    PJ_FALSE=0 
     100}; 
    98101 
    99102/** 
  • pjproject/branches/projects/pjsua2/pjmedia/include/pjmedia-videodev/videodev.h

    r4167 r4639  
    132132 * Device index constants. 
    133133 */ 
    134 enum 
     134enum pjmedia_vid_dev_std_index 
    135135{ 
    136136    /** 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/Makefile

    r4597 r4639  
    99export SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp 
    1010 
    11 all clean dep depend distclean print realclean: 
     11.PHONY: all clean dep depend distclean print realclean install uninstall 
     12 
     13all: symbols.i 
     14 
     15all clean dep depend distclean print realclean install uninstall: 
    1216        for dir in $(DIRS); do \ 
    1317                if $(MAKE) $(MAKE_FLAGS) -C $$dir $@; then \ 
     
    1721                fi; \ 
    1822        done 
     23 
     24symbols.i: symbols.lst 
     25        python importsym.py 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/Makefile

    r4638 r4639  
    4343MY_LDFLAGS       = $(PJ_LDFLAGS) -lpjsua2-$(TARGET_NAME) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) -static-libstdc++ 
    4444 
    45 .PHONY: all java 
     45.PHONY: all java install uninstall 
    4646 
    4747all: $(LIBPJSUA2_SO) java 
     
    5353        g++ -c $(OUT_DIR)/pjsua2_wrap.cpp -o $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS) 
    5454 
    55 $(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i $(SRCS) 
     55$(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i $(SRCS) 
    5656        swig $(SWIG_FLAGS) -java  -o $(OUT_DIR)/pjsua2_wrap.cpp ../pjsua2.i 
    5757 
     
    7171        @# CLASSPATH and java.library.path env settings 
    7272        $(MY_JAVA) -cp $(OUT_DIR) -Djava.library.path="$(OUT_DIR)" test 
     73 
     74install: 
     75uninstall: 
     76 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/pjsua2.i

    r4638 r4639  
    1515%} 
    1616 
     17#ifdef SWIGPYTHON 
     18  %feature("director:except") { 
     19    if( $error != NULL ) { 
     20      PyObject *ptype, *pvalue, *ptraceback; 
     21      PyErr_Fetch( &ptype, &pvalue, &ptraceback ); 
     22      PyErr_Restore( ptype, pvalue, ptraceback ); 
     23      PyErr_Print(); 
     24      //Py_Exit(1); 
     25    } 
     26  } 
     27#endif 
     28 
     29// Constants from PJSIP libraries 
     30%include "symbols.i" 
     31 
     32 
     33// 
     34// Classes that can be extended in the target language 
     35// 
     36%feature("director") LogWriter; 
     37%feature("director") Endpoint;  
     38%feature("director") Account; 
     39 
     40 
    1741// 
    1842// STL stuff. 
     
    2145%include "std_vector.i" 
    2246 
    23 namespace std 
    24 { 
    25         %template(StringVector) std::vector<std::string>; 
    26         %template(IntVector) std::vector<int>; 
    27         %template(AuthCredInfoVector) std::vector<AuthCredInfo>; 
    28         %template(SipMultipartPartVector) std::vector<SipMultipartPart>; 
    29         %template(SipHeaderVector) std::vector<SipHeader>; 
    30 } 
     47 
     48%template(StringVector)                 std::vector<std::string>; 
     49%template(IntVector)                    std::vector<int>; 
    3150 
    3251// 
    33 // Classes that can be extended in the target language 
    34 // 
    35 %feature("director") LogWriter;  
    36 %feature("director") EpCallback; 
    37  
    38 // 
    39 // And include supporting constants etc. Here we don't want to export 
    40 // the whole file, so we start with ignoring everything and then enable 
    41 // selected symbols   
    42 // 
    43 #define PJ_BEGIN_DECL 
    44 #define PJ_END_DECL 
    45 #define PJ_DECL(type)           type 
    46 #define PJ_INLINE(type)         type 
    47 #define PJ_DECL_DATA(type)      extern type 
    48  
    49 // 
    50 // Start with ignoring everything 
    51 // 
    52 %ignore ""; 
    53  
    54 // Process the files. Keep them sorted. 
    55  
    56 // 
    57 // 
    58 %rename("%s") pj_file_access;                           // Unignore this 
    59 %rename("%s", regexmatch$name="PJ_O_.*") "";            // Unignore this 
    60 %include "pj/file_io.h" 
    61  
    62 // 
    63 // 
    64 %rename("%s") pj_log_decoration;                        // Unignore this 
    65 %rename("%s", regexmatch$name="PJ_LOG_HAS_.*") "";      // Unignore this 
    66 %include "pj/log.h" 
    67  
    68 // 
    69 // 
    70 %rename("%s") pj_qos_type;                              // Unignore this 
    71 %rename("%s", regexmatch$name="PJ_QOS_TYPE_.*") "";     // Unignore this 
    72 %rename("%s") pj_qos_flag;                              // Unignore this 
    73 %rename("%s", regexmatch$name="PJ_QOS_PARAM_HAS_.*") "";// Unignore this 
    74 %rename("%s") pj_qos_wmm_prio;                          // Unignore this 
    75 %rename("%s", regexmatch$name="PJ_QOS_WMM_PRIO_.*") ""; // Unignore this 
    76 // TODO: 
    77 //  Wish there is a better way to unignore a struct than 
    78 //  listing the fields one by one like below. Using regex 
    79 //  doesn't seem to work? 
    80 %rename("%s") pj_qos_params;                            // Unignore this 
    81 %rename("%s") pj_qos_params::flags;                     // Unignore this 
    82 %rename("%s") pj_qos_params::dscp_val;                  // Unignore this 
    83 %rename("%s") pj_qos_params::so_prio;                   // Unignore this 
    84 %rename("%s") pj_qos_params::wmm_prio;                  // Unignore this 
    85 %include "pj/sock_qos.h" 
    86  
    87 // 
    88 // 
    89 %rename("%s") pj_ssl_cipher;                            // Unignore this 
    90 %rename("%s", regexmatch$name="PJ_O_.*") "";            // Unignore this 
    91 %include "pj/ssl_sock.h" 
    92  
    93 // 
    94 // 
    95 %rename("%s") pj_status_t;                              // Unignore this 
    96 %rename("%s") PJ_SUCCESS;                               // Unignore this 
    97 %include "pj/types.h" 
    98  
    99 // 
    100 // 
    101 %rename("%s") pj_stun_nat_type;                         // Unignore this 
    102 %rename("%s", regexmatch$name="PJ_STUN_NAT_TYPE_.*") "";// Unignore this 
    103 %include "pjnath/nat_detect.h" 
    104  
    105 // 
    106 // 
    107 %rename("%s") pj_turn_tp_type;                          // Unignore this 
    108 %rename("%s", regexmatch$name="PJ_TURN_TP_.*") "";      // Unignore this 
    109 %include "pjnath/turn_session.h" 
    110  
    111 // 
    112 // 
    113 %rename("%s") pjmedia_vid_stream_rc_method;             // Unignore this 
    114 %rename("%s", regexmatch$name="PJMEDIA_VID_STREAM_RC_.*") "";// Unignore this 
    115 %include "pjmedia/vid_stream.h" 
    116  
    117 // 
    118 // 
    119 %rename("%s") pjmedia_srtp_use;                         // Unignore this 
    120 %rename("%s", regexmatch$name="PJMEDIA_SRTP_.*") "";    // Unignore this 
    121 %include "pjmedia/transport_srtp.h" 
    122  
    123 // 
    124 // 
    125 %rename("%s") pjmedia_vid_dev_index;                    // Unignore this 
    126 %rename("%s") PJMEDIA_VID_DEFAULT_CAPTURE_DEV;          // Unignore this 
    127 %rename("%s") PJMEDIA_VID_DEFAULT_RENDER_DEV;           // Unignore this 
    128 %rename("%s") PJMEDIA_VID_INVALID_DEV;                  // Unignore this 
    129 %include "pjmedia-videodev/videodev.h" 
    130  
    131 // 
    132 // 
    133 %rename("%s") pjsip_cred_data_type;                     // Unignore this 
    134 %rename("%s", regexmatch$name="PJSIP_CRED_DATA_.*") ""; // Unignore this 
    135 %include "pjsip/sip_auth.h" 
    136  
    137 // 
    138 // 
    139 %rename("%s") pjsip_status_code;                        // Unignore this 
    140 %rename("%s", regexmatch$name="PJSIP_SC_.*") "";        // Unignore this 
    141 %include "pjsip/sip_msg.h" 
    142  
    143 // 
    144 // 
    145 %rename("%s") pjsip_transport_type_e;                   // Unignore this 
    146 %rename("%s") pjsip_transport_flags_e;                  // Unignore this 
    147 %rename("%s") pjsip_transport_state;                    // Unignore this 
    148 %rename("%s", regexmatch$name="PJSIP_TRANSPORT_.*") ""; // Unignore this 
    149 %rename("%s", regexmatch$name="PJSIP_TP_STATE_.*") "";  // Unignore this 
    150 %include "pjsip/sip_transport.h" 
    151  
    152 // 
    153 // 
    154 %rename("%s") pjsip_ssl_method;                         // Unignore this 
    155 %rename("%s", regexmatch$name="PJSIP_TLS.*_METHOD") ""; // Unignore this 
    156 %rename("%s", regexmatch$name="PJSIP_SSL.*_METHOD") ""; // Unignore this 
    157 %include "pjsip/sip_transport_tls.h" 
    158  
    159 // 
    160 // 
    161 %rename("%s") PJSUA_INVALID_ID;                         // Unignore this 
    162 %rename("%s") pjsua_state;                              // Unignore this 
    163 %rename("%s", regexmatch$name="PJSUA_STATE_.*") "";     // Unignore this 
    164 %rename("%s") pjsua_stun_use;                           // Unignore this 
    165 %rename("%s", regexmatch$name="PJSUA_STUN_USE_.*") "";  // Unignore this 
    166 %rename("%s") pjsua_call_hold_type;                     // Unignore this 
    167 %rename("%s", regexmatch$name="PJSUA_CALL_HOLD_TYPE_.*") "";// Unignore this 
    168 %rename("%s") pjsua_acc_id;                             // Unignore this 
    169 %rename("%s") pjsua_destroy_flag;                       // Unignore this 
    170 %rename("%s", regexmatch$name="PJSUA_DESTROY_.*") "";   // Unignore this 
    171 %include "pjsua-lib/pjsua.h" 
    172  
    173 // 
    174 // Back to unignore everything 
    175 // 
    176 %rename("%s") ""; 
    177  
    178 // 
    179 // Ignore stuffs in pjsua2 itself 
     52// Ignore stuffs in pjsua2 
    18053// 
    18154%ignore fromPj; 
     
    18659// 
    18760%include "pjsua2/types.hpp" 
     61%template(SipHeaderVector)              std::vector<pj::SipHeader>; 
     62%template(AuthCredInfoVector)           std::vector<pj::AuthCredInfo>; 
     63%template(SipMultipartPartVector)       std::vector<pj::SipMultipartPart>; 
     64 
    18865%include "pjsua2/endpoint.hpp" 
    189 #include "pjsua2/account.hpp" 
     66%include "pjsua2/account.hpp" 
    19067 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/Makefile

    r4619 r4639  
    11PYTHON_SO=_pjsua2.so 
    22 
    3 PYTHON_SETUP_FLAGS = --inplace  
     3#PYTHON_SETUP_FLAGS = --inplace  
    44ifeq ($(OS),Windows_NT) 
    55  PYTHON_SETUP_FLAGS += --compiler=mingw32 
    66endif 
    77 
    8 .PHONY: all 
     8SWIG_FLAGS += -w312 
     9 
     10.PHONY: all install uninstall 
    911 
    1012all: $(PYTHON_SO) 
    1113 
    1214$(PYTHON_SO): pjsua2_wrap.cpp setup.py 
    13         python setup.py build_ext $(PYTHON_SETUP_FLAGS) 
     15        python setup.py build $(PYTHON_SETUP_FLAGS) 
    1416 
    15 pjsua2_wrap.cpp: ../pjsua2.i $(SRCS) 
     17pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i Makefile $(SRCS) 
    1618        swig $(SWIG_FLAGS) -python  -o pjsua2_wrap.cpp ../pjsua2.i 
    1719 
    1820clean distclean realclean: 
    1921        rm -rf $(PYTHON_SO) pjsua2_wrap.cpp pjsua2_wrap.h pjsua2.py build *.pyc 
     22 
     23install: 
     24        python setup.py install --user 
     25 
     26uninstall: 
     27        rm -f $(HOME)/.local/lib/python2.7/site-packages/pjsua2* 
     28        rm -f $(HOME)/.local/lib/python2.7/site-packages/_pjsua2* 
     29 
  • pjproject/branches/projects/pjsua2/pjsip/include/pjsua-lib/pjsua.h

    r4592 r4639  
    252252 
    253253/** Constant to identify invalid ID for all sorts of IDs. */ 
    254 #define PJSUA_INVALID_ID            (-1) 
     254enum pjsua_invalid_id_const_ 
     255{ 
     256    PJSUA_INVALID_ID = -1 
     257}; 
    255258 
    256259/** Disabled features temporarily for media reorganization */ 
     
    18811884 
    18821885/** 
     1886 * Register a thread to poll for events. This function should be 
     1887 * called by an external worker thread, and it will block polling 
     1888 * for events until the library is destroyed. 
     1889 * 
     1890 * @return              PJ_SUCCESS if things are working correctly 
     1891 *                      or an error polling cannot be done for some 
     1892 *                      reason. 
     1893 */ 
     1894PJ_DECL(pj_status_t) pjsua_register_worker_thread(const char *name); 
     1895 
     1896 
     1897/** 
     1898 * Signal all worker threads to quit. This will only wait until internal 
     1899 * threads are done. For external threads, application must perform 
     1900 * its own waiting for the external threads to quit from 
     1901 * pjsua_register_worker_thread() function. 
     1902 */ 
     1903PJ_DECL(void) pjsua_stop_worker_threads(void); 
     1904 
     1905/** 
    18831906 * Create memory pool to be used by the application. Once application 
    18841907 * finished using the pool, it must be released with pj_pool_release(). 
  • pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/account.hpp

    r4638 r4639  
    4242{ 
    4343using std::string; 
    44 using std::vector; 
    4544 
    4645/** 
     
    141140}; 
    142141 
     142/** Array of SIP credentials */ 
     143typedef std::vector<AuthCredInfo> AuthCredInfoVector; 
    143144 
    144145/** 
  • pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/endpoint.hpp

    r4638 r4639  
    598598 
    599599    /** 
     600     * Get library version. 
     601     */ 
     602    Version libVersion() const; 
     603 
     604    /** 
    600605     * Instantiate pjsua application. Application must call this function before 
    601606     * calling any other functions, to make sure that the underlying libraries 
     
    629634     */ 
    630635    void libStart() throw(Error); 
     636 
     637    /** 
     638     * Register a thread to poll for events. This function should be 
     639     * called by an external worker thread, and it will block polling 
     640     * for events until the library is destroyed. 
     641     */ 
     642    void libRegisterWorkerThread(const string &name) throw(Error); 
     643 
     644    /** 
     645     * Stop all worker threads. 
     646     */ 
     647    void libStopWorkerThreads(); 
     648 
     649    /** 
     650     * Poll pjsua for events, and if necessary block the caller thread for 
     651     * the specified maximum interval (in miliseconds). 
     652     * 
     653     * Application doesn't normally need to call this function if it has 
     654     * configured worker thread (\a thread_cnt field) in pjsua_config 
     655     * structure, because polling then will be done by these worker threads 
     656     * instead. 
     657     * 
     658     * @param msec_timeout Maximum time to wait, in miliseconds. 
     659     * 
     660     * @return          The number of events that have been handled during the 
     661     *                  poll. Negative value indicates error, and application 
     662     *                  can retrieve the error as (status = -return_value). 
     663     */ 
     664    int libHandleEvents(unsigned msec_timeout); 
    631665 
    632666    /** 
     
    641675     * keep track of it's state. 
    642676     * 
    643      * @param prmFlags          Combination of pjsua_destroy_flag enumeration. 
     677     * @param prmFlags  Combination of pjsua_destroy_flag enumeration. 
    644678     */ 
    645679    void libDestroy(unsigned prmFlags=0) throw(Error); 
  • pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/types.hpp

    r4638 r4639  
    7171 
    7272/* 
    73  * Forward declaration of Account, AccountConfig, to be used 
     73 * Forward declaration of Account to be used 
    7474 * by Endpoint. 
    7575 */ 
    7676class Account; 
    77 class AccountConfig; 
    7877 
    7978 
     
    143142 
    144143#   define PJSUA2_RAISE_ERROR3(status,op,txt)   \ 
    145         throw Error(status, op, txt, __FILE__, __LINE__) 
     144        do { \ 
     145            Error err_ = Error(status, op, txt, __FILE__, __LINE__); \ 
     146            PJ_LOG(1,(THIS_FILE, "%s", err_.info().c_str())); \ 
     147            throw err_; \ 
     148        } while (0) 
    146149 
    147150#else 
     
    153156 
    154157#   define PJSUA2_RAISE_ERROR3(status,op,txt)   \ 
    155         throw Error(status, op, txt, string(), 0) 
     158        do { \ 
     159            Error err_ = Error(status, op, txt, string(), 0); \ 
     160            PJ_LOG(1,(THIS_FILE, "%s", err_.info().c_str())); \ 
     161            throw err_; \ 
     162        } while (0) 
    156163 
    157164#endif 
     
    159166#define PJSUA2_CHECK_RAISE_ERROR2(status, op)   \ 
    160167        do { \ 
    161             if (status != PJ_SUCCESS) \ 
     168            if (status != PJ_SUCCESS) { \ 
    162169                PJSUA2_RAISE_ERROR2(status, op); \ 
     170            } \ 
    163171        } while (0) 
    164172 
     
    171179            PJSUA2_CHECK_RAISE_ERROR2(the_status, #expr); \ 
    172180        } while (0) 
     181 
     182////////////////////////////////////////////////////////////////////////////// 
     183 
     184struct Version 
     185{ 
     186    /** Major number */ 
     187    int         major; 
     188 
     189    /** Minor number */ 
     190    int         minor; 
     191 
     192    /** Additional revision number */ 
     193    int         rev; 
     194 
     195    /** Version suffix (e.g. "-svn") */ 
     196    string      suffix; 
     197 
     198    /** The full version info (e.g. "2.1.0-svn") */ 
     199    string      full; 
     200 
     201    /** 
     202     * PJLIB version number as three bytes with the following format: 
     203     * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision 
     204     * number, 00: always zero for now. 
     205     */ 
     206    unsigned    numeric; 
     207}; 
    173208 
    174209////////////////////////////////////////////////////////////////////////////// 
     
    232267                 const int data_type, 
    233268                 const string data); 
    234 }; 
    235  
    236 /** Array of SIP credentials */ 
    237 typedef std::vector<AuthCredInfo> AuthCredInfoVector; 
     269 
     270}; 
     271 
    238272 
    239273////////////////////////////////////////////////////////////////////////////// 
  • pjproject/branches/projects/pjsua2/pjsip/src/pjsua-lib/pjsua_core.c

    r4555 r4639  
    687687} 
    688688 
     689PJ_DEF(pj_status_t) pjsua_register_worker_thread(const char *name) 
     690{ 
     691    pj_thread_desc desc; 
     692    pj_thread_t *thread; 
     693    pj_status_t status; 
     694 
     695    if (pjsua_var.thread_quit_flag) 
     696        return PJ_EGONE; 
     697 
     698    status = pj_thread_register(NULL, desc, &thread); 
     699    if (status != PJ_SUCCESS) 
     700        return status; 
     701 
     702    if (name) 
     703        PJ_LOG(4,(THIS_FILE, "Worker thread %s started", name)); 
     704 
     705    worker_thread(NULL); 
     706 
     707    if (name) 
     708        PJ_LOG(4,(THIS_FILE, "Worker thread %s stopped", name)); 
     709 
     710    return PJ_SUCCESS; 
     711} 
     712 
     713PJ_DEF(void) pjsua_stop_worker_threads(void) 
     714{ 
     715    unsigned i; 
     716 
     717    pjsua_var.thread_quit_flag = 1; 
     718 
     719    /* Wait worker threads to quit: */ 
     720    for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) { 
     721        if (pjsua_var.thread[i]) { 
     722            pj_status_t status; 
     723            status = pj_thread_join(pjsua_var.thread[i]); 
     724            if (status != PJ_SUCCESS) { 
     725                PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread")); 
     726                pj_thread_sleep(1000); 
     727            } 
     728            pj_thread_destroy(pjsua_var.thread[i]); 
     729            pjsua_var.thread[i] = NULL; 
     730        } 
     731    } 
     732} 
    689733 
    690734/* Init random seed */ 
     
    14661510 
    14671511    /* Signal threads to quit: */ 
    1468     pjsua_var.thread_quit_flag = 1; 
    1469  
    1470     /* Wait worker threads to quit: */ 
    1471     for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) { 
    1472         if (pjsua_var.thread[i]) { 
    1473             pj_status_t status; 
    1474             status = pj_thread_join(pjsua_var.thread[i]); 
    1475             if (status != PJ_SUCCESS) { 
    1476                 PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread")); 
    1477                 pj_thread_sleep(1000); 
    1478             } 
    1479             pj_thread_destroy(pjsua_var.thread[i]); 
    1480             pjsua_var.thread[i] = NULL; 
    1481         } 
    1482     } 
     1512    pjsua_stop_worker_threads(); 
    14831513     
    14841514    if (pjsua_var.endpt) { 
  • pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/account.cpp

    r4638 r4639  
    333333/////////////////////////////////////////////////////////////////////////////// 
    334334 
     335AccountPresenceStatus::AccountPresenceStatus() 
     336: isOnline(false), activity(PJRPID_ACTIVITY_UNKNOWN) 
     337{ 
     338} 
     339 
     340/////////////////////////////////////////////////////////////////////////////// 
     341 
    335342void AccountInfo::fromPj(const pjsua_acc_info &pai) 
    336343{ 
     
    379386{ 
    380387    pjsua_acc_config pj_acc_cfg = acc_cfg.toPj(); 
    381  
     388    pj_acc_cfg.user_data = (void*)this; 
    382389    PJSUA2_CHECK_EXPR( pjsua_acc_modify(id, &pj_acc_cfg) ); 
    383390} 
  • pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/endpoint.cpp

    r4638 r4639  
    545545 * Endpoint library operations 
    546546 */ 
     547Version Endpoint::libVersion() const 
     548{ 
     549    Version ver; 
     550    ver.major = PJ_VERSION_NUM_MAJOR; 
     551    ver.minor = PJ_VERSION_NUM_MINOR; 
     552    ver.rev = PJ_VERSION_NUM_REV; 
     553    ver.suffix = PJ_VERSION_NUM_EXTRA; 
     554    ver.full = pj_get_version(); 
     555    ver.numeric = PJ_VERSION_NUM; 
     556    return ver; 
     557} 
     558 
    547559void Endpoint::libCreate() throw(Error) 
    548560{ 
     
    594606} 
    595607 
     608void Endpoint::libRegisterWorkerThread(const string &name) throw(Error) 
     609{ 
     610    PJSUA2_CHECK_EXPR(pjsua_register_worker_thread(name.c_str())); 
     611} 
     612 
     613void Endpoint::libStopWorkerThreads() 
     614{ 
     615    pjsua_stop_worker_threads(); 
     616} 
     617 
     618int Endpoint::libHandleEvents(unsigned msec_timeout) 
     619{ 
     620    return pjsua_handle_events(msec_timeout); 
     621} 
     622 
    596623void Endpoint::libDestroy(unsigned flags) throw(Error) 
    597624{ 
  • pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/types.cpp

    r4638 r4639  
    2323using namespace std; 
    2424 
     25#define THIS_FILE       "types.cpp" 
     26 
    2527/////////////////////////////////////////////////////////////////////////////// 
    2628 
Note: See TracChangeset for help on using the changeset viewer.