appsrc and GMainloop problem
Tim-Philipp Müller
t.i.m at zen.co.uk
Wed Aug 21 15:12:49 PDT 2013
On Wed, 2013-08-21 at 19:38 +0530, Deepak Jain wrote:
Hi,
> I am having a audio/video application providing interfaces for audio
> video playback.
>
> I am using GStreamer framework for actual playback.
>
> In my application, I get elementary streams from the network(demuxed
> streams).
>
> Elementary Audio and Video in separate threads.
>
>
> Now there is problem when I create pipeline and use appsrc.
>
> I am creating pipeline for video elementary stream as:
>
>
> appsrc->h264parse->ffdec_h264->ffmpegcolorconverter->videoconvert->xvimagesink
>
>
> My class is C++ and I am creating and doing gst_init in my class
> function like:
>
> gst_init (NULL, NULL);
>
>
> loop = g_main_loop_new (NULL, TRUE);
>
>
> /* creating pipeline here */
> --------------
> ---------------
> --------------
>
> /* go to playing and wait in a mainloop. */
> gst_element_set_state (playbin, GST_STATE_PLAYING);
>
>
>
> Now if I use g_main_loop_run (loop); after setting the pipeline to
> play state above, my code don’t work. My audio and video threads(which
> are bringing audio video elementary data) don't work at all.
>
>
> if I call g_main_loop_run (loop); after getting first video packet,
> the idle handler callback works too fast then my feeding thread due to
> which same data gets pushed to app_src repeatedly and therefore the
> pipeline fails.
>
>
> The problem to me seems to be where to call g_main_loop_run (loop);
You are aware that g_main_loop_run() blocks, until you quit it, right?
It's not quite clear to me why you are using a main loop in the first
place. If you get your data in separate threads, you can just push them
into the respective appsrc from those threads.
GStreamer's streaming threads operate with or without a main loop and
are not affected by any main loops running in the application thread.
> Also since my code is c++ and gstreamer is C, is that can be a issue?
No.
Not sure what's going on, and it's hard to help without seeing all the
relevant code and how it works together.
Cheers
-Tim
More information about the gstreamer-devel
mailing list