I’m using Jetpack 4.6 and I was working on some tests for an application when I ran into a memory leak issue which seems to be related to the encoder. This happens when caps (framerate, resolution, etc) are changed while in playing state. Here’s an example to reproduce it:
#!/usr/bin/env python3 import gi import time gi.require_version('Gst', '1.0') from gi.repository import Gst, GObject, GLib pipeline = None # initialize GStreamer Gst.init(None) pipeline = Gst.parse_launch( "videotestsrc is-live=1 ! video/x-raw,width=1280,height=720 ! capsfilter name=framerate caps=\"video/x-raw,framerate=60/1\" ! nvvidconv ! nvv4l2h265enc ! fakesink " ) capsfilter = pipeline.get_by_name("framerate") for i in range(1, 1000): print("loop =",i," ") # start playing pipeline.set_state(Gst.State.PLAYING) pipeline.get_state(Gst.CLOCK_TIME_NONE) capsfilter.set_property("caps", Gst.Caps.from_string("video/x-raw, framerate=60/1")) time.sleep(1) capsfilter.set_property("caps", Gst.Caps.from_string("video/x-raw, framerate=30/1")) time.sleep(1) pipeline.set_state(Gst.State.NULL) pipeline.get_state(Gst.CLOCK_TIME_NONE)
In every iteration I see an increase of approximately 60MB of memory. I tried to run valgrind but it seems that the issue points to some private code:
log_valgrind.txt (7.3 KB)
Is there any known solution? (We would like to avoid stopping the pipeline to set the caps)
Thanks in advance.