[PATCH 3/3] winecoreaudio.drv: Use AUHAL API instead of AudioQueue

Ken Thomases ken at codeweavers.com
Sat Jul 5 07:25:29 CDT 2014


On Jul 5, 2014, at 4:13 AM, Francois Gouget wrote:

> On Fri, 27 Jun 2014, Andrew Eikum wrote:
> [...]
>> +        if(This->wrap_bufsize_frames < *nframes){
>> +            free(This->wrap_buffer);
>> +            This->wrap_buffer = malloc(data->mBuffers[0].mDataByteSize);
>> +            This->wrap_bufsize_frames = *nframes;
> 
> Does the AUHAL API require that we use malloc() / free() here (and in 
> the other locations dealing with wrap_buffer) or could this be switched 
> to HeapAlloc() / HeapFree()?
> 
> If we're free to use the latter doing so would be more consistent with 
> the rest of Wine.

This code is in a callback that Core Audio calls on a thread of its own creation.  That thread is not set up as a Wine thread, so you can't call other Wine code.

My argument was that this allocation can be completely avoided in this context.  It is possible to know in advance the upper limit of the buffer size required and allocate it during setup.  In that case, HeapAlloc() could be used.

-Ken




More information about the wine-devel mailing list