[gst-devel] Bug in gst_bin_set_state ?

Andreas Rottmann a.rottmann at gmx.at
Thu Jan 20 05:57:10 CET 2005


I tried to get v4l2src to work with gstreamer, and in the process
found out that gst_v4l2src_change_state was never called when setting
the state of the pipeline. Not being knowledgeable of the gstreamer
internals, I played around a bit, and found out that calling 

    gst_element_set_state (pipeline, GST_STATE_PLAYING);

which I thought would invoke gst_v4l2src_change_state, did in fact
nothing with its children at all. So, I looked at the code and it
*appeared* to have the logics the wrong way around:

gst_bin_set_state (GstElement * element, GstElementState state)
  GstBin *bin = GST_BIN (element);

  if (GST_STATE (bin) == state) {
    ... // iterate over the kids here
  } else {
    ... // delegate call to parent

I changed the "if (GST_STATE (bin) == state)" to "if (GST_STATE (bin)
!= state)", and voila, the v4l2src element worked nicely. Could it
really be that I've found such a fundamental bug, or am I just ways
off track here?

Patch attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin-set-state.patch
Type: text/x-patch
Size: 502 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20050120/bf8d3143/attachment.bin>
-------------- next part --------------

Regards, Rotty
Andreas Rottmann         | Rotty at ICQ      | 118634484 at ICQ | a.rottmann at gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?

More information about the gstreamer-devel mailing list