Samiul Aftad Chowdhury | 1 Jun 2008 12:05
Picon

Text display problem symbian_ua in E65

Hi,

I have successfully built and installed the symbian_ua in my E65
after following the instructions from http://trac.pjsip.org/repos/wiki/DevelopingSymbianAppWithCarbide

Now the only problem I am facing is that the text in the console is not showing properly.
After running the symbian_ua app in my phone i can only see the numbers [0-9]
and all the other texts [A-Za-z] are not showing in the display,
instead of displaying the characters, it is showing square boxes like .

Is there any font related problem I am missing??

I am using pjproject svn checkout 27/05/2008
SDK: S60_3rd_MR
IDE: Carbide C++ 1.3
Phone : Nokia E65 (default language English)

Regards,
Aftad

--
Samiul Aftad Chowdhury
Genuity Systems Ltd.
"Personally, if I find out my belief is wrong, I change my mind. I think that's a good way to live." - Lisa Randall

<div><p>Hi,<br><br>I have successfully built and installed the symbian_ua in my E65 <br>after following the instructions from <a href="http://trac.pjsip.org/repos/wiki/DevelopingSymbianAppWithCarbide">http://trac.pjsip.org/repos/wiki/DevelopingSymbianAppWithCarbide</a><br><br>Now the only problem I am facing is that the text in the console is not showing properly.<br>After running the symbian_ua app in my phone i can only see the numbers [0-9] <br>and all the other texts [A-Za-z] are not showing in the display, <br>
instead of displaying the characters, it is showing square boxes like <span>&#9608;</span>.<br><br>Is there any font related problem I am missing??<br><br>I am using pjproject svn checkout 27/05/2008<br>
SDK: S60_3rd_MR<br>IDE: Carbide C++ 1.3<br>Phone : Nokia E65 (default language English)<br clear="all"><br>Regards,<br>Aftad<br><br>-- <br>Samiul Aftad Chowdhury<br>Genuity Systems Ltd.<br>"Personally, if I find out my belief is wrong, I change my mind. I think that's a good way to live." - Lisa Randall
</p></div>
Benny Prijono | 1 Jun 2008 17:03
Favicon

Re: Odd Crash

On Sat, May 31, 2008 at 6:43 PM, Norman W. Franke <norman <at> myasd.com> wrote:
> On May 31, 2008, at 1:40 PM, Norman Franke wrote:
>
> On our production systems, we are getting some crashes like this:
> #0 0x00295108 in pjsua_call_on_media_update
> #1 0x002c79f4 in inv_negotiate_sdp
> #2 0x002c9810 in inv_check_sdp_in_incoming_msg
> #3 0x002ca128 in inv_on_state_early
> #4 0x002c7770 in mod_inv_on_tsx_state
> #5 0x002b4b14 in pjsip_dlg_on_tsx_state
> #6 0x002b9218 in tsx_set_state
> #7 0x002ba22c in tsx_on_state_proceeding_uac
> #8 0x002b9374 in pjsip_tsx_recv_msg
> #9 0x002bb334 in mod_tsx_layer_on_rx_response
> #10 0x00285d8c in endpt_on_rx_msg
> #11 0x002b10f0 in pjsip_tpmgr_receive_packe
> #12 0x002d2198 in udp_on_read_complete
> #13 0x002ada30 in ioqueue_dispatch_read_event
> #14 0x002ae398 in pj_ioqueue_poll
> #15 0x00285958 in pjsip_endpt_handle_events2
> #16 0x0028e56c in pjsua_handle_events
> #17 0x0028e5c8 in worker_thread
> #18 0x0028372c in thread_main
> #19 0x9002bd08 in _pthread_body
> I'll attempt to do both -O2 and -g to see if I can get some better stack
> traces. (I have to do -O2, or I get some glitches on some rather slow
> iMacs.)

All I can say for now is this looks to have something to do with
processing SDP in the response. If you have the message logging that
could be helpful.

Cheers
 Benny

Benny Prijono | 1 Jun 2008 17:07
Favicon

Re: Text display problem symbian_ua in E65

On Sun, Jun 1, 2008 at 11:05 AM, Samiul Aftad Chowdhury
<symbian.voip <at> gmail.com> wrote:
> Hi,
>
> I have successfully built and installed the symbian_ua in my E65
> after following the instructions from
> http://trac.pjsip.org/repos/wiki/DevelopingSymbianAppWithCarbide
>
> Now the only problem I am facing is that the text in the console is not
> showing properly.
> After running the symbian_ua app in my phone i can only see the numbers
> [0-9]
> and all the other texts [A-Za-z] are not showing in the display,
> instead of displaying the characters, it is showing square boxes like █.
>

Not sure why that happened, but we have a new sample application for
Symbian in pjsip-apps/symbian_ua_gui checked in just couple of days
ago, which is much more usable than the console sample. If you just
"svn up" again, the new app has been added to the bld.inf so it should
show up in Carbide.

Cheers
 Benny
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip <at> lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
Nanang Izzuddin | 1 Jun 2008 23:57
Favicon

Re: Text display problem symbian_ua in E65

Check this topic, it seems to give a solution at the end:
http://discussion.forum.nokia.com/forum/showthread.php?t=113763

Regards,
nanang

