Changeset 3116 for pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp
- Timestamp:
- Mar 4, 2010 3:47:25 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp
r2821 r3116 41 41 static unsigned rec_cnt, play_cnt; 42 42 static pj_time_val t_start; 43 44 pj_pool_t *pool; 45 pjmedia_delay_buf *delaybuf; 43 static pjmedia_aud_param param; 44 static pj_pool_t *pool; 45 static pjmedia_delay_buf *delaybuf; 46 static char frame_buf[256]; 47 48 static void copy_frame_ext(pjmedia_frame_ext *f_dst, 49 const pjmedia_frame_ext *f_src) 50 { 51 pj_bzero(f_dst, sizeof(*f_dst)); 52 if (f_src->subframe_cnt) { 53 f_dst->base.type = PJMEDIA_FRAME_TYPE_EXTENDED; 54 for (unsigned i = 0; i < f_src->subframe_cnt; ++i) { 55 pjmedia_frame_ext_subframe *sf; 56 sf = pjmedia_frame_ext_get_subframe(f_src, i); 57 pjmedia_frame_ext_append_subframe(f_dst, sf->data, sf->bitlen, 58 param.samples_per_frame); 59 } 60 } else { 61 f_dst->base.type = PJMEDIA_FRAME_TYPE_NONE; 62 } 63 } 46 64 47 65 /* Logging callback */ … … 138 156 PJ_UNUSED_ARG(user_data); 139 157 140 pjmedia_delay_buf_put(delaybuf, (pj_int16_t*)frame->buf); 141 142 if (frame->size != SAMPLES_PER_FRAME*2) { 143 PJ_LOG(3, (THIS_FILE, "Size captured = %u", 144 frame->size)); 158 if (param.ext_fmt.id == PJMEDIA_FORMAT_PCM) { 159 pjmedia_delay_buf_put(delaybuf, (pj_int16_t*)frame->buf); 160 161 if (frame->size != SAMPLES_PER_FRAME*2) { 162 PJ_LOG(3, (THIS_FILE, "Size captured = %u", 163 frame->size)); 164 } 165 } else { 166 pjmedia_frame_ext *f_src = (pjmedia_frame_ext*)frame; 167 pjmedia_frame_ext *f_dst = (pjmedia_frame_ext*)frame_buf; 168 169 copy_frame_ext(f_dst, f_src); 145 170 } 146 171 … … 155 180 PJ_UNUSED_ARG(user_data); 156 181 157 pjmedia_delay_buf_get(delaybuf, (pj_int16_t*)frame->buf); 158 frame->size = SAMPLES_PER_FRAME*2; 159 frame->type = PJMEDIA_FRAME_TYPE_AUDIO; 182 if (param.ext_fmt.id == PJMEDIA_FORMAT_PCM) { 183 pjmedia_delay_buf_get(delaybuf, (pj_int16_t*)frame->buf); 184 frame->size = SAMPLES_PER_FRAME*2; 185 frame->type = PJMEDIA_FRAME_TYPE_AUDIO; 186 } else { 187 pjmedia_frame_ext *f_src = (pjmedia_frame_ext*)frame_buf; 188 pjmedia_frame_ext *f_dst = (pjmedia_frame_ext*)frame; 189 190 copy_frame_ext(f_dst, f_src); 191 } 160 192 161 193 ++play_cnt; … … 166 198 static pj_status_t snd_start(unsigned flag) 167 199 { 168 pjmedia_aud_param param;169 200 pj_status_t status; 170 201 … … 179 210 param.samples_per_frame = SAMPLES_PER_FRAME; 180 211 param.dir = (pjmedia_dir) flag; 212 param.ext_fmt.id = PJMEDIA_FORMAT_AMR; 213 param.ext_fmt.bitrate = 12200; 214 param.output_route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER; 181 215 182 216 status = pjmedia_aud_stream_create(¶m, &rec_cb, &play_cb, NULL, &strm);
Note: See TracChangeset
for help on using the changeset viewer.