On 09/07/2018 10:51 AM, Alistair Leslie-Hughes wrote:
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-... "Locking the buffer does not prevent other threads from calling Lock, so you should not rely on this method to synchronize threads."
Ok, but does Lock -> Unlock -> Lock return same pointer second time? This could be a useful test to add later.
Regards Alistair