2008/6/1 Samiul Aftad Chowdhury <symbian.voip <at> gmail.com>:
> Hi,
>
> I have successfully built and installed the symbian_ua in my E65
> after following the instructions from
> http://trac.pjsip.org/repos/wiki/DevelopingSymbianAppWithCarbide
>
> Now the only problem I am facing is that the text in the console is not
> showing properly.
> After running the symbian_ua app in my phone i can only see the numbers
> [0-9]
> and all the other texts [A-Za-z] are not showing in the display,
> instead of displaying the characters, it is showing square boxes like █.
>
> Is there any font related problem I am missing??
>
> I am using pjproject svn checkout 27/05/2008
> SDK: S60_3rd_MR
> IDE: Carbide C++ 1.3
> Phone : Nokia E65 (default language English)
>
> Regards,
> Aftad
>
> --
> Samiul Aftad Chowdhury
> Genuity Systems Ltd.
> "Personally, if I find out my belief is wrong, I change my mind. I think
> that's a good way to live." - Lisa Randall
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip <at> lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip <at> lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
Thomas Plotkowiak | 2 Jun 2008 01:45
Picon

Re: Conferfence Bridge Benchmarking

So over the weekend I performed a litle benchmark-test of the conference bridge and am a bit puzzled with the results:

I took the confbench.c code and just commented out the null-ports.
So what happens is it creates sine ports and mixes them in the conference bridge.
I ran the same test with 1,2,4,8,16,32,64,128 and 256 Sineports, one time with resampling and one time without.
My machine is a AMD 64 Dual Core 4600+ with 3gig RAM.

What you see in the attached chart is, that with resampling with only 32 ports the cpu usage is already 100% and without resampling with 250 Sineports the CPU Usage is only 20%.

Does that mean that:

  • with resampling you practically can't have conferences with more than 32 people
  • without resampling (when you extrapolate) you cant have conferences more than around 1000 people?
What do you think of this conclusion:

If you take decoding, encoding the signal and all the other stuff into account, the limit of Conference-Servers must be somewhere less then 1000 participants in one conference, because they are limited by the computational power and not the available bandwidth?
Can anyone varify this ? Do you have different experiences?

The Code I used to perform the test:
/* $Id: confbench.c 974 2007-02-19 01:13:53Z bennylp $ */
/*
 * Copyright (C) 2003-2007 Benny Prijono <benny <at> prijono.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


/**
 * \page page_pjmedia_samples_confbench_c Samples: Benchmarking Conference Bridge
 *
 * Benchmarking pjmedia (conference bridge+resample). For my use only,
 * and it only works in Win32.
 *
 * This file is pjsip-apps/src/samples/confbench.c
 *
 * \includelineno confbench.c
 */


#include <pjmedia.h>
#include <pjlib-util.h>    /* pj_getopt */
#include <pjlib.h>
#include <stdlib.h>    /* atoi() */
#include <stdio.h>
#include <windows.h>

/* For logging purpose. */
#define THIS_FILE   "confsample.c"


/* Configurable:
 *   LARGE_SET will create in total of about 232 ports.
 *   HAS_RESAMPLE will activate resampling on about half
 *     the port.
 */
#define TEST_SET        LARGE_SET
#define HAS_RESAMPLE        0


#define SMALL_SET        16
#define LARGE_SET        250


#define PORT_COUNT        254
#define CLOCK_RATE        16000
#define SAMPLES_PER_FRAME   (CLOCK_RATE/100)
#if HAS_RESAMPLE
#  define SINE_CLOCK        32000
#else
#  define SINE_CLOCK        CLOCK_RATE
#endif
#define SINE_PTIME        20
#define DURATION        10

#define SINE_COUNT        TEST_SET
#define NULL_COUNT        TEST_SET
#define IDLE_COUNT        32


static void app_perror(const char *sender, const char *title, pj_status_t status)
{
    char errmsg[PJ_ERR_MSG_SIZE];

    pj_strerror(status, errmsg, sizeof(errmsg));
    PJ_LOG(1,(sender, "%s: %s", title, errmsg));
}


struct Times
{
    FILETIME        kernel_time;
    ULARGE_INTEGER  u_kernel_time;
    FILETIME        user_time;
    ULARGE_INTEGER  u_user_time;
    ULARGE_INTEGER  u_total;
};

static void process(struct Times *t)
{
    pj_memcpy(&t->u_kernel_time, &t->kernel_time, sizeof(FILETIME));
    pj_memcpy(&t->u_user_time, &t->user_time, sizeof(FILETIME));
    t->u_total.QuadPart = t->u_kernel_time.QuadPart + t->u_user_time.QuadPart;
}

static void benchmark(void)
{
    FILETIME creation_time, exit_time;
    struct Times start, end;
    DWORD ts, te;
    LARGE_INTEGER elapsed;
    BOOL rc;
    int i;
    double pct;

    puts("Test started!"); fflush(stdout);

    ts = GetTickCount();
    rc = GetProcessTimes(GetCurrentProcess(), &creation_time, &exit_time,
             &start.kernel_time, &start.user_time);
    for (i=DURATION; i>0; --i) {
    printf("\r%d ", i); fflush(stdout);
    pj_thread_sleep(1000);
    }
    rc = GetProcessTimes(GetCurrentProcess(), &creation_time, &exit_time,
             &end.kernel_time, &end.user_time);
    te = GetTickCount();

    process(&start);
    process(&end);

    elapsed.QuadPart = end.u_total.QuadPart - start.u_total.QuadPart;

    pct = elapsed.QuadPart * 100.0 / ((te-ts)*10000.0);

    printf("CPU usage=%6.4f%%\n", pct); fflush(stdout);
}



