Replacing sound device with a DSP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][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_stream = 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 at lists.pjsip.org
Date: Fri, 6 Jun 2008 10:42:33 +0530
Subject: 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!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080610/21d212cc/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