Multi rtp streams - thread issue

Elio Francesconi elio.francesconi at gmail.com
Thu Oct 31 14:51:19 CET 2013


This is the pseudocode, where the app invoke RtpSink::loop and RtpSource::loop in two different threads(description of my pipeline is as described in the previous mail), it is based on these two example
http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/server-alsasrc-PCMA.c
http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/client-PCMA.c 
I was expecting to create multiple pipelines each one with their structures and with our interaction, I think I’m in wrong :-)

RtpSink::loop() 
{
	…
	//create the pipeline:

   /* the pipeline to hold everything */
    pipeline = gst_pipeline_new (NULL);
    g_assert (pipeline);

	// initialise the pipeline to receive audio content
	…
   
   //start the gmail loop thread

   /* we need to run a GLib main loop to get the messages */
   pLoop = g_main_loop_new (NULL, FALSE);
   g_main_loop_run (pLoop);
        
   g_print ("stopping receiver pipeline\n");
   gst_element_set_state (pipeline, GST_STATE_NULL);
   gst_object_unref (pipeline);
   g_main_loop_unref(pLoop);

}

RtpSource::loop() 
{
	…
	//create the pipeline:

   /* the pipeline to hold everything */
    pipeline = gst_pipeline_new (NULL);
    g_assert (pipeline);

	// initialise the pipeline to *transmit audio content* 
	…
   
   //start the gmail loop thread

   /* we need to run a GLib main loop to get the messages */
   pLoop = g_main_loop_new (NULL, FALSE);
   g_main_loop_run (pLoop);
        
   g_print ("stopping receiver pipeline\n");
   gst_element_set_state (pipeline, GST_STATE_NULL);
   gst_object_unref (pipeline);
   g_main_loop_unref(pLoop);

}

If I understood these pipelines are executed in thread that GStreamer starts, how is ti working? I read something about queue to create a producer/consumer model to handle data between elements. Do you think I should implement it to solve my issue?

On 31 Oct 2013, at 12:17, Sebastian Dröge <sebastian at centricular.com> wrote:

> On Do, 2013-10-31 at 10:40 +0100, elio francesconi wrote:
>> Hi all,
>> 
>> I'm creating an app to send and receive RTP audio streams, below I
>> attached pipeline's schemas.
>> 
>> I did these steps:
>> 
>> 
>>   1. I wrote a pipeline to *receive audio content* and I created a
>> thread to handle this stream.
>>   2. I wrote a second pipeline to send audio content and I created a
>> thread to handle this stream
>> 
>> These two pipelines work (I tested them separately) but in the same app no.
>> 
>> 
>> It seems a MultiThread issue, but I'm not aware how GStreamer works,
>> can someone give me some hints to handle this scenario?
> 
> How do you run them in separate threads and what exactly happens?
> 
> You don't need to run them in separate threads yourself, GStreamer will
> take care of that internally already for you.
> 
> -- 
> Sebastian Dröge <sebastian at centricular.com>
> Centricular Ltd - http://www.centricular.com
> Expertise, Straight from the Source
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131031/0a040300/attachment-0001.html>


More information about the gstreamer-devel mailing list