[PATCH 4/5] evr/mixer: Send sample requests when switching to streaming mode.

Nikolay Sivov nsivov at codeweavers.com
Fri Oct 23 06:33:29 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/evr/mixer.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index 48875a200fd..c0d46ce5331 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -28,6 +28,7 @@
 
 #include "initguid.h"
 #include "evr9.h"
+#include "evcode.h"
 
 #include "wine/debug.h"
 #include "wine/heap.h"
@@ -44,6 +45,7 @@ struct input_stream
     MFVideoNormalizedRect rect;
     unsigned int zorder;
     IMFSample *sample;
+    unsigned int sample_requested : 1;
 };
 
 struct rt_format
@@ -995,6 +997,15 @@ static HRESULT WINAPI video_mixer_transform_ProcessEvent(IMFTransform *iface, DW
     return E_NOTIMPL;
 }
 
+static void video_mixer_request_sample(struct video_mixer *mixer, unsigned int idx)
+{
+    if (!mixer->event_sink || mixer->inputs[idx].sample_requested)
+        return;
+
+    IMediaEventSink_Notify(mixer->event_sink, EC_SAMPLE_NEEDED, idx, 0);
+    mixer->inputs[idx].sample_requested = 1;
+}
+
 static HRESULT WINAPI video_mixer_transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param)
 {
     struct video_mixer *mixer = impl_from_IMFTransform(iface);
@@ -1039,6 +1050,12 @@ static HRESULT WINAPI video_mixer_transform_ProcessMessage(IMFTransform *iface,
 
             EnterCriticalSection(&mixer->cs);
 
+            if (!mixer->is_streaming)
+            {
+                for (i = 0; i < mixer->input_count; ++i)
+                    video_mixer_request_sample(mixer, i);
+            }
+
             mixer->is_streaming = message == MFT_MESSAGE_NOTIFY_BEGIN_STREAMING;
 
             LeaveCriticalSection(&mixer->cs);
@@ -1078,6 +1095,7 @@ static HRESULT WINAPI video_mixer_transform_ProcessInput(IMFTransform *iface, DW
         else
         {
             mixer->is_streaming = 1;
+            input->sample_requested = 0;
             input->sample = sample;
             IMFSample_AddRef(input->sample);
         }
-- 
2.28.0




More information about the wine-devel mailing list