[wdmaudiodev] Re: Different amount of data in CopyFrom and CopyTo functions with same audio format.

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 26 May 2009 15:45:32 -0700

Michail Nikolaev wrote:
>     How big is your buffer?
> Nevermind. It is about 4096 * 32 bytes. But if it will overloaded -
> i'll get debug message. But problem is about empty buffer.

OK, the lesson being that you can buffer about 750 milliseconds of data.

>     Did you mean milliseconds there (as opposed to "ns" nanoseconds)?  Do
>     you get ANY data from Media Player?  That is, do you get buffers which
>     then stop, or do you get no buffers at all?
> Hm. I think it microseconds(I have not WDK at current moment - i
> use KeStallProcessor* function).

Most audio stacks try to send you 10 milliseconds of data at a time, so
waiting for a number of microseconds is a useless exercise.  Also,
remember that KeStallProcessor actually runs a tight CPU loop; if you
have a single processor machine, then of course you aren't going to get
any additional data, because the CPU is 100% busy doing your stall.  No
other threads can run.  If you want to wait for more data to arrive,
then you need to do something like KeDelayExecutionThread, which
suspends your thread and allows other threads to run.

> Yes i get data from Media Player. I heard it. But because there is no
> data in some moments - I write zeros (184 bytes). And it produces
> delay in sound.

Well, there are no guarantees about the sizes of packets you get in and
out, but sooner or later you should be able to get in sync.

Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

Other related posts: