<div dir="ltr">Hello everyone,<div><br></div><div>My goal is produce some code that can drop video frames when the downstream pipeline gets too slow to consume them all.</div><div><br></div><div>So far, I am fighting with having a dump plugin running.</div><div><br></div><div>How is it possible that the following Python Gstreamer plugin is correctly initiated (it prints `PLUGIN Initialized GstDropFrames` as expected), and that data flows through it (see attached pipeline) without printing anything besides the print in the `__init__` function?</div><div><br>```<br>import logging<br>import timeit<br>import math<br>import traceback<br>import time<br>import cv2<br><br>import gi<br>gi.require_version('Gst', '1.0')<br>gi.require_version('GstBase', '1.0')<br>gi.require_version('GstVideo', '1.0')<br><br>from gi.repository import Gst, GObject, GLib, GstBase, GstVideo  # noqa:F401,F402<br><br>from gstreamer.utils import gst_buffer_with_caps_to_ndarray<br><br><br>Gst.init(None)<br><br>logger = logging.getLogger(__name__)<br><br><br>class GstDropFrames(GstBase.BaseTransform):<br><br>    GST_PLUGIN_NAME = 'gstdropframes'<br><br>    __gstmetadata__ = (<br>        "GstDropFrames",<br>        "Transform",<br>        "Drop frames when the pipeline can't consume them all",<br>        "author"<br>    )<br><br>    __gsttemplates__ = (<br>        Gst.PadTemplate.new(<br>            "src",<br>            Gst.PadDirection.SRC,<br>            Gst.PadPresence.ALWAYS,<br>            Gst.Caps.new_any(),<br>        ),<br>        Gst.PadTemplate.new("sink",<br>            Gst.PadDirection.SINK,<br>            Gst.PadPresence.ALWAYS,<br>            Gst.Caps.new_any(),<br>        )<br>    )<br><br>    __gproperties__ = {}<br><br>    def __init__(self):<br>        super(GstDropFrames, self).__init__()<br>        print("PLUGIN Initialized GstDropFrames")<br><br>    def do_prepare_output_buffer(self, inbuf):<br>        print("PLUGIN do_prepare_output_buffer")<br>        buf = Gst.Buffer.new()<br>        buf.copy_into(inbuf, Gst.BufferCopyFlags.FLAGS | Gst.BufferCopyFlags.TIMESTAMPS |<br>            Gst.BufferCopyFlags.META | Gst.BufferCopyFlags.MEMORY, 0, inbuf.get_size())<br>        buf.pts = inbuf.pts<br>        return (Gst.FlowReturn.OK, buf)<br><br>    def do_transform(self, inbuf, outbuf):<br>        print("PLUGIN do_transform")<br>        # outbuf.copy_into(inbuf, Gst.BufferCopyFlags.FLAGS | Gst.BufferCopyFlags.TIMESTAMPS |<br>        #     Gst.BufferCopyFlags.META | Gst.BufferCopyFlags.MEMORY, 0, inbuf.get_size())<br>        return Gst.FlowReturn.OK<br><br>    def do_transform_ip(self, buffer: Gst.Buffer) -> Gst.FlowReturn:<br>        print("PLUGIN do_transform_ip")<br>        return Gst.FlowReturn.OK<br><br><br><br># Register plugin to use it from command line<br>GObject.type_register(GstDropFrames)<br>__gstelementfactory__ = (<br>    GstDropFrames.GST_PLUGIN_NAME,<br>    Gst.Rank.NONE,<br>    GstDropFrames<br>)<br>```<br>Pipeline: <a href="https://drive.google.com/file/d/1Vu8DR1Puam14k-fUKVBW2bG1gN4AgSPm/view?usp=sharing">https://drive.google.com/file/d/1Vu8DR1Puam14k-fUKVBW2bG1gN4AgSPm/view?usp=sharing</a><br></div></div>