[pjsip] How to handle silence / NONE frames?

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

 



Hi Benny,

In my application I get a scratching/clicking noise when the other side sends silence packets, On but on PJSUA no scratching occurs. 

My application is getting PJMEDIA_FRAME_TYPE_NONE frames during this silence,

sound_port.c simply applies PLC to these packets, but surly there is a difference between missing and silence packets?

What would you recomend?
 
Regards
Lafras

static pj_status_t zxTDM_put_frame( pjmedia_port *port, 
      const pjmedia_frame *frame)
{
    port_data *zxTDM = port->port_data.pdata;
    pj_int16_t *samples = frame->buf;
    unsigned i, count;
   
    if (zxTDM->Active!=1)  return PJ_SUCCESS;    
    if (zxTDM->Fifo==NULL) return PJ_SUCCESS;
    if (zxTDM->Fifo->Active!=1) return PJ_SUCCESS;
    
     if (frame->type != PJMEDIA_FRAME_TYPE_AUDIO) 
      {
       pjsua_NonAudioFrames++; 
       pjsua_NonAudioFramesType = frame->type; //yep getting 0
       return PJ_SUCCESS; //just ignor
      }   
    /* Get number of samples */
    count = frame->size / 2 / port->info.channel_count;
    //It is possible to improve the performance of this critical section by bringing in the code from zxSimpleFifo and optimising it    
    //  to optimize similar to FifoBufferUnit- Calculate 2 blocks (upto end and from begining) that can be copied without testing - check PeekBuffer()
    for (i=0; i<count; ++i) { 
 zxFifo_PostByte(&zxTDM->Fifo->Rx,pjmedia_linear2alaw(*samples));
 zxTDM->Fifo->Rx.TxCounter--;
 samples++; 
 }
 
//save data for PLC
 
    if (zxTDM->plc)
 pjmedia_plc_save(zxTDM->plc, (pj_int16_t*)frame->buf); //missing packets are fixed from the other side of the fifo.
  
//NOW perform Echo cancelation //taken from sound_port.c
    if (zxpjsua_EchoCanceler) pjmedia_echo_playback(zxTDM->ec_state, (pj_int16_t*)frame->buf);
 
    return PJ_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20071002/7aaa80a2/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