Multiple frames per RTP packet

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

 



I did this way when I use pjmedia for streaming.

/*
 * Create stream based on the codec, dir, remote address, etc.
 */
pj_status_t create_stream( pj_pool_t *pool,
                  pjmedia_endpt *med_endpt,
                  const pjmedia_codec_info *codec_info,
                  unsigned int ptime,
                  unsigned int rtp_ssrc,
                  pjmedia_dir dir,
                  pjmedia_transport *transport,
                  const pj_sockaddr_in *rem_addr,
                  pjmedia_stream **p_stream )
{
    pjmedia_stream_info info;
    pj_status_t status;

    /* Reset stream info. */
    pj_bzero(&info, sizeof(info));

    /* Initialize stream info formats */
    info.type = PJMEDIA_TYPE_AUDIO;                                    /*
Media type */
    info.dir = dir;                                                    /*
Media direction. */
    pj_memcpy(&info.fmt, codec_info, sizeof(pjmedia_codec_info));    /*
Incoming codec format info. */
    info.tx_pt = codec_info->pt;                                    /*
Outgoing codec paylaod type. */
    if (rtp_ssrc == 0)
        info.ssrc = pj_rand();                                        /* RTP
SSRC. */
    else
        info.ssrc = rtp_ssrc;
    info.tx_event_pt = 101;                                            /*
Remote support RFC 2833, otherwise we can't use pjmedia_stream_dial_dtmf(),
check PJSIP FAQ about DTMF */

    pjmedia_codec_param param;
    pjmedia_codec_mgr *codec_mgr = pjmedia_endpt_get_codec_mgr(med_endpt);
    status = pjmedia_codec_mgr_get_default_param(codec_mgr, codec_info,
&param);
    if (status != PJ_SUCCESS)
    {
        return status;
    }

    if (global_var.is_no_vad)
        param.setting.vad = 0;
    else
        param.setting.vad = 1;

    param.setting.frm_per_pkt = (pj_uint8_t)(ptime / param.info.frm_ptime);

    info.param = &param;

    /* Copy remote address */
    pj_memcpy(&info.rem_addr, rem_addr, sizeof(pj_sockaddr_in));    /*
Remote RTP address  */

    /* Now that the stream info is initialized, we can create the
     * stream.
     */
    status = pjmedia_stream_create( med_endpt, pool, &info, transport, NULL,
p_stream);

    if (status != PJ_SUCCESS) {
//        app_perror(THIS_FILE, "Error creating stream", status);
        return status;
    }

    return PJ_SUCCESS;
}


On Wed, Jan 21, 2009 at 12:11 AM, Anna White <anna1.white at yahoo.com> wrote:

> Continue .. to previous message , "easy" I mean slowly, not undestandable.
>
>  ------------------------------
> *From:* Anna White <anna1.white at yahoo.com>
> *To:* pjsip list <pjsip at lists.pjsip.org>
> *Sent:* Tuesday, January 20, 2009 11:45:53 AM
> *Subject:* Re: [pjsip] Multiple frames per RTP packet
>
>  Thank you for your response.
> As basic for my application I use streamutil.c . If I change only
> attr->setting.frm_per_pkt = 3
> then voise is "easy".
> What can you recommend me ?
>
>
>
>
>  ------------------------------
> *From:* Benny Prijono <bennylp at teluu.com>
> *To:* pjsip list <pjsip at lists.pjsip.org>
> *Sent:* Monday, January 19, 2009 5:43:25 PM
> *Subject:* Re: [pjsip] Multiple frames per RTP packet
>
> On Sun, Jan 18, 2009 at 4:11 PM, Anna White <anna1.white at yahoo.com> wrote:
>
>>  Hi,
>> I need to send multiple frames per RTP packet.
>> I use the following components : conference, stream.
>> For example, I need to send 3 frames per packet for SPEEX codec.
>> What changes I need to do besides changing frm_per_pkt?
>> ( in spx_default_attr() function speex_codec.c file
>> attr->setting.frm_per_pkt = 3;   // previous was 1)
>>
>
> You don't need to change that. Just use the pjsua_media_config.ptime
> setting or --ptime cmdline argument in pjsua to control the length of your
> RTP packet.
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090121/2f45c0f2/attachment-0001.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