[PATCH 2/3] quartz: Count the amount of renderers on demand.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Apr 6 08:07:31 CDT 2020


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

This is needed to behave like Windows and pass the tests in the next patch,
because is_renderer queries the filter for IMediaSeeking.

 dlls/quartz/filtergraph.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 0de16c4..4b6d8d5 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -686,9 +686,7 @@ static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
     entry->sorting = FALSE;
     ++graph->version;
 
-    if (is_renderer(entry))
-        ++graph->nRenderers;
-
+    graph->nRenderers = -1;
     return duplicate_name ? VFW_S_DUPLICATE_NAME : hr;
 }
 
@@ -761,9 +759,7 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte
             hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, NULL);
             if (SUCCEEDED(hr))
             {
-                if (is_renderer(entry))
-                    --This->nRenderers;
-
+                This->nRenderers = -1;
                 IBaseFilter_SetSyncSource(pFilter, NULL);
                 IBaseFilter_Release(pFilter);
                 if (entry->seeking)
@@ -5258,6 +5254,14 @@ static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start)
             stream_start += 500000;
     }
 
+    if (graph->nRenderers == -1)
+    {
+        graph->nRenderers = 0;
+        LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
+            if (is_renderer(filter))
+                ++graph->nRenderers;
+    }
+
     LIST_FOR_EACH_ENTRY(filter, &graph->sorted_filters, struct filter, sorted_entry)
     {
         filter_hr = IBaseFilter_Run(filter->filter, stream_start);
-- 
2.21.0




More information about the wine-devel mailing list