Rtspsrc nvv4l2decoder memory leak

Hi All, I created a pipeline that play rtsp stream, the pipeline contains elements rtspsrc, rtph264depay, nvv4l2decoder, nvvidconv etc. Everything work fine for playing rtsp stream. But there is memory leak, when I change rtsp path periodically.
The following are steps to change rtsp path:

  1. keep nvv4l2decoder at state running
  2. unlink rtspsrc with rtph264depay, where rtph264dppay connects to downstream elements included nvv4l2decoder
  3. set rtspsrc state to NULL,
  4. change rtspsrc path
  5. link rtspsrc to rtph264depay
  6. set state of rtspsrc to PLAYING

The above steps able to change rtsp stream to new one, but there is memory leak. I noticed that every time I reconnect to rtph264depay, I got the following debug message:
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
It seems allocating a new NVMM block, but I never see any message that free NVMM block, would this leads to memory leak ? How do I know nvv4l2decoder has freed memory block?

Noted that I tried to set state of nvv4l2deocder to NULL and PLAY again while reconnect to new rtsp stream, but memory leak still persists.

Hi,
It is possible decoder is initialized for each time it is reconnected. We would suggest re-initialize the whole pipeline if the RTSP source is changed.

If not re-initialize whole pipeline, would it lead to memory leak?

Hi,
It is possible. In this use-case, the decoder is not destroyed and a new one is initialized. So suggest terminate the whole pipeline and re-initialize it.

After reset state of decoder to NULL or removed decoder element from bin, shouldn’t all allocated memory freed?

Hi,
After switching to NULL state, need to call gst_object_unref(GST_OBJECT(gst_pipeline)); to have complete cleanup.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.