Changeset 3446


Ignore:
Timestamp:
Mar 15, 2011 11:20:35 AM (13 years ago)
Author:
bennylp
Message:

Fixed #1207: Deprecation of pjmedia_session:

  • add new APIs in stream so that app can use this directly instead of via session
  • moved some APIs from session to stream
Location:
pjproject/branches/projects/2.0-dev/pjmedia
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/stream.h

    r3420 r3446  
    8989 * its own RTP/RTCP socket pair. 
    9090 */ 
    91 struct pjmedia_stream_info 
     91typedef struct pjmedia_stream_info 
    9292{ 
    9393    pjmedia_type        type;       /**< Media type (audio, video)          */ 
     
    135135                                         is enabled?                        */ 
    136136#endif 
    137 }; 
    138  
    139  
    140 /** 
    141  * @see pjmedia_stream_info. 
    142  */ 
    143 typedef struct pjmedia_stream_info pjmedia_stream_info; 
     137} pjmedia_stream_info; 
    144138 
    145139 
     
    247241 
    248242/** 
     243 * Get the stream info. 
     244 * 
     245 * @param stream        The media stream. 
     246 * @param info          Stream info. 
     247 * 
     248 * @return              PJ_SUCCESS on success. 
     249 */ 
     250PJ_DECL(pj_status_t) pjmedia_stream_get_info( const pjmedia_stream *stream, 
     251                                              pjmedia_stream_info *info); 
     252 
     253/** 
    249254 * Get the stream statistics. See also 
    250255 * #pjmedia_stream_get_stat_jbuf() 
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/session.c

    r3379 r3446  
    141141} 
    142142 
    143  
     143#if 0   // Moved to stream.c 
    144144/* 
    145145 * Create stream info from SDP media line. 
     
    605605    return PJ_SUCCESS; 
    606606} 
    607  
     607#endif 
    608608 
    609609/* 
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/stream.c

    r3435 r3446  
    6666#endif 
    6767 
     68#ifndef PJMEDIA_STREAM_SIZE 
     69#   define PJMEDIA_STREAM_SIZE  1000 
     70#endif 
     71 
     72#ifndef PJMEDIA_STREAM_INC 
     73#   define PJMEDIA_STREAM_INC   1000 
     74#endif 
    6875 
    6976 
     
    101108    pjmedia_endpt           *endpt;         /**< Media endpoint.            */ 
    102109    pjmedia_codec_mgr       *codec_mgr;     /**< Codec manager instance.    */ 
    103  
     110    pjmedia_stream_info      si;            /**< Creation parameter.        */ 
    104111    pjmedia_port             port;          /**< Port interface.            */ 
    105112    pjmedia_channel         *enc;           /**< Encoding channel.          */ 
    106113    pjmedia_channel         *dec;           /**< Decoding channel.          */ 
     114 
     115    pj_pool_t               *own_pool;      /**< Only created if not given  */ 
    107116 
    108117    pjmedia_dir              dir;           /**< Stream direction.          */ 
     
    19441953    unsigned jb_init, jb_max, jb_min_pre, jb_max_pre, len; 
    19451954    pjmedia_audio_format_detail *afd; 
     1955    pj_pool_t *own_pool = NULL; 
    19461956    char *p; 
    19471957    pj_status_t status; 
    19481958 
    1949     PJ_ASSERT_RETURN(pool && info && p_stream, PJ_EINVAL); 
     1959    PJ_ASSERT_RETURN(endpt && info && p_stream, PJ_EINVAL); 
     1960 
     1961    if (pool == NULL) { 
     1962        own_pool = pjmedia_endpt_create_pool( endpt, "strm%p", 
     1963                                              PJMEDIA_STREAM_SIZE, 
     1964                                              PJMEDIA_STREAM_INC); 
     1965        PJ_ASSERT_RETURN(own_pool != NULL, PJ_ENOMEM); 
     1966        pool = own_pool; 
     1967    } 
    19501968 
    19511969    /* Allocate the media stream: */ 
     
    19531971    stream = PJ_POOL_ZALLOC_T(pool, pjmedia_stream); 
    19541972    PJ_ASSERT_RETURN(stream != NULL, PJ_ENOMEM); 
     1973    stream->own_pool = own_pool; 
     1974    pj_memcpy(&stream->si, info, sizeof(*info)); 
    19551975 
    19561976    /* Init stream/port name */ 
     
    24432463#endif 
    24442464 
     2465    if (stream->own_pool) { 
     2466        pj_pool_t *pool = stream->own_pool; 
     2467        stream->own_pool = NULL; 
     2468        pj_pool_release(pool); 
     2469    } 
    24452470    return PJ_SUCCESS; 
    24462471} 
     
    24952520} 
    24962521 
     2522 
     2523PJ_DEF(pj_status_t) pjmedia_stream_get_info( const pjmedia_stream *stream, 
     2524                                             pjmedia_stream_info *info) 
     2525{ 
     2526    PJ_ASSERT_RETURN(stream && info, PJ_EINVAL); 
     2527 
     2528    pj_memcpy(info, &stream->si, sizeof(pjmedia_stream_info)); 
     2529    return PJ_SUCCESS; 
     2530} 
    24972531 
    24982532/* 
Note: See TracChangeset for help on using the changeset viewer.