[wdmaudiodev] Re: - Problem with CopyFrom() - I copied less audio data than my expected.

  • From: Jun Jiang <jun.jiang77@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 5 May 2011 20:56:05 +0800

Hi, Robert, Thank you very much.

So it should be related to my implementation of GetPosition() and the
procossing of buffers . Is my understanding right?

For GetPosition(), the accurate offset position in DMA buffer should be
returned. Maybe in my code, the offset returned is not accurate.

For buffers, here 2 kinds of buffers were involved in my driver.
One kind is DMA buffer(common buffer), the HW will fill data to this buffer.
There are four buffers for each channel. One buffer is 1920 byte
length. This buffer was used internally.
The other kind is a NonPaged buffer allocated by ExAllocatePoolWithTag(). I
enlarge the size to 1MB. This buffer address was returned to Portclass in
CMiniportWaveCyclicStreamMSVAD::AllocateBuffer().
In CopyFrom(), I copy the data in DMA buffer to Destination.

Whether is there mistake to use these buffers in my driver?



Best Regards,
Audleyswood



On Thu, May 5, 2011 at 8:25 PM, Robert Bielik <robert.bielik@xxxxxxxxxx>wrote:

> Jun Jiang skrev 2011-05-05 14:19:
>
>  Sometimes(low frequency), CopyFrom() only copied partable data. For
>> example, only 1344 bytes were copied. 2496 byte should be copied, too. But
>> they were not copied actually.
>> What is reason to cause CopyFrom() copying less data?
>>
>
> It is probably a buffer wraparound effect, for example:
>
> If the DMA buffer is of length N, and your CopyFrom copies M samples, if
> the DMA position is at a location P where
> N - P < M, then first N - P bytes will be copied (in CopyFrom), then M - (N
> - P) bytes totalling M bytes.
>
> Regards,
> /Rob
> ******************
>
> WDMAUDIODEV addresses:
> Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
> Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
> Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
> Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
>
> URL to WDMAUDIODEV page:
> http://www.wdmaudiodev.com/
>
>

Other related posts: