[Bug 673509] New: Memory leak in rtspsrc - opening from SDP

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Apr 4 07:20:35 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=673509
  GStreamer | gst-plugins-good | 0.10.31

           Summary: Memory leak in rtspsrc - opening from SDP
    Classification: Platform
           Product: GStreamer
           Version: 0.10.31
        OS/Version: Windows
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: daniela.muzzu at selexelsag.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


I have a video-surveillance application based on gstreamer with rtspsrc as
source element. Playing many instances of a video from the same codec (which
lead to some troubles when exceeding a fixed number of concurrent connections),
I obtain the following errors from rtspsrc:

WARN  rtspsrc gstrtspsrc.c:5185:gst_rtspsrc_setup_streams:<rtsp-source> error:
Error (400): Bad Request
ERROR rtspsrc gstrtspsrc.c:5385:gst_rtspsrc_open_from_sdp:<rtsp-source> setup
failed
WARN  rtspsrc gstrtspsrc.c:5580:gst_rtspsrc_open:<rtsp-source> can't setup
streaming from sdp

or something similar.
To be more precise, in case of rtsp errors on the bus handler, I try to
reconnect by stopping and playing the pipeline again, which often causes the
above errors with this specific codec.

Anyway, under this scenario I noticed a consistent increase of handles and
memory usage, which is not recovered even after stopping all videos.

Looking at the code before the error in gst_rtspsrc_open_from_sdp
(gstrtspsrc.c), I've seen that memory for streams structures is allocated in
gst_rtspsrc_create_stream, but not released after gst_rtspsrc_setup_streams
fails.
I tried to fix this by adding a call to gst_rtspsrc_cleanup in setup_failed
error handling, and it seems to work.

Just pasting a chunk of code to be clearer:

---------------------
  /* create streams */
  n_streams = gst_sdp_message_medias_len (sdp);
  for (i = 0; i < n_streams; i++) {
    gst_rtspsrc_create_stream (src, sdp, i);
  }

  src->state = GST_RTSP_STATE_INIT;
  GST_OBJECT_FLAG_SET (src, GST_ELEMENT_IS_SOURCE);

  /* setup streams */
  if (!gst_rtspsrc_setup_streams (src))
    goto setup_failed;

  /* reset our state */
  src->need_range = TRUE;
  src->skip = FALSE;

  src->state = GST_RTSP_STATE_READY;

  return TRUE;

  /* ERRORS */
setup_failed:
  {
    /* DANIELA: cleanup previously allocated stream structures */
    gst_rtspsrc_cleanup (src);   
    /**/
    GST_ERROR_OBJECT (src, "setup failed");
    return FALSE;
  }
---------------------

Is this correct or am I missing something?
Thanks.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list