appsink memory leak

maddy2607 midhunk at erena.in
Tue Sep 17 08:54:20 UTC 2019


Hi Umit San,
               Please check by commenting "gst_object_unref(buffer)" in the
below code :

void decodedLoop() {
    GstAppSink* appsink = (GstAppSink*)
gst_bin_get_by_name(GST_BIN(gstPipeline),"appsink");
    g_assert(appsink);

    while(running)  {
        GstSample *sample = gst_app_sink_try_pull_sample(appsink,
500000000);
        if(sample == nullptr) {
            cout << "could not pull sample" << endl;
            continue;
        }
        GstBuffer *buffer = gst_sample_get_buffer(sample);
        if(!buffer)  {
            cout << "could not get buffer" << endl;
            return;
        }
        GstMapInfo mapInfo;
        gst_buffer_map(buffer, &mapInfo, GST_MAP_READ);
        cout << "size: " << mapInfo.size << endl;
        gst_buffer_unmap(buffer,&mapInfo);
       // gst_object_unref(buffer);---> This unref is not needed
        gst_sample_unref(sample);
    }
    gst_object_unref(appsink);

}



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


More information about the gstreamer-devel mailing list