[pjsip] How to handle silence / NONE frames?

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

 



Thanks  Benny,

My misunderstanding was assuming L145  if (snd_port->plc)  - would be true
but instead
 pj_bzero(output, size); is executed.

In wav_writer.c and mem_capure.c the sound buffer is used without being
zero'd regardless of the  frame.type.

Ignoring frame.type or zero-ing the buffer fixes the problem in my
application, which is better though?

I see  snd_port->plc  is only created (depending on options options) when
snd_port is created.
So do the codecs that don't have built-in PLC (g711 and gsm), rely on
snd_port->plc? Or do they have their own plc?
Do I then need a PLC in my port at all?

Regards
Lafras



----- Original Message -----
From: "Benny Prijono" <bennylp@xxxxxxxxx>
To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
Sent: Tuesday, October 02, 2007 8:40 AM
Subject: Re: [pjsip] How to handle silence / NONE frames?


> Lafras Henning wrote:
> >
> > 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?
>
> There are two kind of PLCs in pjmedia, first is the PLC that comes
> with the codec (such as Speex and iLBC), and the other is the
> generic PLC that is used in sound_port.c and also by codecs that
> don't have built-in PLC (g711 and gsm).
>
> The generic PLC is really bad, as it only replays the previous frame
> (at lower intensity), and normally this creates the clicking noise.
> So you should not use this. The sound_port.c also does not use this
> by default either.
>
> So if you don't hear clicking noise in pjsua, could it probably
> because pjsua uses Speex or iLBC (with their built-in PLC)?
>
> Indeed there is a different treatment for missing and silence
> packets, this processing is done in stream.c, by looking at the
> return status of the jitter buffer. The former will trigger the
> codec's PLC, while the later won't.
>
> What kind of silence frames did you get?
>
> regards,
>   -benny
>
>
> > 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;
> > }
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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
>
>
> --
> Benny Prijono
> http://www.pjsip.org
>
>
> _______________________________________________
> 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