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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.