/* Struct attached to sine generator */
typedef struct
{
    pj_int16_t    *samples;    /* Sine samples.    */
} port_data;


/* This callback is called to feed more samples */
static pj_status_t sine_get_frame( pjmedia_port *port,
                   pjmedia_frame *frame)
{
    port_data *sine = port->port_data.pdata;
    pj_int16_t *samples = frame->buf;
    unsigned i, count, left, right;

    /* Get number of samples */
    count = frame->size / 2 / port->info.channel_count;

    left = 0;
    right = 0;

    for (i=0; i<count; ++i) {
    *samples++ = sine->samples[left];
    ++left;

    if (port->info.channel_count == 2) {
        *samples++ = sine->samples[right];
        right += 2; /* higher pitch so we can distinguish left and right. */
        if (right >= count)
        right = 0;
    }
    }

    /* Must set frame->type correctly, otherwise the sound device
     * will refuse to play.
     */
    frame->type = PJMEDIA_FRAME_TYPE_AUDIO;

    return PJ_SUCCESS;
}

#ifndef M_PI
#define M_PI  (3.14159265)
#endif

/*
 * Create a media port to generate sine wave samples.
 */
static pj_status_t create_sine_port(pj_pool_t *pool,
                    unsigned sampling_rate,
                    unsigned channel_count,
                    pjmedia_port **p_port)
{
    pjmedia_port *port;
    unsigned i;
    unsigned count;
    port_data *sine;

    PJ_ASSERT_RETURN(pool && channel_count > 0 && channel_count <= 2,
             PJ_EINVAL);

    port = pj_pool_zalloc(pool, sizeof(pjmedia_port));
    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;
   
    /* Set the function to feed frame */
    port->get_frame = &sine_get_frame;

    /* Create sine port data */
    port->port_data.pdata = sine = pj_pool_zalloc(pool, sizeof(port_data));

    /* Create samples */
    count = port->info.samples_per_frame / channel_count;
    sine->samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t));
    PJ_ASSERT_RETURN(sine->samples != NULL, PJ_ENOMEM);

    /* initialise sinusoidal wavetable */
    for( i=0; i<count; i++ )
    {
        sine->samples[i] = (pj_int16_t) (10000.0 *
        sin(((double)i/(double)count) * M_PI * 8.) );
    }

    *p_port = port;

    return PJ_SUCCESS;
}

int main()
{
    pj_caching_pool cp;
    pjmedia_endpt *med_endpt;
    pj_pool_t *pool;
    pjmedia_conf *conf;
    int i;
    pjmedia_port *sine_port[SINE_COUNT], *null_port, *conf_port;
    pjmedia_port *nulls[NULL_COUNT];
    unsigned null_slots[NULL_COUNT];
    pjmedia_master_port *master_port;
    pj_status_t status;


    pj_log_set_level(3);

    status = pj_init();
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);

    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
    pool = pj_pool_create( &cp.factory,        /* pool factory        */
               "wav",        /* pool name.        */
               4000,        /* init size        */
               4000,        /* increment size        */
               NULL            /* callback on error    */
               );

    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);

    status = pjmedia_conf_create( pool,
                  PORT_COUNT,
                  CLOCK_RATE,
                  1, SAMPLES_PER_FRAME, 16,
                  PJMEDIA_CONF_NO_DEVICE,
                  &conf);
    if (status != PJ_SUCCESS) {
    app_perror(THIS_FILE, "Unable to create conference bridge", status);
    return 1;
    }

    printf("Resampling is %s\n", (HAS_RESAMPLE?"active":"disabled"));

    /* Create sine ports. */
    printf("Creating %d sine generator ports..\n", SINE_COUNT);
    for (i=0; i<SINE_COUNT; ++i) {
    unsigned j, slot;

    status = create_sine_port(pool, SINE_CLOCK, 1, &sine_port[i]);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);

    status = pjmedia_conf_add_port( conf,        /* The bridge        */
                    pool,        /* pool            */
                    sine_port[i],    /* port to connect  */
                    NULL,        /* Use port's name  */
                    &slot        /* ptr for slot #   */
                    );
    if (status != PJ_SUCCESS) {
        app_perror(THIS_FILE, "Unable to add conference port", status);
        return 1;
    }
   
    /* Connect to Sound Device*/
    status = pjmedia_conf_connect_port(conf, slot, 0, 0);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);

    /*
    for (j=0; j<NULL_COUNT; ++j) {
        status = pjmedia_conf_connect_port(conf, slot, null_slots[j], 0);
        PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
    }
    */
    }

    /* Create idle ports */
    /*
    printf("Creating %d idle ports..\n", IDLE_COUNT);
    for (i=0; i<IDLE_COUNT; ++i) {
    pjmedia_port *dummy;
    status = pjmedia_null_port_create(pool, CLOCK_RATE, 1, SAMPLES_PER_FRAME, 16, &dummy);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
    status = pjmedia_conf_add_port(conf, pool, dummy, NULL, NULL);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
    }
    */

    /* Create null port */
    status = pjmedia_null_port_create(pool, CLOCK_RATE, 1, SAMPLES_PER_FRAME, 16,
                      &null_port);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
    conf_port = pjmedia_conf_get_master_port(conf);

    /* Create master port */
    status = pjmedia_master_port_create(pool, null_port, conf_port, 0, &master_port);
    pjmedia_master_port_start(master_port);

    puts("Waiting to settle.."); fflush(stdout);
    pj_thread_sleep(5000);


    benchmark();


    /* Done. */
    return 0;
}







