[PATCH v2 4/4] mfplat: Implement MFCreateMemoryBuffer

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Fri Sep 7 02:51:40 CDT 2018


Hi Nikolay,


On 07/09/18 14:00, Nikolay Sivov wrote:
> On 09/07/2018 03:58 AM, Alistair Leslie-Hughes wrote:
>
>> +static HRESULT WINAPI mfbuffer_Lock(IMFMediaBuffer *iface, BYTE
>> **buffer, DWORD *max, DWORD *current)
>> +{
>> +    mfbuffer *This = impl_from_IMFMediaBuffer(iface);
>> +
>> +    TRACE("%p, %p %p, %p\n", This, buffer, max, current);
>> +
>> +    if(!buffer)
>> +        return E_INVALIDARG;
>> +
>> +    *buffer = This->buffer;
>> +    if(max)
>> +        *max = This->max_length;
>> +    if(current)
>> +        *current = This->current;
>> +
>> +    return S_OK;
>> +}
> This doesn't lock anything. How did you test this?
>
Only with the tests written.

When attempting to lock the buffer twice doesn't result return an error and
in fact returns the same buffer pointer.

The msdn reference, also suggests that locking the buffer really isn't a
lock in the traditional sense,
and allows multiple threads to change the data without error.

https://docs.microsoft.com/en-us/windows/desktop/api/mfobjects/nf-mfobjects-imfmediabuffer-lock
"Locking the buffer does not prevent other threads from calling Lock, so
you should not rely on this method to synchronize threads."

Regards
Alistair



More information about the wine-devel mailing list