[vlc-devel] [PATCH 6/9] mmal/deinterlace: Always flush mmal on flush

Julian Scheel julian at jusst.de
Thu Oct 19 11:23:03 CEST 2017


Do not only flush if buffers are in transit, but whenever flush is
called. This is necessary because the deinterlace filter has an internal
state (reference pictures) which is reset on mmal_port_flush as well.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 modules/hw/mmal/deinterlace.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index ad75297e5c..ff7643e2b9 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -409,19 +409,15 @@ static void flush(filter_t *filter)
 
     msg_Dbg(filter, "flush deinterlace filter");
 
-    if (atomic_load(&sys->input_in_transit) ||
-            atomic_load(&sys->output_in_transit)) {
-
-        msg_Dbg(filter, "flush: flush ports (input: %d, output: %d in transit)",
-                sys->input_in_transit, sys->output_in_transit);
-        mmal_port_flush(sys->output);
-        mmal_port_flush(sys->input);
-
-        msg_Dbg(filter, "flush: wait for all buffers to be returned");
-        while (atomic_load(&sys->input_in_transit) ||
-                atomic_load(&sys->output_in_transit))
-            vlc_sem_wait(&sys->sem);
-    }
+    msg_Dbg(filter, "flush: flush ports (input: %d, output: %d in transit)",
+            sys->input_in_transit, sys->output_in_transit);
+    mmal_port_flush(sys->output);
+    mmal_port_flush(sys->input);
+
+    msg_Dbg(filter, "flush: wait for all buffers to be returned");
+    while (atomic_load(&sys->input_in_transit) ||
+            atomic_load(&sys->output_in_transit))
+        vlc_sem_wait(&sys->sem);
 
     while ((buffer = mmal_queue_get(sys->filtered_pictures))) {
         picture_t *pic = (picture_t *)buffer->user_data;
@@ -429,6 +425,7 @@ static void flush(filter_t *filter)
                 (void *)pic);
         picture_Release(pic);
     }
+    atomic_store(&sys->started, false);
     msg_Dbg(filter, "flush: done");
 }
 
-- 
2.14.2



More information about the vlc-devel mailing list