2008/5/28 Benny Prijono <bennylp <at> pjsip.org>:
On Wed, May 28, 2008 at 2:12 PM, Thomas Plotkowiak <plotti <at> gmx.net> wrote:
> I will give confbridge a try, should be a good start to gather some data.
> I see there is already resampling possibility in confbench.c, how would I
> add some audiocodecs encoding / decoding to that to get a more realistic
> example?
>

Well just add it. :)

> Cheers,
> Thomas, who is really interested what the outcome of such a test will be ;)
>

Metoo!

Cheers
 Benny

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip <at> lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


<div>
<p>So over the weekend I performed a litle benchmark-test of the conference bridge and am a bit puzzled with the results:<br><br>I took the confbench.c code and just commented out the null-ports. <br>So what happens is it creates sine ports and mixes them in the conference bridge. <br>
I ran the same test with 1,2,4,8,16,32,64,128 and 256 Sineports, one time with resampling and one time without.<br>My machine is a AMD 64 Dual Core 4600+ with 3gig RAM.<br><br>What you see in the attached chart is, that with resampling with only 32 ports the cpu usage is already 100% and without resampling with 250 Sineports the CPU Usage is only 20%.<br><br>Does that mean that:<br></p>
<ul>
<li>with resampling you practically can't have conferences with more than 32 people</li>
<li>without resampling (when you extrapolate) you cant have conferences more than around 1000 people?</li>
</ul>What do you think of this conclusion: <br><br>If you take decoding, encoding the signal and all the other stuff into account, the limit of Conference-Servers must be somewhere less then 1000 participants in one conference, because they are limited by the computational power and not the available bandwidth?<br>
Can anyone varify this ? Do you have different experiences? <br><br>The Code I used to perform the test:<br>/* $Id: confbench.c 974 2007-02-19 01:13:53Z bennylp $ */<br>/* <br>&nbsp;* Copyright (C) 2003-2007 Benny Prijono &lt;<a href="mailto:benny <at> prijono.org">benny <at> prijono.org</a>&gt;<br>
&nbsp;*<br>&nbsp;* This program is free software; you can redistribute it and/or modify<br>&nbsp;* it under the terms of the GNU General Public License as published by<br>&nbsp;* the Free Software Foundation; either version 2 of the License, or<br>
&nbsp;* (at your option) any later version.<br>&nbsp;*<br>&nbsp;* This program is distributed in the hope that it will be useful,<br>&nbsp;* but WITHOUT ANY WARRANTY; without even the implied warranty of<br>&nbsp;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp; See the<br>
&nbsp;* GNU General Public License for more details.<br>&nbsp;*<br>&nbsp;* You should have received a copy of the GNU General Public License<br>&nbsp;* along with this program; if not, write to the Free Software<br>&nbsp;* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA&nbsp; 02111-1307&nbsp; USA <br>
&nbsp;*/<br><br><br>/**≤br>&nbsp;* \page page_pjmedia_samples_confbench_c Samples: Benchmarking Conference Bridge<br>&nbsp;*<br>&nbsp;* Benchmarking pjmedia (conference bridge+resample). For my use only,<br>&nbsp;* and it only works in Win32.<br>
&nbsp;*<br>&nbsp;* This file is pjsip-apps/src/samples/confbench.c<br>&nbsp;*<br>&nbsp;* \includelineno confbench.c<br>&nbsp;*/<br><br><br>#include &lt;pjmedia.h&gt;<br>#include &lt;pjlib-util.h&gt;&nbsp;&nbsp;&nbsp; /* pj_getopt */<br>#include &lt;pjlib.h&gt;<br>
#include &lt;stdlib.h&gt;&nbsp;&nbsp;&nbsp; /* atoi() */<br>#include &lt;stdio.h&gt;<br>#include &lt;windows.h&gt;<br><br>/* For logging purpose. */<br>#define THIS_FILE&nbsp;&nbsp; "confsample.c"<br><br><br>/* Configurable:<br>&nbsp;*&nbsp;&nbsp; LARGE_SET will create in total of about 232 ports.<br>
&nbsp;*&nbsp;&nbsp; HAS_RESAMPLE will activate resampling on about half<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; the port.<br>&nbsp;*/<br>#define TEST_SET&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LARGE_SET<br>#define HAS_RESAMPLE&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0<br><br><br>#define SMALL_SET&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 16<br>#define LARGE_SET&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 250<br><br><br>#define PORT_COUNT&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 254<br>#define CLOCK_RATE&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 16000<br>#define SAMPLES_PER_FRAME&nbsp;&nbsp; (CLOCK_RATE/100)<br>#if HAS_RESAMPLE<br>#&nbsp; define SINE_CLOCK&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 32000<br>#else<br>#&nbsp; define SINE_CLOCK&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CLOCK_RATE<br>
#endif<br>#define SINE_PTIME&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 20<br>#define DURATION&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 10<br><br>#define SINE_COUNT&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TEST_SET<br>#define NULL_COUNT&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TEST_SET<br>#define IDLE_COUNT&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 32<br><br><br>static void app_perror(const char *sender, const char *title, pj_status_t status)<br>
{<br>&nbsp;&nbsp;&nbsp; char errmsg[PJ_ERR_MSG_SIZE];<br><br>&nbsp;&nbsp;&nbsp; pj_strerror(status, errmsg, sizeof(errmsg));<br>&nbsp;&nbsp;&nbsp; PJ_LOG(1,(sender, "%s: %s", title, errmsg));<br>}<br><br><br>struct Times<br>{<br>&nbsp;&nbsp;&nbsp; FILETIME&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; kernel_time;<br>
&nbsp;&nbsp;&nbsp; ULARGE_INTEGER&nbsp; u_kernel_time;<br>&nbsp;&nbsp;&nbsp; FILETIME&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; user_time;<br>&nbsp;&nbsp;&nbsp; ULARGE_INTEGER&nbsp; u_user_time;<br>&nbsp;&nbsp;&nbsp; ULARGE_INTEGER&nbsp; u_total;<br>};<br><br>static void process(struct Times *t)<br>{<br>&nbsp;&nbsp;&nbsp; pj_memcpy(&amp;t-&gt;u_kernel_time, &amp;t-&gt;kernel_time, sizeof(FILETIME));<br>
&nbsp;&nbsp;&nbsp; pj_memcpy(&amp;t-&gt;u_user_time, &amp;t-&gt;user_time, sizeof(FILETIME));<br>&nbsp;&nbsp;&nbsp; t-&gt;u_total.QuadPart = t-&gt;u_kernel_time.QuadPart + t-&gt;u_user_time.QuadPart;<br>}<br><br>static void benchmark(void)<br>{<br>&nbsp;&nbsp;&nbsp; FILETIME creation_time, exit_time;<br>
&nbsp;&nbsp;&nbsp; struct Times start, end;<br>&nbsp;&nbsp;&nbsp; DWORD ts, te;<br>&nbsp;&nbsp;&nbsp; LARGE_INTEGER elapsed;<br>&nbsp;&nbsp;&nbsp; BOOL rc;<br>&nbsp;&nbsp;&nbsp; int i;<br>&nbsp;&nbsp;&nbsp; double pct;<br><br>&nbsp;&nbsp;&nbsp; puts("Test started!"); fflush(stdout);<br><br>&nbsp;&nbsp;&nbsp; ts = GetTickCount();<br>
&nbsp;&nbsp;&nbsp; rc = GetProcessTimes(GetCurrentProcess(), &amp;creation_time, &amp;exit_time,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&amp;start.kernel_time, &amp;start.user_time);<br>&nbsp;&nbsp;&nbsp; for (i=DURATION; i&gt;0; --i) {<br>&nbsp;&nbsp;&nbsp; printf("\r%d ", i); fflush(stdout);<br>
&nbsp;&nbsp;&nbsp; pj_thread_sleep(1000);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; rc = GetProcessTimes(GetCurrentProcess(), &amp;creation_time, &amp;exit_time,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&amp;end.kernel_time, &amp;end.user_time);<br>&nbsp;&nbsp;&nbsp; te = GetTickCount();<br><br>&nbsp;&nbsp;&nbsp; process(&amp;start);<br>
&nbsp;&nbsp;&nbsp; process(&amp;end);<br><br>&nbsp;&nbsp;&nbsp; elapsed.QuadPart = end.u_total.QuadPart - start.u_total.QuadPart;<br><br>&nbsp;&nbsp;&nbsp; pct = elapsed.QuadPart * 100.0 / ((te-ts)*10000.0);<br><br>&nbsp;&nbsp;&nbsp; printf("CPU usage=%6.4f%%\n", pct); fflush(stdout);<br>
}<br><br><br><br>/* Struct attached to sine generator */<br>typedef struct<br>{<br>&nbsp;&nbsp;&nbsp; pj_int16_t&nbsp;&nbsp;&nbsp; *samples;&nbsp;&nbsp;&nbsp; /* Sine samples.&nbsp;&nbsp;&nbsp; */<br>} port_data;<br><br><br>/* This callback is called to feed more samples */<br>static pj_status_t sine_get_frame( pjmedia_port *port, <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; pjmedia_frame *frame)<br>{<br>&nbsp;&nbsp;&nbsp; port_data *sine = port-&gt;port_data.pdata;<br>&nbsp;&nbsp;&nbsp; pj_int16_t *samples = frame-&gt;buf;<br>&nbsp;&nbsp;&nbsp; unsigned i, count, left, right;<br><br>&nbsp;&nbsp;&nbsp; /* Get number of samples */<br>
&nbsp;&nbsp;&nbsp; count = frame-&gt;size / 2 / port-&gt;info.channel_count;<br><br>&nbsp;&nbsp;&nbsp; left = 0;<br>&nbsp;&nbsp;&nbsp; right = 0;<br><br>&nbsp;&nbsp;&nbsp; for (i=0; i&lt;count; ++i) {<br>&nbsp;&nbsp;&nbsp; *samples++ = sine-&gt;samples[left];<br>&nbsp;&nbsp;&nbsp; ++left;<br><br>&nbsp;&nbsp;&nbsp; if (port-&gt;info.channel_count == 2) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *samples++ = sine-&gt;samples[right];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; right += 2; /* higher pitch so we can distinguish left and right. */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (right &gt;= count)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; right = 0;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; /* Must set frame-&gt;type correctly, otherwise the sound device<br>
&nbsp;&nbsp;&nbsp;&nbsp; * will refuse to play.<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; frame-&gt;type = PJMEDIA_FRAME_TYPE_AUDIO;<br><br>&nbsp;&nbsp;&nbsp; return PJ_SUCCESS;<br>}<br><br>#ifndef M_PI<br>#define M_PI&nbsp; (3.14159265)<br>#endif<br><br>/*<br>&nbsp;* Create a media port to generate sine wave samples.<br>
&nbsp;*/<br>static pj_status_t create_sine_port(pj_pool_t *pool,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; unsigned sampling_rate,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; unsigned channel_count,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pjmedia_port **p_port)<br>{<br>&nbsp;&nbsp;&nbsp; pjmedia_port *port;<br>
&nbsp;&nbsp;&nbsp; unsigned i;<br>&nbsp;&nbsp;&nbsp; unsigned count;<br>&nbsp;&nbsp;&nbsp; port_data *sine;<br><br>&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(pool &amp;&amp; channel_count &gt; 0 &amp;&amp; channel_count &lt;= 2, <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; PJ_EINVAL);<br><br>&nbsp;&nbsp;&nbsp; port = pj_pool_zalloc(pool, sizeof(pjmedia_port));<br>
&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(port != NULL, PJ_ENOMEM);<br><br>&nbsp;&nbsp;&nbsp; /* Fill in port info. */<br>&nbsp;&nbsp;&nbsp; port-&gt;info.bits_per_sample = 16;<br>&nbsp;&nbsp;&nbsp; port-&gt;info.channel_count = channel_count;<br>&nbsp;&nbsp;&nbsp; port-&gt;info.encoding_name = pj_str("pcm");<br>
&nbsp;&nbsp;&nbsp; port-&gt;info.has_info = 1;<br>&nbsp;&nbsp;&nbsp; port-&gt;<a href="http://info.name">info.name</a> = pj_str("sine generator");<br>&nbsp;&nbsp;&nbsp; port-&gt;info.need_info = 0;<br>&nbsp;&nbsp;&nbsp; port-&gt;<a href="http://info.pt">info.pt</a> = 0xFF;<br>
&nbsp;&nbsp;&nbsp; port-&gt;info.clock_rate = sampling_rate;<br>&nbsp;&nbsp;&nbsp; port-&gt;info.samples_per_frame = sampling_rate * SINE_PTIME / 1000 * channel_count;<br>&nbsp;&nbsp;&nbsp; port-&gt;info.bytes_per_frame = port-&gt;info.samples_per_frame * 2;<br>&nbsp;&nbsp;&nbsp; port-&gt;info.type = PJMEDIA_TYPE_AUDIO;<br>
&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; /* Set the function to feed frame */<br>&nbsp;&nbsp;&nbsp; port-&gt;get_frame = &amp;sine_get_frame;<br><br>&nbsp;&nbsp;&nbsp; /* Create sine port data */<br>&nbsp;&nbsp;&nbsp; port-&gt;port_data.pdata = sine = pj_pool_zalloc(pool, sizeof(port_data));<br><br>&nbsp;&nbsp;&nbsp; /* Create samples */<br>&nbsp;&nbsp;&nbsp; count = port-&gt;info.samples_per_frame / channel_count;<br>&nbsp;&nbsp;&nbsp; sine-&gt;samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t));<br>&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(sine-&gt;samples != NULL, PJ_ENOMEM);<br><br>&nbsp;&nbsp;&nbsp; /* initialise sinusoidal wavetable */<br>&nbsp;&nbsp;&nbsp; for( i=0; i&lt;count; i++ )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sine-&gt;samples[i] = (pj_int16_t) (10000.0 * <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sin(((double)i/(double)count) * M_PI * 8.) );<br>&nbsp;&nbsp;&nbsp; }<br><br>
&nbsp;&nbsp;&nbsp; *p_port = port;<br><br>&nbsp;&nbsp;&nbsp; return PJ_SUCCESS;<br>}<br><br>int main()<br>{<br>&nbsp;&nbsp;&nbsp; pj_caching_pool cp;<br>&nbsp;&nbsp;&nbsp; pjmedia_endpt *med_endpt;<br>&nbsp;&nbsp;&nbsp; pj_pool_t *pool;<br>&nbsp;&nbsp;&nbsp; pjmedia_conf *conf;<br>&nbsp;&nbsp;&nbsp; int i;<br>&nbsp;&nbsp;&nbsp; pjmedia_port *sine_port[SINE_COUNT], *null_port, *conf_port;<br>
&nbsp;&nbsp;&nbsp; pjmedia_port *nulls[NULL_COUNT];<br>&nbsp;&nbsp;&nbsp; unsigned null_slots[NULL_COUNT];<br>&nbsp;&nbsp;&nbsp; pjmedia_master_port *master_port;<br>&nbsp;&nbsp;&nbsp; pj_status_t status;<br><br><br>&nbsp;&nbsp;&nbsp; pj_log_set_level(3);<br><br>&nbsp;&nbsp;&nbsp; status = pj_init();<br>&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br><br>&nbsp;&nbsp;&nbsp; pj_caching_pool_init(&amp;cp, &amp;pj_pool_factory_default_policy, 0);<br>&nbsp;&nbsp;&nbsp; pool = pj_pool_create( &amp;cp.factory,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* pool factory&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; "wav",&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* pool name.&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 4000,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* init size&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 4000,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* increment size&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* callback on error&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; );<br><br>&nbsp;&nbsp;&nbsp; status = pjmedia_endpt_create(&amp;cp.factory, NULL, 1, &amp;med_endpt);<br>
&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br><br>&nbsp;&nbsp;&nbsp; status = pjmedia_conf_create( pool,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; PORT_COUNT,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; CLOCK_RATE,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; 1, SAMPLES_PER_FRAME, 16,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; PJMEDIA_CONF_NO_DEVICE,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &amp;conf);<br>&nbsp;&nbsp;&nbsp; if (status != PJ_SUCCESS) {<br>&nbsp;&nbsp;&nbsp; app_perror(THIS_FILE, "Unable to create conference bridge", status);<br>&nbsp;&nbsp;&nbsp; return 1;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; printf("Resampling is %s\n", (HAS_RESAMPLE?"active":"disabled"));<br><br>&nbsp;&nbsp;&nbsp; /* Create sine ports. */<br>&nbsp;&nbsp;&nbsp; printf("Creating %d sine generator ports..\n", SINE_COUNT);<br>&nbsp;&nbsp;&nbsp; for (i=0; i&lt;SINE_COUNT; ++i) {<br>&nbsp;&nbsp;&nbsp; unsigned j, slot;<br><br>&nbsp;&nbsp;&nbsp; status = create_sine_port(pool, SINE_CLOCK, 1, &amp;sine_port[i]);<br>
&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br><br>&nbsp;&nbsp;&nbsp; status = pjmedia_conf_add_port( conf,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* The bridge&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pool,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* pool&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sine_port[i],&nbsp;&nbsp;&nbsp; /* port to connect&nbsp; */<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* Use port's name&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;slot&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* ptr for slot #&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; );<br>&nbsp;&nbsp;&nbsp; if (status != PJ_SUCCESS) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; app_perror(THIS_FILE, "Unable to add conference port", status);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 1;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; /* Connect to Sound Device*/<br>&nbsp;&nbsp;&nbsp; status = pjmedia_conf_connect_port(conf, slot, 0, 0);<br>&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br><br>&nbsp;&nbsp;&nbsp; /*<br>&nbsp;&nbsp;&nbsp; for (j=0; j&lt;NULL_COUNT; ++j) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; status = pjmedia_conf_connect_port(conf, slot, null_slots[j], 0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; /* Create idle ports */<br>&nbsp;&nbsp;&nbsp; /*<br>&nbsp;&nbsp;&nbsp; printf("Creating %d idle ports..\n", IDLE_COUNT);<br>
&nbsp;&nbsp;&nbsp; for (i=0; i&lt;IDLE_COUNT; ++i) {<br>&nbsp;&nbsp;&nbsp; pjmedia_port *dummy;<br>&nbsp;&nbsp;&nbsp; status = pjmedia_null_port_create(pool, CLOCK_RATE, 1, SAMPLES_PER_FRAME, 16, &amp;dummy);<br>&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br>&nbsp;&nbsp;&nbsp; status = pjmedia_conf_add_port(conf, pool, dummy, NULL, NULL);<br>
&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; */<br><br>&nbsp;&nbsp;&nbsp; /* Create null port */<br>&nbsp;&nbsp;&nbsp; status = pjmedia_null_port_create(pool, CLOCK_RATE, 1, SAMPLES_PER_FRAME, 16,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;null_port);<br>
&nbsp;&nbsp;&nbsp; PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);<br>&nbsp;&nbsp;&nbsp; conf_port = pjmedia_conf_get_master_port(conf);<br><br>&nbsp;&nbsp;&nbsp; /* Create master port */<br>&nbsp;&nbsp;&nbsp; status = pjmedia_master_port_create(pool, null_port, conf_port, 0, &amp;master_port);<br>
&nbsp;&nbsp;&nbsp; pjmedia_master_port_start(master_port);<br><br>&nbsp;&nbsp;&nbsp; puts("Waiting to settle.."); fflush(stdout);<br>&nbsp;&nbsp;&nbsp; pj_thread_sleep(5000);<br><br><br>&nbsp;&nbsp;&nbsp; benchmark();<br><br><br>&nbsp;&nbsp;&nbsp; /* Done. */<br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br><br><br><br><br><br><br><br><div class="gmail_quote">2008/5/28 Benny Prijono &lt;<a href="mailto:bennylp <at> pjsip.org">bennylp <at> pjsip.org</a>&gt;:<br><blockquote class="gmail_quote">
<div class="Ih2E3d">On Wed, May 28, 2008 at 2:12 PM, Thomas Plotkowiak &lt;<a href="mailto:plotti <at> gmx.net">plotti <at> gmx.net</a>&gt; wrote:<br>
&gt; I will give confbridge a try, should be a good start to gather some data.<br>
&gt; I see there is already resampling possibility in confbench.c, how would I<br>
&gt; add some audiocodecs encoding / decoding to that to get a more realistic<br>
&gt; example?<br>
&gt;<br><br>
</div>Well just add it. :)<br><div class="Ih2E3d">
<br>
&gt; Cheers,<br>
&gt; Thomas, who is really interested what the outcome of such a test will be ;)<br>
&gt;<br><br>
</div>Metoo!<br><div>
<div></div>
<div class="Wj3C7c">
<br>
Cheers<br>
&nbsp;Benny<br><br>
_______________________________________________<br>
Visit our blog: <a href="http://blog.pjsip.org" target="_blank">http://blog.pjsip.org</a><br><br>
pjsip mailing list<br><a href="mailto:pjsip <at> lists.pjsip.org">pjsip <at> lists.pjsip.org</a><br><a href="http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org" target="_blank">http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org</a><br><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
Esben Stien | 2 Jun 2008 04:57
Favicon

JACK Sample Rate

Trying to use pjsip with JACK portaudio plugin. You seem to try to
open the JACK device in a sample rate other than the JACK server
sample rate. This is of course not possible.

JACK is most probably running at 44.1, 48, or 96 kHz. Mine is
96kHz. There must be some separation of what sample rate you open a
JACK device with and the sample rate you use in the pjsip application.

You have to do resampling when opening a JACK device. 

Anyone looking at this?

--

-- 
Esben Stien is b0ef <at> e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
           sip:b0ef <at>    e     e 
           jid:b0ef <at>     n     n

Benny Prijono | 2 Jun 2008 10:07
Favicon

Re: Conferfence Bridge Benchmarking

On Mon, Jun 2, 2008 at 12:45 AM, Thomas Plotkowiak <plotti <at> gmx.net> wrote:
> So over the weekend I performed a litle benchmark-test of the conference
> bridge and am a bit puzzled with the results:
>
> I took the confbench.c code and just commented out the null-ports.
> So what happens is it creates sine ports and mixes them in the conference
> bridge.
> I ran the same test with 1,2,4,8,16,32,64,128 and 256 Sineports, one time
> with resampling and one time without.
> My machine is a AMD 64 Dual Core 4600+ with 3gig RAM.
>
> What you see in the attached chart is, that with resampling with only 32
> ports the cpu usage is already 100% and without resampling with 250
> Sineports the CPU Usage is only 20%.
>

Thanks for the nice chart! It's very useful.

> Does that mean that:
>
> with resampling you practically can't have conferences with more than 32
> people

The default algorithm for resampling uses the high quality with large
filter and this requires lots of computation indeed. You can try to
use small filter or linear resampling with PJMEDIA_CONF_SMALL_FILTER
or PJMEDIA_CONF_USE_LINEAR flag when creating the conference bridge.

> without resampling (when you extrapolate) you cant have conferences more
> than around 1000 people?
>

How did you come to this conclusion? There's no hard limit on the
number of participants in the bridge, so it's only limited by the
processing power of the CPU (it may or may not exceed 1000).

> What do you think of this conclusion:
>
> If you take decoding, encoding the signal and all the other stuff into
> account, the limit of Conference-Servers must be somewhere less then 1000
> participants in one conference, because they are limited by the
> computational power and not the available bandwidth?

Yeah probably something like that. But I don't think people will want
to join to a conference with more than tens people, so if a conference
server needs to accommodate large number of people, I think creating
multiple bridges (and hence multiple/separate conferences) probably is
better. This approach is also more scalable since you can then run the
bridges on different threads.

Cheers
 Benny

Benny Prijono | 2 Jun 2008 10:13
Favicon

Re: JACK Sample Rate

On Mon, Jun 2, 2008 at 3:57 AM, Esben Stien <b0ef <at> esben-stien.name> wrote:
> Trying to use pjsip with JACK portaudio plugin. You seem to try to
> open the JACK device in a sample rate other than the JACK server
> sample rate. This is of course not possible.
>
> JACK is most probably running at 44.1, 48, or 96 kHz. Mine is
> 96kHz. There must be some separation of what sample rate you open a
> JACK device with and the sample rate you use in the pjsip application.
>
> You have to do resampling when opening a JACK device.
>

You can always give pjsua --clock-rate option to force the media
framework (inc. the sound device and the conference bridge) to run at
specific sample rate. Then things will be resampled automatically as
necessary.

But this was not very optimal since every media ports then need to be
resampled. So we added --snd-clock-rate option to pjsua recently to
open the sound device at different clock rate than the conference
bridge.

Cheers
 Benny

Esben Stien | 2 Jun 2008 15:15
Favicon

Re: JACK Sample Rate

"Benny Prijono" <bennylp <at> pjsip.org> writes:

> we added --snd-clock-rate option to pjsua recently to open the sound
> device at different clock rate than the conference bridge.

Damn, I should have seen that in the --help output. It didn't work
though, as it expects rates between 8 and 48 kHz.

15:13:24.721    pjsua_app.c Error: expecting value between 8000-48000 for sound device clock rate

--

-- 
Esben Stien is b0ef <at> e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
           sip:b0ef <at>    e     e 
           jid:b0ef <at>     n     n

Benny Prijono | 2 Jun 2008 13:44
Favicon

Re: JACK Sample Rate

On Mon, Jun 2, 2008 at 2:15 PM, Esben Stien <b0ef <at> esben-stien.name> wrote:
> "Benny Prijono" <bennylp <at> pjsip.org> writes:
>
>> we added --snd-clock-rate option to pjsua recently to open the sound
>> device at different clock rate than the conference bridge.
>
> Damn, I should have seen that in the --help output. It didn't work
> though, as it expects rates between 8 and 48 kHz.
>
> 15:13:24.721    pjsua_app.c Error: expecting value between 8000-48000 for sound device clock rate
>

So what value did you give it? Of course say if you want 44.1KHz you
need to put 44100 rather than 44.1.

 -benny


Gmane