interlace: Discard stored_frame on EOS and PAUSED_TO_READY
authorVivia Nikolaidou <vivia@ahiru.eu>
Mon, 8 Mar 2021 18:59:14 +0000 (20:59 +0200)
committerVivia Nikolaidou <vivia@ahiru.eu>
Mon, 8 Mar 2021 19:02:01 +0000 (21:02 +0200)
Would otherwise leak it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2062>

gst/interlace/gstinterlace.c

index a49d974..ac109af 100644 (file)
@@ -678,6 +678,10 @@ gst_interlace_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
     }
 #endif
 
+      if (interlace->stored_frame) {
+        gst_buffer_unref (interlace->stored_frame);
+        interlace->stored_frame = NULL;
+      }
       ret = gst_pad_push_event (interlace->srcpad, event);
       break;
     case GST_EVENT_CAPS:
@@ -1471,6 +1475,9 @@ gst_interlace_change_state (GstElement * element, GstStateChange transition)
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       g_mutex_lock (&interlace->lock);
       interlace->src_fps_n = 0;
+      if (interlace->stored_frame) {
+        gst_buffer_unref (interlace->stored_frame);
+      }
       g_mutex_unlock (&interlace->lock);
       /* why? */
       //gst_interlace_reset (interlace);