- Timestamp:
- Mar 15, 2011 11:20:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/stream.c
r3435 r3446 66 66 #endif 67 67 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 68 75 69 76 … … 101 108 pjmedia_endpt *endpt; /**< Media endpoint. */ 102 109 pjmedia_codec_mgr *codec_mgr; /**< Codec manager instance. */ 103 110 pjmedia_stream_info si; /**< Creation parameter. */ 104 111 pjmedia_port port; /**< Port interface. */ 105 112 pjmedia_channel *enc; /**< Encoding channel. */ 106 113 pjmedia_channel *dec; /**< Decoding channel. */ 114 115 pj_pool_t *own_pool; /**< Only created if not given */ 107 116 108 117 pjmedia_dir dir; /**< Stream direction. */ … … 1944 1953 unsigned jb_init, jb_max, jb_min_pre, jb_max_pre, len; 1945 1954 pjmedia_audio_format_detail *afd; 1955 pj_pool_t *own_pool = NULL; 1946 1956 char *p; 1947 1957 pj_status_t status; 1948 1958 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 } 1950 1968 1951 1969 /* Allocate the media stream: */ … … 1953 1971 stream = PJ_POOL_ZALLOC_T(pool, pjmedia_stream); 1954 1972 PJ_ASSERT_RETURN(stream != NULL, PJ_ENOMEM); 1973 stream->own_pool = own_pool; 1974 pj_memcpy(&stream->si, info, sizeof(*info)); 1955 1975 1956 1976 /* Init stream/port name */ … … 2443 2463 #endif 2444 2464 2465 if (stream->own_pool) { 2466 pj_pool_t *pool = stream->own_pool; 2467 stream->own_pool = NULL; 2468 pj_pool_release(pool); 2469 } 2445 2470 return PJ_SUCCESS; 2446 2471 } … … 2495 2520 } 2496 2521 2522 2523 PJ_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 } 2497 2531 2498 2532 /*
Note: See TracChangeset
for help on using the changeset viewer.