On 6/24/22 10:48, Giovanni Mascellani wrote:
-static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **scanline0, LONG *pitch) +static HRESULT dxgi_surface_buffer_lock2d(struct buffer *buffer, MF2DBuffer_LockFlags flags,
{BYTE **scanline0, LONG *pitch, BYTE **buffer_start, DWORD *buffer_length)
struct buffer *buffer = impl_from_IMF2DBuffer2(iface); HRESULT hr = S_OK;
TRACE("%p, %p, %p.\n", iface, scanline0, pitch);
if (!scanline0 || !pitch)
return E_POINTER;
EnterCriticalSection(&buffer->cs);
if (buffer->_2d.linear_buffer) hr = MF_E_UNEXPECTED; else if (!buffer->_2d.locks++)
@@ -1051,6 +1042,10 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **sca { *scanline0 = buffer->dxgi_surface.map_desc.pData; *pitch = buffer->dxgi_surface.map_desc.RowPitch;
if (buffer_start)
*buffer_start = *scanline0;
if (buffer_length)
*buffer_length = buffer->dxgi_surface.map_desc.RowPitch * buffer->_2d.height; } LeaveCriticalSection(&buffer->cs);
@@ -1058,6 +1053,25 @@ static HRESULT WINAPI dxgi_surface_buffer_Lock2D(IMF2DBuffer2 *iface, BYTE **sca return hr; }
You forgot to remove LeaveCriticalSection() here. That's actually visible in the test output when running on Wine.
For consistency between d3d9 and dxgi cases, let's pick one suffix - _lock2d() or _lock().