MCPcopy Create free account
hub / github.com/GStreamer/gst-python / testGoodConstructor

Method testGoodConstructor

testsuite/old/test_bus.py:28–104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26
27class BusSignalTest(TestCase):
28 def testGoodConstructor(self):
29 loop = gobject.MainLoop()
30 gst.info ("creating pipeline")
31 pipeline = gst.parse_launch("fakesrc ! fakesink")
32 gst.info ("getting bus")
33 bus = pipeline.get_bus()
34 gst.info ("got bus")
35 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
36 self.assertEquals(bus.__gstrefcount__, 2)
37 self.assertEquals(pipeline.__gstrefcount__, 1)
38 gst.info ("about to add a watch on the bus")
39 watch_id = bus.connect("message", self._message_received, pipeline, loop, "one")
40 bus.add_signal_watch()
41 gst.info ("added a watch on the bus")
42 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
43 self.assertEquals(bus.__gstrefcount__, 3)
44 self.assertEquals(pipeline.__gstrefcount__, 1)
45
46 gst.info("setting to playing")
47 ret = pipeline.set_state(gst.STATE_PLAYING)
48 gst.info("set to playing %s, loop.run" % ret)
49 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
50 loop.run()
51
52 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
53 gst.info("setting to paused")
54 ret = pipeline.set_state(gst.STATE_PAUSED)
55 gst.info("set to paused %s, loop.run" % ret)
56 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
57 loop.run()
58 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
59
60 gst.info("setting to ready")
61 ret = pipeline.set_state(gst.STATE_READY)
62 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
63 gst.info("set to READY %s, loop.run" % ret)
64 loop.run()
65
66 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
67 gst.info("setting to NULL")
68 ret = pipeline.set_state(gst.STATE_NULL)
69 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
70 gst.info("set to NULL %s" % ret)
71 self.gccollect()
72 self.assertEquals(bus.__gstrefcount__, 3)
73 # FIXME: state change thread needs to die
74 while pipeline.__gstrefcount__ > 1:
75 gst.debug('waiting for pipeline refcount to drop')
76 time.sleep(0.1)
77 self.assertEquals(pipeline.__gstrefcount__, 1)
78
79 gst.info("about to remove the watch id")
80 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
81 bus.remove_signal_watch()
82 gst.info("bus watch id removed")
83 bus.disconnect(watch_id)
84 gst.info("disconnected callback")
85 gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))

Callers

nothing calls this directly

Calls 2

gccollectMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected