From cd283c8825c9a94400f27735acb1c9385e90ffc8 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Tue, 19 Jul 2011 03:42:28 +0000 Subject: Re #1326: Initial code integration from branch 2.0-dev to trunk as "2.0-pre-alpha-svn". git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3664 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/samples/confbench.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'pjsip-apps/src/samples/confbench.c') diff --git a/pjsip-apps/src/samples/confbench.c b/pjsip-apps/src/samples/confbench.c index 264947f9..db9cd55f 100644 --- a/pjsip-apps/src/samples/confbench.c +++ b/pjsip-apps/src/samples/confbench.c @@ -147,7 +147,7 @@ static pj_status_t sine_get_frame( pjmedia_port *port, unsigned i, count, left, right; /* Get number of samples */ - count = frame->size / 2 / port->info.channel_count; + count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info); left = 0; right = 0; @@ -156,7 +156,7 @@ static pj_status_t sine_get_frame( pjmedia_port *port, *samples++ = sine->samples[left]; ++left; - if (port->info.channel_count == 2) { + if (PJMEDIA_PIA_CCNT(&port->info) == 2) { *samples++ = sine->samples[right]; right += 2; /* higher pitch so we can distinguish left and right. */ if (right >= count) @@ -187,6 +187,7 @@ static pj_status_t create_sine_port(pj_pool_t *pool, pjmedia_port *port; unsigned i; unsigned count; + pj_str_t port_name; port_data *sine; PJ_ASSERT_RETURN(pool && channel_count > 0 && channel_count <= 2, @@ -196,17 +197,10 @@ static pj_status_t create_sine_port(pj_pool_t *pool, PJ_ASSERT_RETURN(port != NULL, PJ_ENOMEM); /* Fill in port info. */ - port->info.bits_per_sample = 16; - port->info.channel_count = channel_count; - port->info.encoding_name = pj_str("pcm"); - port->info.has_info = 1; - port->info.name = pj_str("sine generator"); - port->info.need_info = 0; - port->info.pt = 0xFF; - port->info.clock_rate = sampling_rate; - port->info.samples_per_frame = sampling_rate * SINE_PTIME / 1000 * channel_count; - port->info.bytes_per_frame = port->info.samples_per_frame * 2; - port->info.type = PJMEDIA_TYPE_AUDIO; + port_name = pj_str("sine generator"); + pjmedia_port_info_init(&port->info, &port_name, + 12345, sampling_rate, channel_count, 16, + sampling_rate * SINE_PTIME / 1000 * channel_count); /* Set the function to feed frame */ port->get_frame = &sine_get_frame; @@ -215,7 +209,7 @@ static pj_status_t create_sine_port(pj_pool_t *pool, port->port_data.pdata = sine = pj_pool_zalloc(pool, sizeof(port_data)); /* Create samples */ - count = port->info.samples_per_frame / channel_count; + count = PJMEDIA_PIA_SPF(&port->info) / channel_count; sine->samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t)); PJ_ASSERT_RETURN(sine->samples != NULL, PJ_ENOMEM); -- cgit v1.2.3