Is there any way to intercept errors without pipeline bus?

Edward Hervey bilboed at gmail.com
Tue Oct 9 09:39:47 PDT 2012


On Tue, 2012-10-09 at 17:13 +0200, marcin at saepia.net wrote:
> Because it will simplify a lot architecture of my application.
> 
> My problem is that I have highly dynamic pipeline with multiple
> branches combined with adder. They are added and removed with quite
> high frequency (and it has to be like that). If one of the branches
> causes error (let's say souphttpsrc encounters 404 not found),
> pipeline is likely to be stopped, even if I remove such erroneous
> branch right after receiving error on the bus. When it is stopped it
> obviously hangs all playback even if all of the remaining branches
> have state of PLAYING and are OK. So I need to set pipeline state
> again to PLAYING and the problem is that can rarely happen at the same
> time as one of the branches is during removal so it's state is being
> set to NULL. When I remove a branch I set it's bin as locked to avoid
> recursive updates from pipeline but in rare cases, such
> pipeline.set_state => PLAYING happens a bit earlier than lock is taken
> on the bin. So I need to make extra checks during finalizing if that
> hadn't happened.
> 
> All of that could be easily avoided if error never left branch's bin
> and I could immediately unlink it and pipeline state wasn't affected
> in the same way as I can handle e.g. EOS event.

  By the looks of things you therefore have a GstBin for each branch.

  In that case you can implement your own bus message handler for that
bin.
 See the handle_message vmethod of GstBin:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html#GstBinClass

  1) Create a GstBin subclass
  2) The only thing it will do is implement the handle_message vmethod
   2.1) If it's not an error message, call the parent_class
implementation GST_BIN_CLASS(parent_class)->handle_message(self,
message); so that the standard message handling can take place
   2.2) If it is an error message, drop the message, and HANDLE FROM
ANOTHER THREAD the shutdown/removal of that bin (notifying/handling that
is left as an exercise to the reader).

  Hope this helps

  Edward

> 
> m.
> 
> 2012/10/9 Edward Hervey <bilboed at gmail.com>:
> > On Tue, 2012-10-09 at 12:24 +0200, marcin at saepia.net wrote:
> >> Hi,
> >>
> >> is there any clean way to intercept elements' errors without pipeline bus?
> >
> >   No.
> >
> >   Why wouldn't you want to get it from the pipeline bus ?
> >
> >     Edward
> >
> >>
> >> m.
> >> _______________________________________________
> >> gstreamer-devel mailing list
> >> gstreamer-devel at lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list