[vlc-commits] motiondetect: release the kept previous picture when the filter is flushed

Steve Lhomme git at videolan.org
Mon Oct 12 15:55:46 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct  9 08:39:18 2020 +0200| [fdd67eb3631b6c11081c242bd2e39f5534da4a4e] | committer: Steve Lhomme

motiondetect: release the kept previous picture when the filter is flushed

Also copy the metadata from the source to the output

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdd67eb3631b6c11081c242bd2e39f5534da4a4e
---

 modules/video_filter/motiondetect.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/video_filter/motiondetect.c b/modules/video_filter/motiondetect.c
index 4787f5580c..c2c3796613 100644
--- a/modules/video_filter/motiondetect.c
+++ b/modules/video_filter/motiondetect.c
@@ -81,6 +81,16 @@ typedef struct
     int color_y_max[NUM_COLORS];
 } filter_sys_t;
 
+static void Flush(filter_t *p_filter)
+{
+    filter_sys_t *p_sys = p_filter->p_sys;
+    if (p_sys->p_old != NULL)
+    {
+        picture_Release(p_sys->p_old);
+        p_sys->p_old = NULL;
+    }
+}
+
 /*****************************************************************************
  * Create
  *****************************************************************************/
@@ -108,7 +118,7 @@ static int Create( vlc_object_t *p_this )
     }
     static const struct vlc_filter_operations filter_ops =
     {
-        .filter_video = Filter,
+        .filter_video = Filter, .flush = Flush,
     };
     p_filter->ops = &filter_ops;
 
@@ -311,6 +321,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
     p_sys->p_old = picture_Hold( p_inpic );
 
 exit:
+    picture_CopyProperties(p_outpic, p_inpic);
     picture_Release( p_inpic );
     return p_outpic;
 }



More information about the vlc-commits mailing list