PJSIP Performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 19, 2010 at 08:55, Benny Prijono <bennylp at teluu.com> wrote:
>
> On Thu, Feb 18, 2010 at 8:51 PM, Governa <affqlixo at gmail.com> wrote:
> > Hi,
> >
> > First of all, english is not my main language, so take care!?=)
>
> Don't worry, your English is perfect! :)
>
> > I'm having problems with PJMEDIA performance in my aplication while?running
> > it in a OMAP35xx processor (ARM / ~600MHz).
> > The aplication send an RTP stream over the network whenever someone push a
> > button. The stream will be received in many devices(including the one that
> > is generating it) throught Multicast.
> > In the sender side:
> > I've created some (3) streams that should be avaible all the time the
> > program is running, so that the push button -> sound sequence is the fastest
> > possible. Each one send the RTP stream to a different multicast address.
> > In the receiver side:
> > There are at most 3 streams listening to one multicast address each.
> > The?sender?signals the receiver each time the button is pushed, so I can
> > open/resume the stream processing.
> > But running 6 streams is a bit too much for the processor.
>
> How is your interconnection in the bridge? I assume the streams would
> be connected to the sound device, but are they connected to the sound
> device all the time? By connected/disconnected I mean the
> conf_connect/disconnect_port functions.
>
> You should optimize the interconnection in the bridge by connecting
> the streams to/from the sound device as needed. For example, you
> definitely don't need to connect the microphone to the receiver
> streams, nor the transmitter stream to the speaker, and you also
> should disconnect the microphone from the stream when the button is
> not pressed.
>

This is exactly what I was trying to do. I'm doing it like this:
Connect:
pjmedia_conf_connect_port(conf, rtp_slot, 0, 0);
pjmedia_conf_connect_port(conf, 0, rtp_slot, 0);
Disconnect:
pjmedia_conf_disconnect_port(conf, rtp_slot, 0);
pjmedia_conf_disconnect_port(conf, 0, rtp_slot);

I have 3 sound devices, so I have 3 conference bridges in the
receiver's side and 3 in the sender's side. In the receiver side I
don't really need the conference bridge but it is not causing any
problems either and its easier to initialize all the streams in the
same way.
>From what I've understood of the documentation[*]?the snd_port is in
slot 0, and there should be only one snd_port, is that right?

[*] http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__CONF.htm#gfcac2438fa076eb94571de14e51835cb

>
> > When I run the application with gprof enabled, I see get_frame and put_frame
> > as the great consumers of CPU power.
>
> No surprise here, since that's where most of the works are done,
> including encoding/decoding audio. So as I said above, it's important
> to disconnect the mic from the streams when you're not transmitting,
> to prevent unnecessary get/put_frame calls.
>

Yes, I really expected to have this functions as the bottlenecks ?when
I'm streaming. The strange thing is that they are running even without
streaming (after pausing the RTP stream with
pjmedia_stream_pause(sound_fd[fd]->rtp_stream,
PJMEDIA_DIR_ENCODING_DECODING);). I've checked if the stream was
really stopped with wireshark and there is nothing in the network.

> What codec are you using?
>

L16/16000/1, but see below...

> > I have one conference brigde, so that I can connect wav_players and
> > recorders, so my first solution was to try to disconnect everything from the
> > conference brigde.
> > I tried disconnecting the snd_port also, but no difference in performance
> > with this step. I've searched a bit and found?pjmedia_aud_stream_stop
>
> What do you mean by disconnecting the snd_port? Did you mean
> snd_port_disconnect or conf_disconnect_port?
>
> Disconnecting the sound port with snd_port_disconnect should
> definitely make a difference, since this would prevent the conference
> bridge from running. If you don't see any different, then either the
> CPU hog is not in the bridge, or there's some mistake in your
> procedure.
>

I disconnect the snd_port from the conference with:
pjmedia_snd_port_disconnect(snd_port);

But this is not enought to stop it. I've profiled the program
again(now with callgrind) and the CPU seems to go to ALSA.
During the profiling, I've not streamed anyting, only opened the
streams and paused then with
conf_disconnect/snd_port_disconnect/pjmedia_stream_pause.

Since the bridge is not connecting the RTP stream and the snd_port and
there are no packets in the network, I assume the RTP is really
paused. And since the profiling pointed to ALSA, I assume the problem
is in snd_port. Am I missing something?

I can use some tricks in ALSA configuration to speed up the things,
but I really want to stop requesting data from the system when I don't
need it. Is this possible with PJ or will I have to search in
portaudio?

> > and?pjmedia_aud_stream_start, but stopping and starting when needed don't
> > make the sound come back.
> > (How) am I supposed to start/stop an pjmedia_aud_stream? Am I missing
> > something?
>
> I guess it depends on the audio backend being, some backends don't
> like to be stopped and restarted. But since stopping and restarting
> are expensive operations anyway, you should use
> conf_connect/disconnect instead.
>
>
> Cheers
> Benny

Thanks,
Fernando



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux