def setUp(self): self.prod = pipeline_src() self.cnv1 = pipeline_cnv() self.cnv2 = pipeline_cnv() self.components = [self.prod, self.cnv1, self.cnv2] self.p = ComponentTestHelper()
def setUp(self): self.duration = 2.0 prod_pp = "videotestsrc is-live=true ! " "video/x-raw-rgb,framerate=(fraction)8/1," "width=32,height=24" self.prod = pipeline_src(prod_pp) self.cnv1 = pipeline_cnv() self.cnv2 = pipeline_cnv() self.p = ComponentTestHelper()
def setUp(self): self.duration = 2.0 prod_pp = ('videotestsrc is-live=true ! ' 'video/x-raw-rgb,framerate=(fraction)8/1,' 'width=32,height=24') self.prod = pipeline_src(prod_pp) self.cnv1 = pipeline_cnv() self.cnv2 = pipeline_cnv() self.p = ComponentTestHelper()
def testSetupFailGstLinking(self): p2 = pipeline_src("fakesink") # this just can't work! c2 = pipeline_cnv("fakesink") # and neither can this! # we're going to fail in gst - make sure the gst logger is silent import gst old_debug_level = gst.debug_get_default_threshold() gst.debug_set_default_threshold(gst.LEVEL_NONE) self.p.set_flow([p2, c2, self.cnv1]) d = self.p.start_flow() if old_debug_level != gst.LEVEL_NONE: def _restore_gst_debug_level(rf): gst.debug_set_default_threshold(old_debug_level) return rf d.addBoth(_restore_gst_debug_level) # Because component setup errors get swallowed in # BaseComponent.setup() we won't get the exact error that will # be thrown, i.e. PipelineParseError. Instead, the component # will turn sad and we will get a ComponentSad failure from # the ComponentWrapper. return self.failUnlessFailure(d, ComponentSad)
def testRunFailGstLinking(self): p2 = pipeline_src('fakesink') # this just can't work! c2 = pipeline_cnv('fakesink') # and neither can this! # we're going to fail in gst - make sure the gst logger is silent import gst old_debug_level = gst.debug_get_default_threshold() gst.debug_set_default_threshold(gst.LEVEL_NONE) self.p.set_flow([p2, c2, self.cnv1]) d = self.p.run_flow(self.duration) if old_debug_level != gst.LEVEL_NONE: def _restore_gst_debug_level(rf): gst.debug_set_default_threshold(old_debug_level) return rf d.addBoth(_restore_gst_debug_level) # See the comment in test_setup_fail_gst_linking() return self.failUnlessFailure(d, ComponentSad)
def testFlow(self): enc = comptest.pipeline_cnv('flumch264enc max-keyframe-distance=15' 'min-keyframe-distance=15') properties = {'fragment-duration': 500} mux = comptest.ComponentWrapper('fmp4-muxer', fmp4.FMP4, name='muxer', props=properties, plugs={}) tester = comptest.ComponentWrapper('fmp4-tester', FMP4Tester, name='tester', props=properties, plugs={}) self.tp.set_flow([self.prod, enc, mux, tester]) d = self.tp.start_flow() tester.comp.test = self # wait for the muxer to go happy d.addCallback(lambda _: mux.wait_for_mood(moods.happy)) # let it run for a few seconds d.addCallback(lambda _: comptest.delayed_d(3, _)) return d
def testSetupFailGstLinking(self): p2 = pipeline_src('fakesink') # this just can't work! c2 = pipeline_cnv('fakesink') # and neither can this! # we're going to fail in gst - make sure the gst logger is silent import gst old_debug_level = gst.debug_get_default_threshold() gst.debug_set_default_threshold(gst.LEVEL_NONE) self.p.set_flow([p2, c2, self.cnv1]) d = self.p.start_flow() if old_debug_level != gst.LEVEL_NONE: def _restore_gst_debug_level(rf): gst.debug_set_default_threshold(old_debug_level) return rf d.addBoth(_restore_gst_debug_level) # Because component setup errors get swallowed in # BaseComponent.setup() we won't get the exact error that will # be thrown, i.e. PipelineParseError. Instead, the component # will turn sad and we will get a ComponentSad failure from # the ComponentWrapper. return self.failUnlessFailure(d, ComponentSad)