Packet loss concealment

What does it do?

The packet loss concealment module provides a synthetic fill-in signal, to minimise the audible effect of lost packets in VoIP applications. It is not tied to any particular codec, and could be used with almost any codec which does not specify its own procedure for packet loss concealment.

Where a codec specific concealment procedure exists, that algorithm is usually built around knowledge of the characteristics of the particular codec. It will, therefore, generally give better results for that particular codec than this generic concealer will.

The PLC code implements an algorithm similar to the one described in Appendix 1 of G.711. However, the G.711 algorithm is optimised for 10ms packets. Few people use such small packets. 20ms is a much more common value, and longer packets are also quite common. The algorithm has been adjusted with this in mind. Also, the G.711 approach causes an algorithmic delay, and requires significant buffer manipulation when there is no packet loss. The algorithm used here avoids this. It causes no delay, and achieves comparable quality with normal speech.

Note that both this algorithm, and the one in G.711 are optimised for speech. For most kinds of music a much slower decay on bursts of lost packets give better results.

How does it work?

While good packets are being received, the plc_rx() routine keeps a record of the trailing section of the known speech signal. If a packet is missed, plc_fillin() is called to produce a synthetic replacement for the real speech signal. The average mean difference function (AMDF) is applied to the last known good signal, to determine its effective pitch. Based on this, the last pitch period of signal is saved. Essentially, this cycle of speech will be repeated over and over until the real speech resumes. However, several refinements are needed to obtain smooth pleasant sounding results.

How do I use it?

Before audio is processed, call plc_init() to create an instance of the packet loss concealer. For each received audio packet that is acceptable (i.e. not including those being dropped for being too late) call plc_rx() to record the content of the packet. Note this may modify the packet a little after a period of packet loss, to blend real synthetic data smoothly. When a real packet is not available in time, call plc_fillin() to create a sythetic substitute. That's it!

Generated on Tue Oct 7 20:25:52 2008 for spandsp by  doxygen 1.5.6