Ignore:
Timestamp:
Jun 19, 2008 2:10:28 PM (16 years ago)
Author:
bennylp
Message:

Ticket #549: major modification in media transport API to support more offer/answer scenarios

File:
1 edited

Legend:

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

    r1998 r2032  
    321321 
    322322    /** 
     323     * Prepare the transport for a new media session. 
     324     * 
     325     * Application should call #pjmedia_transport_media_create() instead of  
     326     * calling this function directly. 
     327     */ 
     328    pj_status_t (*media_create)(pjmedia_transport *tp, 
     329                                pj_pool_t *sdp_pool, 
     330                                unsigned options, 
     331                                const pjmedia_sdp_session *remote_sdp, 
     332                                unsigned media_index); 
     333 
     334    /** 
    323335     * This function is called by application to generate the SDP parts 
    324336     * related to transport type, e.g: ICE, SRTP. 
    325337     * 
    326      * Application should call #pjmedia_transport_media_create() instead of  
    327      * calling this function directly. 
    328      */ 
    329     pj_status_t (*media_create)(pjmedia_transport *tp, 
    330                                 pj_pool_t *pool, 
    331                                 unsigned options, 
    332                                 pjmedia_sdp_session *sdp_local, 
    333                                 const pjmedia_sdp_session *sdp_remote, 
    334                                 unsigned media_index); 
     338     * Application should call #pjmedia_transport_encode_sdp() instead of 
     339     * calling this function directly. 
     340     */ 
     341    pj_status_t (*encode_sdp)(pjmedia_transport *tp, 
     342                              pj_pool_t *sdp_pool, 
     343                              pjmedia_sdp_session *sdp_local, 
     344                              const pjmedia_sdp_session *rem_sdp, 
     345                              unsigned media_index); 
    335346 
    336347    /** 
     
    342353     */ 
    343354    pj_status_t (*media_start) (pjmedia_transport *tp, 
    344                                 pj_pool_t *pool, 
    345                                 pjmedia_sdp_session *sdp_local, 
     355                                pj_pool_t *tmp_pool, 
     356                                const pjmedia_sdp_session *sdp_local, 
    346357                                const pjmedia_sdp_session *sdp_remote, 
    347358                                unsigned media_index); 
     
    627638 
    628639/** 
    629  * Generate local SDP parts that are related to the specified media transport. 
    630  * Remote SDP might be needed as reference when application is in deciding 
    631  * side of negotiation (callee side), otherwise it should be NULL. 
    632  * 
    633  * This API is provided to allow the media transport to add more information 
    634  * in the SDP offer, before the offer is sent to remote. Additionally, for  
    635  * answerer side, this callback allows the media transport to reject the  
    636  * offer before this offer is processed by the SDP negotiator.  
     640 * Prepare the media transport for a new media session, and optionally 
     641 * encode the relevant information in the \a sdp_local. Application must 
     642 * call this function before starting a new media session using this 
     643 * transport. 
    637644 * 
    638645 * This is just a simple wrapper which calls <tt>media_create()</tt> member  
     
    640647 * 
    641648 * @param tp            The media transport. 
    642  * @param pool          The memory pool. 
     649 * @param sdp_pool      Pool object to allocate memory related to SDP 
     650 *                      messaging components. 
    643651 * @param option        Option flags, from #pjmedia_tranport_media_option 
    644  * @param sdp_local     Local SDP. 
    645  * @param sdp_remote    Remote SDP. 
     652 * @param rem_sdp       Remote SDP if it's available. 
    646653 * @param media_index   Media index in SDP. 
    647654 * 
     
    649656 */ 
    650657PJ_INLINE(pj_status_t) pjmedia_transport_media_create(pjmedia_transport *tp, 
    651                                     pj_pool_t *pool, 
     658                                    pj_pool_t *sdp_pool, 
    652659                                    unsigned options, 
    653                                     pjmedia_sdp_session *sdp_local, 
    654                                     const pjmedia_sdp_session *sdp_remote, 
     660                                    const pjmedia_sdp_session *rem_sdp, 
    655661                                    unsigned media_index) 
    656662{ 
    657     return (*tp->op->media_create)(tp, pool, options, sdp_local, sdp_remote,  
     663    return (*tp->op->media_create)(tp, sdp_pool, options, rem_sdp,  
    658664                                   media_index); 
    659665} 
     666 
     667 
     668/** 
     669 * Put transport specific information into the SDP. This function can be 
     670 * called to create SDP offer or answer, depending whether \a rem_sdp 
     671 * parameter is present. 
     672 * 
     673 * This is just a simple wrapper which calls <tt>encode_sdp()</tt> member  
     674 * of the transport. 
     675 * 
     676 * @param tp            The media transport. 
     677 * @param sdp_pool      Pool object to allocate memory related to SDP 
     678 *                      messaging components. 
     679 * @param sdp           The local SDP to be filled in information from the 
     680 *                      media transport. 
     681 * @param rem_sdp       Remote SDP if it's available. 
     682 * @param media_index   Media index in SDP. 
     683 * 
     684 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     685 */ 
     686PJ_INLINE(pj_status_t) pjmedia_transport_encode_sdp(pjmedia_transport *tp, 
     687                                            pj_pool_t *sdp_pool, 
     688                                            pjmedia_sdp_session *sdp, 
     689                                            const pjmedia_sdp_session *rem_sdp, 
     690                                            unsigned media_index) 
     691{ 
     692    return (*tp->op->encode_sdp)(tp, sdp_pool, sdp, rem_sdp, media_index); 
     693} 
     694 
    660695 
    661696/** 
     
    674709 * 
    675710 * @param tp            The media transport. 
    676  * @param pool          The memory pool. 
     711 * @param tmp_pool      The memory pool for allocating temporary objects. 
    677712 * @param option        The media transport option. 
    678713 * @param sdp_local     Local SDP. 
     
    683718 */ 
    684719PJ_INLINE(pj_status_t) pjmedia_transport_media_start(pjmedia_transport *tp, 
    685                                     pj_pool_t *pool, 
    686                                     pjmedia_sdp_session *sdp_local, 
     720                                    pj_pool_t *tmp_pool, 
     721                                    const pjmedia_sdp_session *sdp_local, 
    687722                                    const pjmedia_sdp_session *sdp_remote, 
    688723                                    unsigned media_index) 
    689724{ 
    690     return (*tp->op->media_start)(tp, pool, sdp_local, sdp_remote, media_index); 
     725    return (*tp->op->media_start)(tp, tmp_pool, sdp_local, sdp_remote,  
     726                                  media_index); 
    691727} 
    692728 
Note: See TracChangeset for help on using the changeset viewer.