Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6628 Discussions

Poor Performance with umc_speech_rtp_codec when decoding RTP payload

I need to decode RTP payload and transform it into a audio file.
But i found a poor performance issue occurring when using IPPv7.0.1umc_speech_rtp_codec samlpe code.
My decoding RTP procedureinclude :
1. read a pacp file
2. transform packets into correct format (for IPP) and add them to a queue
3. decode packets from a queue and invoke class to decode;
I found thebottleneck of this problem lying in function UMC::JitterBuffer::GetData(...),
which requiredmore cpu resources.
Therefore, is there any better solution for this ? or
could you please give me some suggestions foroptimizing this ?
Thasnks in advance.
Eric Wei
0 Kudos
4 Replies
This sample doesn't designed to measure performance of IPP speech codecs. Its goal to demonstrate using of our codecs in VOIP environtment. If you would like to time speech codecs, please use usc_speech_codec sample.

As for discovered bottleneck - you cannot optime it. The purpuse of jitter buffer to aligh arrived packets in time i.e. to remove jitter becase usually packets' arrive time different: 20 ms +- some jitter time. Actually UMC::JitterBuffer class designed to work in real time modewith theusing of system time to provide recived packet in time, i.e. exactly every 20 ms for example. More over some packets can be discartedif they arrive very late. So this class waits as long as possible to provide output packet and hence its performce shalln't be measured.

Igor S. Belyakov
HiIgor S. Belyakov,
Thanks for your kindly reply.
I wonder if i want to decode a RTP pcap file and generate a audio file in non real-time mode, that means i
don'tneed the class UMC::jitterbuffer,could your please give me any suggestion or sample code about how
to do this?
I really want to improve its performance due to my work and look forward to your help.
Eric Wei
Hi Eric,
In case of UDP underlying transport protocol andoffline decoding you deal with just the follwing simple problems which you need to solve:
1. Packets reordering.
2. Lost packets.

Both of them can be solved based on "sequence_namber" and "timestamp" fields from RTP packet header.If you are able to do two passesthrough pcap file than during first pass you should build correct packets map and decode them during second path.

If you wouldn't do two passes then pretty simple decision to have dynamic list of packets (something like std::list from STL)with several packets lookahead. Push arrived packed to the correct place (mostly at the end in normal network conditions) and pop old one from the beggining. Don't start decoding untill list will be fully filled.
Adiitionally you should check and discard very late arrived packets (with arrive time more than lookahead window). I suggestlookahead window size in 5 to 8 packets. This will resulted in 100 - 160 ms playout delay.

As you said, i would parser a pacp file and RTP packets are classified by different RTP session lists.
When i start to decode packets from RTP sesison lists, i don't know exactly which IPP function could be usedfor RTP bitstream decoding.
But I guess the answer isinvoking USCCodecDecode(USCParams *uscPrms, USC_Bitstream *in,USC_PCMStream*out, FILE *flog) instreadof m_pParams->m_pJitterBuffer->LockInputBuffer(pIt);
Please reference the following codes in, as a Jitter buffer disable mode.
/*Unpack to the USC bitstream format*/
/*Decode RTP payload */
for(i=0;i<(Ipp32s)FrameList.Size();i++) {
UMC::SpeechData *pIt;
USC_PCMStream PCMStream; // decoded bitstream
USC_Bitstream Bitstream; // Source RTP bitstream

// Prepare input buffer parameters
Bitstream.bitrate = 8000;
Bitstream.frametype = 3;
Bitstream.nbytes = 10;
Bitstream.pBuffer = (char*)(pIt->GetDataPointer());
/* Decoded RTP bitstream and outputPCMStream*/
USC_Status uscStatus = codecIPP->uscParams.USC_Fns->Decode(codecIP->uscParams.uCodec.hUSCCodec,
/* Write file*/
m_pParams->m_p_out_file->Write(PCMStream.pBuffer, PCMStream.nbytes);
// m_pParams->m_pJitterBuffer->LockInputBuffer(pIt);
// m_pParams->m_pJitterBuffer->UnLockInputBuffer(pIt);
If this method is wrong, please corrrect it for me.
Thanks in advance.
Eric Wei