Re: voip audio clock mismatch (DirectSound / DirectShow)
  Home FAQ Contact Sign in
microsoft.public.win32.programmer.directx.audio only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: voip audio clock mismatch (DirectSound / DirectShow)         

Group: microsoft.public.win32.programmer.directx.audio · Group Profile
Author: Michel Roujansky - Senior developer, Starfish Technologies Ltd
Date: Jul 28, 2008 01:09

On Jul 25, 4:09 pm, Justin discussions.microsoft.com> wrote:
> I am currently working on a voip application using directSound.  I was able
> to get everything up and working correctly except I am noticing that after a
> period of time I get a break in audio. After adding some debug code I was
> able to track down that my problem is the result of a clock mismatch between
> my computer and the remote site.  It appears as though the remote site was
> sampling about 90Hz faster than my local sound card. Leaving me with more
> data than I was actually playing, which eventually caused a buffer to
> overflow.
> My current buffer settings are :
>
> m_dsBufferFormat.wFormatTag = WAVE_FORMAT_PCM;
> m_dsBufferFormat.nChannels = 1;
> m_dsBufferFormat.nSamplesPerSec = 16000;
> m_dsBufferFormat.nAvgBytesPerSec = 32000;
> m_dsBufferFormat.nBlockAlign = 2;
> m_dsBufferFormat.wBitsPerSample = 16;
> m_dsBufferFormat.cbSize = 0;
>
> Now my question is what are my options to correct this problem? I have tried
> to do some research and as far as I can see DirectSound alone has nothing to
> help me. If I stick with this implementation I believe I will be forced to do
> some type of monitoring and decimation or interpolation depending on if my
> sound card is behind or ahead of the remote site’s sound card. However I have
> taken a look at DirectShow and I am wondering if it may be exactly what I
> need for this application. In particular I am wondering if the ACM Wrapper
> Filter, since it can perform interpolation and decimation, would be able to
> fix my clock mismatch problem. Or would I still run into the same problem if
> I move to a DirectShow approach. Basically the plan would be to connect the
> ACM wrapper filter to a directsound renderer and interpolate the incoming
> audio channel from 16.0 KHz to 22.05KHz or 44.1KHz. I am hoping that
> directshow is smart enough to notice that in this case it has too many
> samples and will decimate to the rate of my sound card.
> So what are my options? I hate to reinvent the wheel if something is already
> available in directsound or directshow.
> My current architecture also contains a RTP protocol stack and some ITU-T
> audio codecs. Any solution would need to make use of these. I think
> directshow may have some built in RTP capabilities but I cannot use them.
>
> Where are you The March Hare and Chris P.
>
> :) I’m sure you both have some answers.
>
> Thanks
> Justin

One solution instead of decimation is to slave the rate of the
receiver clock to the filling of the buffer : if you receive samples
faster than you play them, you input buffer fills up, so you speed up
the clock to play them faster.
no comments
diggit! del.icio.us! reddit!