GNOME Bugzilla – Bug 341667
restore_from_xml breaks pad links again after creating them
Last modified: 2006-06-30 13:19:11 UTC
Please describe the problem: While hacking on some code, we figured it would be useful to dump a pipeline into XML and to then run that XML through gst-xmllaunch. This provides a nice way of checking if the pipeline works independent of the rest of the application code. To test this I used the following script: #!/usr/bin/python import pygst pygst.require("0.10") import gst import gtk class Main: def __init__(self): self.pipe = "audiotestsrc ! alsasink" self.bin = gst.parse_launch(self.pipe) gst.xml_write_file(self.bin, open("sinesrc.xml", "w")) self.bin.set_state(gst.STATE_PLAYING) start=Main() gtk.main() The sinesrc.xml file that it spits out is this: <?xml version="1.0"?> <gstreamer xmlns:gst="http://gstreamer.net/gst-core/1.0/"> <gst:element> <gst:name>pipeline0</gst:name> <gst:type>pipeline</gst:type> <gst:param> <gst:name>name</gst:name> <gst:value>pipeline0</gst:value> </gst:param> <gst:param> <gst:name>delay</gst:name> <gst:value>0</gst:value> </gst:param> <gst:param> <gst:name>auto-flush-bus</gst:name> <gst:value>TRUE</gst:value> </gst:param> <gst:children> <gst:element> <gst:name>alsasink0</gst:name> <gst:type>alsasink</gst:type> <gst:param> <gst:name>name</gst:name> <gst:value>alsasink0</gst:value> </gst:param> <gst:param> <gst:name>preroll-queue-len</gst:name> <gst:value>0</gst:value> </gst:param> <gst:param> <gst:name>sync</gst:name> <gst:value>TRUE</gst:value> </gst:param> <gst:param> <gst:name>max-lateness</gst:name> <gst:value>-1</gst:value> </gst:param> <gst:param> <gst:name>qos</gst:name> <gst:value>FALSE</gst:value> </gst:param> <gst:param> <gst:name>buffer-time</gst:name> <gst:value>200000</gst:value> </gst:param> <gst:param> <gst:name>latency-time</gst:name> <gst:value>10000</gst:value> </gst:param> <gst:param> <gst:name>provide-clock</gst:name> <gst:value>TRUE</gst:value> </gst:param> <gst:param> <gst:name>device</gst:name> <gst:value>default</gst:value> </gst:param> <gst:param> <gst:name>device-name</gst:name> <gst:value/> </gst:param> <gst:pad> <gst:name>sink</gst:name> <gst:peer>audiotestsrc0.src</gst:peer> </gst:pad> </gst:element> <gst:element> <gst:name>audiotestsrc0</gst:name> <gst:type>audiotestsrc</gst:type> <gst:param> <gst:name>name</gst:name> <gst:value>audiotestsrc0</gst:value> </gst:param> <gst:param> <gst:name>blocksize</gst:name> <gst:value>4096</gst:value> </gst:param> <gst:param> <gst:name>num-buffers</gst:name> <gst:value>-1</gst:value> </gst:param> <gst:param> <gst:name>typefind</gst:name> <gst:value>FALSE</gst:value> </gst:param> <gst:param> <gst:name>samplesperbuffer</gst:name> <gst:value>1024</gst:value> </gst:param> <gst:param> <gst:name>wave</gst:name> <gst:value>0</gst:value> </gst:param> <gst:param> <gst:name>freq</gst:name> <gst:value>440.000000</gst:value> </gst:param> <gst:param> <gst:name>volume</gst:name> <gst:value>1.000000</gst:value> </gst:param> <gst:param> <gst:name>is-live</gst:name> <gst:value>FALSE</gst:value> </gst:param> <gst:param> <gst:name>timestamp-offset</gst:name> <gst:value>0</gst:value> </gst:param> <gst:pad> <gst:name>src</gst:name> <gst:peer>alsasink0.sink</gst:peer> </gst:pad> </gst:element> </gst:children> </gst:element> </gstreamer> When I feed this file into gst-xmllaunch-0.10 it doesnt work, and this is the output: jono@forge:~/pythontests$ gst-xmllaunch-0.10 sinesrc.xml Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ERROR: from element /pipeline0/audiotestsrc0: Internal data flow error. Additional debug info: gstbasesrc.c(1479): gst_base_src_loop (): /pipeline0/audiotestsrc0: streaming task paused, reason not-linked ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... FREEING pipeline ... There is no audio. Steps to reproduce: 1. Follow the above steps. 2. 3. Actual results: The pipeline doesn't work. Expected results: The pipeline is executed correctly. Does this happen every time? Tested with two different pipelines that I know work. Other information:
Created attachment 67856 [details] [review] patch Seems everything it works fine internally, only that the pads are unlinked again at some stage after being linked successfully (see GST_DEBUG=*:3 output). The unlink is triggered from gst_bin_add (bin, element) which is called from gst_bin_restory_thyself(). Attached fix fixes sinesrc.xml for me. Not tested with anything else.
Committed: 2006-06-30 Tim-Philipp Müller <tim at centricular dot net> * gst/gstbin.c: (gst_bin_restore_thyself): * gst/gstxml.c: (gst_xml_make_element): Fix deserialisation from XML. Set parent manually instead of using gst_bin_add(), since gst_bin_add() will unlink all pads of the element being added. Fixes #341667. Please re-open if it doesn't fix it for you or file a new bug if there are more issues.