- Timestamp:
- Dec 10, 2010 8:55:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/confbench.c
r2394 r3394 148 148 149 149 /* Get number of samples */ 150 count = frame->size / 2 / port->info.channel_count;150 count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info); 151 151 152 152 left = 0; … … 157 157 ++left; 158 158 159 if ( port->info.channel_count== 2) {159 if (PJMEDIA_PIA_CCNT(&port->info) == 2) { 160 160 *samples++ = sine->samples[right]; 161 161 right += 2; /* higher pitch so we can distinguish left and right. */ … … 188 188 unsigned i; 189 189 unsigned count; 190 pj_str_t port_name; 190 191 port_data *sine; 191 192 … … 197 198 198 199 /* Fill in port info. */ 199 port->info.bits_per_sample = 16; 200 port->info.channel_count = channel_count; 201 port->info.encoding_name = pj_str("pcm"); 202 port->info.has_info = 1; 203 port->info.name = pj_str("sine generator"); 204 port->info.need_info = 0; 205 port->info.pt = 0xFF; 206 port->info.clock_rate = sampling_rate; 207 port->info.samples_per_frame = sampling_rate * SINE_PTIME / 1000 * channel_count; 208 port->info.bytes_per_frame = port->info.samples_per_frame * 2; 209 port->info.type = PJMEDIA_TYPE_AUDIO; 200 port_name = pj_str("sine generator"); 201 pjmedia_port_info_init(&port->info, &port_name, 202 12345, sampling_rate, channel_count, 16, 203 sampling_rate * SINE_PTIME / 1000 * channel_count); 210 204 211 205 /* Set the function to feed frame */ … … 216 210 217 211 /* Create samples */ 218 count = port->info.samples_per_frame/ channel_count;212 count = PJMEDIA_PIA_SPF(&port->info) / channel_count; 219 213 sine->samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t)); 220 214 PJ_ASSERT_RETURN(sine->samples != NULL, PJ_ENOMEM);
Note: See TracChangeset
for help on using the changeset viewer.