Restart Pipeline

killerrats koreysjunkmail at gmail.com
Fri Dec 22 17:02:38 UTC 2017


I even tried going back to 1.6.0 to see if it works to stop and then play
again and does the same thing.

well I figured out how to reinitialize the pipeline but in long term it
seems to have a memory leak problem. at least when I don't use the parse
launch method. the comparisons on using parse launch and not for memory.
this is unreference everything i used for the pipeline. I don't know if i'm
doing something wrong or what.

over 12hr period:
parse launch:
      average 13.6mb. I can't really tell if it will increase the memory
usage.
no parse launch: 
     starts off at the 10mb. it seems to increase in memory over time. so
far it's over 28mb.

glong appsinkId, busId;
	do
	{
		this->srcPipeline = gst_parse_launch("rtspsrc name=source ! rtph264depay
name=videodepay ! h264parse name=videoparse ! avimux name=avimux ! appsink
name=appsink source. ! rtpmp4gdepay ! aacparse ! mux.", NULL);		
		this->source = gst_bin_get_by_name(GST_BIN(this->srcPipeline), "source");
		this->appsink = gst_bin_get_by_name(GST_BIN(this->srcPipeline),
"appsink");

		g_object_set(this->source
			, "location", "[IP]", NULL);

		g_object_set(GST_OBJECT(this->appsink), "emit-signals", TRUE
			, "max-buffers", 1
			, "enable-last-sample", FALSE, NULL);

		appsinkId = g_signal_connect(appsink, "new-sample",
G_CALLBACK(appsink_ToFile), apService);

		this->bus = gst_element_get_bus(this->srcPipeline);

		gst_bus_add_signal_watch(this->bus);
		busId = g_signal_connect(this->bus, "message", G_CALLBACK(bus_cb),
apService);


		/* Start playing */
		if (gst_element_set_state(this->srcPipeline, GST_STATE_PLAYING) ==
GST_STATE_CHANGE_FAILURE) {
			g_printerr("Unable to set the pipeline to the playing state.\n");
			gst_object_unref(this->srcPipeline);
			{
				return;
			}
		}

		this->aEstablishedConnection = true;
		this->mLoop = g_main_loop_new(NULL, FALSE);
		g_main_loop_run(this->mLoop);
		this->aEstablishedConnection = false;
		this->gPlayingInterval = 0;
		this->gPausedTimeout = 0;

		/* Free resources */
		g_main_loop_unref(this->mLoop);

		gst_element_set_state(this->srcPipeline, GST_STATE_PAUSED);
		gst_element_set_state(this->srcPipeline, GST_STATE_NULL);
		g_signal_handler_disconnect(this->appsink, appsinkId);
		g_signal_handler_disconnect(this->bus, busId);
		gst_object_unref(this->source);
		gst_object_unref(this->appsink);

		gst_bus_remove_signal_watch(this->bus);
		gst_object_unref(this->bus);
		gst_object_unref(this->srcPipeline);

	} while (!this->aStopProgram);



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


More information about the gstreamer-devel mailing list