Adding new codec

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

 



Hello,

I?m trying to add the ogg vorbis codec to the pjlib and what I?ve did so far
is copied the L16 codec(I used this because it does no encoding so it?s more
simple to modify) , added ogg vorbis and fishsound(simplifies the vorbis
api) libraries to the pjproject.

The most important vorbis-related code resides in the  encode() and parse()
functions. And here is the first problem I ran into, apparently there is
some sort of synchronization between  the parse() and the decode() calls.
During encoding, vorbis produces packets which have different sizes and
contain different number of frames, so basically what I did was decode
incoming packets in the parse() call, return as many as possible through the
frames[] argument and store in a buffer for a subequent call of parse() the
rest of the frames. After that decode() just plays back the frames returned
by parse(). And the problem is that I can hear some small pauses in sound.
>From my understanding, parse() is only called when a packet is received from
the remote party and decode() in turn si only called when parse is called so
sound is played back only when I receive data.

I tried to avoid what seemed to be this problem by placing all the frames
produced by the ogg vorbis decoder in a buffer and creating a player using
pjmedia_snd_port_create_player() and this player reads the frames from that
buffer. This works fine apparently, there are no pauses in sound but after a
hour or so of functioning a crash occurs. In this case the callback for the
pjmedia player and the decode() callback run at the same time, difference is
that the output argument from decode() has output->size=0 and output->type =
PJMEDIA_FRAME_TYPE_NONE while the getframe callback is responsible for
feeding audio data. The crash appears in the
pjmedia_port_get_frame->get_frame->pjmedia_jbuf_get_frame2 or
pjmedia_port_get_frame->get_frame->pj_mutex_unlock.

My question is if there is a sync between parse() and decode() how can I
break it. And if the architecture doesn?t allow this, is there any
restriction on using decode() and pjmedia snd player together, because this
may be a cause for the crashes I?m seeing?

Thanks,
Mihai Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20111202/e267baab/attachment.html>


[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