Ignore:
Timestamp:
Mar 10, 2016 5:02:07 AM (8 years ago)
Author:
ming
Message:

Fixed #1907: Remove pjmedia* circular dependency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/endpoint.h

    r4474 r5255  
    4141#include <pjmedia/sdp.h> 
    4242#include <pjmedia/transport.h> 
     43#include <pjmedia-audiodev/audiodev.h> 
    4344 
    4445 
     
    8283 * @return              PJ_SUCCESS on success. 
    8384 */ 
    84 PJ_DECL(pj_status_t) pjmedia_endpt_create( pj_pool_factory *pf, 
     85PJ_DECL(pj_status_t) pjmedia_endpt_create2(pj_pool_factory *pf, 
    8586                                           pj_ioqueue_t *ioqueue, 
    8687                                           unsigned worker_cnt, 
     
    8889 
    8990/** 
     91 * Create an instance of media endpoint and initialize audio subsystem. 
     92 * 
     93 * @param pf            Pool factory, which will be used by the media endpoint 
     94 *                      throughout its lifetime. 
     95 * @param ioqueue       Optional ioqueue instance to be registered to the  
     96 *                      endpoint. The ioqueue instance is used to poll all RTP 
     97 *                      and RTCP sockets. If this argument is NULL, the  
     98 *                      endpoint will create an internal ioqueue instance. 
     99 * @param worker_cnt    Specify the number of worker threads to be created 
     100 *                      to poll the ioqueue. 
     101 * @param p_endpt       Pointer to receive the endpoint instance. 
     102 * 
     103 * @return              PJ_SUCCESS on success. 
     104 */ 
     105PJ_INLINE(pj_status_t) pjmedia_endpt_create(pj_pool_factory *pf, 
     106                                            pj_ioqueue_t *ioqueue, 
     107                                            unsigned worker_cnt, 
     108                                            pjmedia_endpt **p_endpt) 
     109{ 
     110    /* This function is inlined to avoid build problem due to circular 
     111     * dependency, i.e: this function prevents pjmedia's dependency on 
     112     * pjmedia-audiodev. 
     113     */ 
     114 
     115    pj_status_t status; 
     116 
     117    /* Sound */ 
     118    status = pjmedia_aud_subsys_init(pf); 
     119    if (status != PJ_SUCCESS) 
     120        return status; 
     121 
     122    status = pjmedia_endpt_create2(pf, ioqueue, worker_cnt, p_endpt); 
     123    if (status != PJ_SUCCESS) { 
     124        pjmedia_aud_subsys_shutdown(); 
     125    } 
     126     
     127    return status; 
     128} 
     129 
     130/** 
    90131 * Destroy media endpoint instance. 
    91132 * 
     
    94135 * @return              PJ_SUCCESS on success. 
    95136 */ 
    96 PJ_DECL(pj_status_t) pjmedia_endpt_destroy(pjmedia_endpt *endpt); 
     137PJ_DECL(pj_status_t) pjmedia_endpt_destroy2(pjmedia_endpt *endpt); 
     138 
     139/** 
     140 * Destroy media endpoint instance and shutdown audio subsystem. 
     141 * 
     142 * @param endpt         Media endpoint instance. 
     143 * 
     144 * @return              PJ_SUCCESS on success. 
     145 */ 
     146PJ_INLINE(pj_status_t) pjmedia_endpt_destroy(pjmedia_endpt *endpt) 
     147{ 
     148    /* This function is inlined to avoid build problem due to circular 
     149     * dependency, i.e: this function prevents pjmedia's dependency on 
     150     * pjmedia-audiodev. 
     151     */ 
     152     pj_status_t status = pjmedia_endpt_destroy2(endpt); 
     153     pjmedia_aud_subsys_shutdown(); 
     154     return status; 
     155} 
    97156 
    98157/** 
Note: See TracChangeset for help on using the changeset viewer.