Hi,
Actually we are working for a soft IP Phone suitable for windows. It is implemented using H.323 for our proprietary PBX. It supports G.711,G723.1,G729a and G.729ab codecs.
So when we are using G.711 codec, we get RTP packets of 240bytes each continuously at regular intervals, when we decode 240bytes we will get 480 bytes, these 480 bytes we are writing on to speakers using WaveInterface() i.e waveOutWrite() API,
Actually there is a delay in processing the wave buffers by system.
Here are the details:
1. we have logged in the Information like when Application is receiving the RTP data, when it is inserting into system wavebuffer(i.e. WaveOutWrite() ) and when it is actually processed by the system( i.e. played back to the speaker)
2. On an average Application inserting 2000 blocks of data to the system queue in 1 min. of time, but system is able to process only 1994 blocks of data in that time, so there are still 6 blocks of data that has to be processed.
3. This delay go on accumulating and after 10 min, Application is inserting 20263 blocks of data, out which system has processed only 20230 blocks of data, so there are still 33 blocks of data pending to get processed by system. So like wise delay keeps on increasing and at any point of time we can not recover the delay as we receive RTP packets continuously at regular intervals.
4. So work around what we have done is that for every 64 blocks of data, we are calling WaveOutReset(), which actually empties the system buffers and all the pending buffers in system queue are marked as done. So that means for 64 blocks of data, if system has processed only 60 or 62, the remaining 2 or 4 blocks of data will get lost, then there is absolutely no delay. but this is not the proper solution as we are losing 2 packets of Info. and also there is a possibilty for choppiness in speech.
Here are our implementation details
1)Our application consists of 64 buffers of each 480 bytes, allocated from heap.
2)when we receive RTP packet(e.g. if G.711 codec used we will get 240 bytes of RAW data), we will first decode it, when we decode we will get 480 bytes of data.
3) then we are preparing Header using WaveOutPrepareHeader(), and Inserting into system queue by using WaveOutWrite()
4) we have Implemented a callback funtion, So whenever system is done with one buffer it will call that callback function and we are freeing the resources using WaveOutUnprepareHeader() in that callback function.
5) Initially we dont get any delay but as the time proceeds delay increases.
So Is there any way to avoid this delay by system? is there any other interface is available on windows for the same?
Please let us know.
Somesh


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks