appsink new-sample

killerrats koreysjunkmail at gmail.com
Wed Dec 6 17:21:03 UTC 2017


if you reference an object in the main object in different methods create a
memory leak? This isn't how I do the pipeline but just an example. Just
wondering if going too fast before it has a chance to unreference an object?

for example:

GstElement* pipeline;
GstElement* source,* parse;

int main()
{
    do
   {
      link();
      release();
      unlink();
   }while(true);

   return 0;
}

GstElement getElement(GstElement* element,std::string name)
{
    return gst_bin_get_by_name (GST_BIN(element), name.c_str());
}

void link()
{
     gst_bin_add_many(GST_BIN(pipeline),source,parse,NULL);     
}
void release()
{
     GstElement* source,* parse;
     source = getElement(pipeline,"source");
     parse = getElement(pipeline,"source");

     if(source != NULL)
     gst_object_unref(source);
     if(parse != NULL)
     gst_object_unref(parse);
}


void unlink()
{
     GstElement* source,* parse;
     source = getElement(pipeline,"source");
     parse = getElement(pipeline,"source");

     if(source != NULL)
     gst_object_unref(source);
     if(parse != NULL)
     gst_object_unref(parse);
}



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list