`BaseTransformImpl` leak when returning `gst_base::BASE_TRANSFORM_FLOW_DROPPED`
Describe your issue
Hi all! I try to implement a filtering element that drops buffers based on some condition. But I faced a memory leak, so I've made a minimal example to reproduce this: https://github.com/DmitrySamoylov/gst-rs-drop-buffers-example
impl BaseTransformImpl for Filter {
const MODE: BaseTransformMode = BaseTransformMode::AlwaysInPlace;
const PASSTHROUGH_ON_SAME_CAPS: bool = false;
const TRANSFORM_IP_ON_PASSTHROUGH: bool = false;
fn transform_ip(&self, _buf: &mut gst::BufferRef) -> Result<gst::FlowSuccess, gst::FlowError> {
Ok(gst_base::BASE_TRANSFORM_FLOW_DROPPED)
}
}
Expected Behavior
I guess the buffer must be dropped automatically by GStreamer when transform_ip()
returns gst_base::BASE_TRANSFORM_FLOW_DROPPED
.
Observed Behavior
The buffer is not dropped according to logs:
export GST_DEBUG="2,GST_BUFFER:7"
export GST_PLUGIN_PATH="target/debug/"
gst-launch-1.0 videotestsrc num-buffers=2 ! myfilter ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
0:00:00.019201723 65825 0x5628316f5aa0 ERROR GST_RUST base_transform.rs:684:<_ as gstreamer_base::subclass::base_transform::BaseTransformImplExt>::parent_propose_allocation::{{closure}}:<filter0> Parent function `propose_allocation` failed
0:00:00.019332462 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:844:gst_buffer_new: new 0x5628319705a0
0:00:00.019345227 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:450:_memory_add: buffer 0x5628319705a0, idx -1, mem 0x7fab9c00cde0
0:00:00.019354053 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:898:gst_buffer_new_allocate: new buffer 0x5628319705a0 of size 115200 from allocator (nil)
0:00:00.019368321 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:1800:gst_buffer_map_range: buffer 0x5628319705a0, idx 0, length -1, flags 0002
0:00:00.019379071 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:244:_get_merged_memory: buffer 0x5628319705a0, idx 0, length 1
0:00:00.020978092 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:844:gst_buffer_new: new 0x5628319706c0
0:00:00.020991097 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:450:_memory_add: buffer 0x5628319706c0, idx -1, mem 0x7fab9c056d00
0:00:00.020998221 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:898:gst_buffer_new_allocate: new buffer 0x5628319706c0 of size 115200 from allocator (nil)
0:00:00.021011526 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:1800:gst_buffer_map_range: buffer 0x5628319706c0, idx 0, length -1, flags 0002
0:00:00.021019351 65825 0x5628316f5aa0 LOG GST_BUFFER gstbuffer.c:244:_get_merged_memory: buffer 0x5628319706c0, idx 0, length 1
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.000066838
Setting pipeline to NULL ...
Freeing pipeline ...
I expect to see calls to _gst_buffer_free
/_gst_buffer_dispose
.
Setup
- Operating System: Ubuntu 20.04
- Device: Computer
- gstreamer-rs Version: 0.20.6
- GStreamer Version: 1.16.3
Steps to reproduce the bug
git clone https://github.com/DmitrySamoylov/gst-rs-drop-buffers-example
cd gst-rs-drop-buffers-example
./runme.sh
How reproducible is the bug?
Always