[PATCH] qcap/vfwcapture: Set the correct allocator properties when connecting.

Zebediah Figura z.figura12 at gmail.com
Mon Jun 28 00:08:56 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/qcap/vfwcapture.c | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index ae073b845e0..b048fff6b4a 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -193,14 +193,6 @@ static HRESULT vfw_capture_init_stream(struct strmbase_filter *iface)
     ALLOCATOR_PROPERTIES req_props, ret_props;
     HRESULT hr;
 
-    req_props.cBuffers = 3;
-    req_props.cbBuffer = get_image_size(filter);
-    req_props.cbAlign = 1;
-    req_props.cbPrefix = 0;
-    if (FAILED(hr = IMemAllocator_SetProperties(filter->source.pAllocator, &req_props, &ret_props))
-            && hr != VFW_E_ALREADY_COMMITTED)
-        ERR("Failed to set allocator properties (buffer size %u), hr %#x.\n", req_props.cbBuffer, hr);
-
     if (FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
         ERR("Failed to commit allocator, hr %#x.\n", hr);
 
@@ -688,20 +680,19 @@ static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, vo
 }
 
 static HRESULT WINAPI VfwPin_DecideBufferSize(struct strmbase_source *iface,
-        IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
+        IMemAllocator *allocator, ALLOCATOR_PROPERTIES *req_props)
 {
-    ALLOCATOR_PROPERTIES actual;
+    struct vfw_capture *filter = impl_from_strmbase_pin(&iface->pin);
+    ALLOCATOR_PROPERTIES ret_props;
 
-    /* What we put here doesn't matter, the
-       driver function should override it then commit */
-    if (!ppropInputRequest->cBuffers)
-        ppropInputRequest->cBuffers = 3;
-    if (!ppropInputRequest->cbBuffer)
-        ppropInputRequest->cbBuffer = 230400;
-    if (!ppropInputRequest->cbAlign)
-        ppropInputRequest->cbAlign = 1;
+    if (!req_props->cBuffers)
+        req_props->cBuffers = 3;
+    if (!req_props->cbBuffer)
+        req_props->cbBuffer = get_image_size(filter);
+    if (!req_props->cbAlign)
+        req_props->cbAlign = 1;
 
-    return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
+    return IMemAllocator_SetProperties(allocator, req_props, &ret_props);
 }
 
 static const struct strmbase_source_ops source_ops =
-- 
2.30.2




More information about the wine-devel mailing list