Question about adding a codec

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

 



Hi,

Yes, currently there is no way to put non-integer ptime (and bitrate)
in the codec attributes, sorry for that. Just added a ticket for this:
http://trac.pjsip.org/repos/ticket/605.

However, for now you could cheat a bit to integrate MELP into PJSIP:
- set codec ptime to 45ms.
- encode(), decode(), and parse() should aware that other pjmedia
components outside this codec will 'think' that the codec works with
45ms frames, in other words encode() and decode() will be supplied
with 45ms frames (encode/decode twice), parse() should parse per 45ms
encoded frame.
This trick will introduce additional 22.5ms latency, i.e: latency of
multiple frames per packet.

Regarding bitrate, I think it's better to put the rounded-up bitrate: 2489 bps.

Regards,
nanang


On 29/08/2008, wsycqyz <wsycqyz at 126.com> wrote:
> Hi,
>  I want to implement the MELP 2.4Kbps codec in the pjmedia_codec.
>  As far as I know, MELP 2.4Kbps is running at 8KHz of sampling. Every frame
> has 180 samples(that is 22.5ms). Every frame is encoded to 54 bits. I will
> encode every frame to 56 bits(7 bytes) with padding 2 bits zero.
>  I would like to use the gsm.c as a template. Now comes the question:
>
>  Because the actual bit rate is: 56*1000/22.5=2488.89 and one frame is
> 22.5ms length, how can I set the attr->info.avg_bps, attr->info.max_bps and
> attr->info.frm_ptime in the default_attr function?
>
> ps: In gsm.c, code is like this:
>
> static pj_status_t gsm_default_attr (pjmedia_codec_factory *factory,
>                       const pjmedia_codec_info *id,
>                       pjmedia_codec_param *attr )
> {
>     PJ_UNUSED_ARG(factory);
>     PJ_UNUSED_ARG(id);
>
>     pj_bzero(attr, sizeof(pjmedia_codec_param));
>     attr->info.clock_rate = 8000;
>     attr->info.channel_cnt = 1;
>     attr->info.avg_bps = 13200;
>     attr->info.max_bps = 13200;
>     attr->info.pcm_bits_per_sample = 16;
>     attr->info.frm_ptime = 20;
>     attr->info.pt = PJMEDIA_RTP_PT_GSM;
>     ......
> }
>
> _______________________________________________
> 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
>
>



[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