osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Re: Replacing sound device with a DSP - msg#00092

List: voip.pjsip

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

Hi Dinesh,

Is ur DSP running as a separate process?
If yes, u can try these hacks- its ugly but it works.

Option A - work with rtp packets,  ur dsp need to be able to encode/decode rtp packets
Stream.c (pjproject-0.8.0\pjmedia\src\pjmedia)
 
#define MY_DSP
#ifdef MY_DSP
pjmedia_transport *my_rtp_tp = NULL;

// callback func called by my IPC client interface to send rtp via pjmedia
// data = 1 rtp packet
void  my_dsp_send_RTP_pkt_to_remote_cb(const void *data, int len){
    if(my_rtp_tp)
         pjmedia_transport_send_rtp(my_rtp_tp, data, len);
}
#endif
 
pjmedia_stream_create(){

.......
    /* Success! */
    *p_stre am = stream;
#ifdef MY_DSP
       my_dsp_register_send_RTP_pkt_to_remote_cb_func( &send_RTP_pkt_to_remote_cb )
       my_rtp_tp = pjmedia_stream_get_transport(*p_stream);
#endif

    PJ_LOG(5,(THIS_FILE, "Stream %s created", stream->port.info.name.ptr));
    return PJ_SUCCESS;
}

pjmedia_stream_destroy( ){

    PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);

#ifdef MY_DSP
    my_dsp_deregister_send_RTP_pkt_to_remote_cb_func();
    my_rtp_tp=NULL; 
#endif

.....
}

on_rx_rtp( void *data, const void *pkt,  pj_ssize_t bytes_read){
#ifdef MY_DSP
    send_RTP_pkt_to_my_ dsp_over_IPC(pkt, bytes_read);
    return;
#endif

....
}

Option B -  working with raw pcm, let pjmedia handle rtp and pcm encoding/decoding. We'll only handle hardware read/write
Null_port.c (pjproject-0.8.0\pjmedia\src\pjmedia)  

#ifdef MY_DSP_RAW
void my_dsp_raw_write(void* data, int len){
    // implement ur hardware write
}
void my_dsp_raw_read(void* data, int len){
    // implement ur hardware read
}
#endif


null_put_frame(){

#ifdef MY_DSP_RAW
    my_dsp_raw_write(frame->buf, frame->size);
#endif
    return PJ_SUCCESS;
}

null_get_frame(){
    char stereo_rec_data[320];
  ;   frame->type = PJMEDIA_FRAME_TYPE_AUDIO;
    frame->size = this_port->info.samples_per_frame * 2;
    frame->timestamp.u32.lo += this_port->info.samples_per_frame;

#ifdef MY_DSP_RAW
    my_dsp_raw_read(frame->buf, frame->size);
#else
     pjmedia_zero_samples((pj_int16_t*)frame->buf,
             this_port->info.samples_per_frame);
#endif

    return PJ_SUCCESS;
}

best,
Nigel

ps: Run pjsua with the --null-audio option

 


From: dinesh.dua@xxxxxxxxxxxxx
To: pjsip@xxxxxxxxxxxxxxx
Date: Fri, 6 Jun 2008 10:42:33 +0530
Subject : [pjsip] Replacing sound device with a DSP

 

 

Hi,

 

I am using JSIP on embedded system in LINUX having no sound device in which I have to replace sound device with DSP (tdm which communicate with a slic and analog phone).So voice has to be taken and passed to this DSP.

Please tell me desired modification for this purpose and I will be best served with source code.

 

 

Thanks,

Dinesh Dua


Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it!

Thread at a glance:

Previous Message by Date:

kofshower wants to keep up with you on Twitter

To find out more about Twitter, visit the link below: http://twitter.com/i/69dc863a2b1944d7251926d82bfdd4156974a258 Thanks, -The Twitter Team About Twitter Twitter is a unique approach to communication and networking based on the simple concept of status. What are you doing? What are your friends doingâright now? With Twitter, you may answer this question over SMS, IM, or the Web and the responses are shared between contacts. This message was sent by a Twitter user who entered your email address. If you'd prefer not to receive emails when other people invite you to Twitter, click here: http://twitter.com/i/optout/036d3462dd9adcf49a9d773d9a44e6aa1037de9b _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Next Message by Date:

Re: PJSUA: Problems to talk with a PocketPC

On Tue, Jun 10, 2008 at 2:19 AM, Paul Chen <pocketpc_1@xxxxxxxxx> wrote: > Hi Benny and others, > When I test the latest PJSUA on a PC (Window XP) with talking to a softphone > on a PocketPC (WinMobile 6), I have the following problems. > > 1. If PocketPC calls the PJSUA, I can hear from the PocketPC side but not > the PJSUA side. (I use SIP calls. To answer the call, I type "a" and then > 222 for the code.) After a short period, the connection is closed and get > the msg: > "pjsua_app.c Call 0 is DISCONNECTED [reason=408 (request Time out)]" > > Do I need to configure PJSUA to hear the audio? > How can I increase the Time out period? > (I already used the "V" command to increase the audio volume.) > Regarding the disconnection, my guess is it's because pjsua doesn't receive ACK from the PocketPC softphone, so it hangs up the call after retransmission timeout (about 32 seconds). Is NAT involved with this scenario? In any case a pjsua log file will certainly help. > 2. If PJSUA calls the PocketPC, both sides can not hear the audio. I got the > error messages like > "strm00E0378C RTP recv() error Connection reset by peer <WSAECONNRESET> > [err:130054]" > But the PocketPC receives the call. > Not sure why either, but in both cases I guess it must have something to do with the IP address selection. But if you can show the pjsua log file I can give it a look. > If I use another softphone instead of PJSUA on the PC, above two problems do > not appear. Is this with *exactly* the same settings? Cheers Benny > Thanks your helps in advance. > Paul > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@xxxxxxxxxxxxxxx > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >

Previous Message by Thread:

Re: Replacing sound device with a DSP

On Fri, Jun 6, 2008 at 6:12 AM, dinesh <dinesh.dua@xxxxxxxxxxxxx> wrote: > Hi, > > I am using JSIP on embedded system in LINUX having no sound device in which > I have to replace sound device with DSP (tdm which communicate with a slic > and analog phone).So voice has to be taken and passed to this DSP. > > Please tell me desired modification for this purpose and I will be best > served with source code. > You just need to change the audio backend from pasound.c (the backend for Linux) to your implementation. I think the sound device API is pretty straightforward. Cheers Benny

Next Message by Thread:

Sppex ABR and VBR

I am having the crazy idea, to create a 3D Environment where the distance of the players defines their quality of their communication. So I heard that speex supports vbr and abr. Is it possible to adjust the bitrate of the codec in realtime? That would be awsome. So far I implemented this idea by creating zones that use different codecs, so one zone that is near and uses speex 32kHz, one in the middle with 16kHz and one for people who are far away that uses 8kHz. Depending on your distance pjsip renegotiates your audiocodec. It works fine, but i thought this vbr and abr function of speex would be even cooler. Does anybody have some info on that? I just see the comparison charts on speex:http://speex.org/comparison/that imply exactly this behaviour, but i dont know if i can control it in pjsip. CheersThomasP.S. If anybody reads german and is interested in this topic I can give you the thesis I wrote about using irrlicht with pjsip, which i think is a cool new idea for voice-communication.
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!