Exemplo n.º 1
0
    def test_availabilityPropagation(self):
        a = self.newSysClock()
        b = CorrelatedClock(a, 1000)
        c = CorrelatedClock(b, 2000)
        d = CorrelatedClock(c, 3000)

        da = MockDependent()
        db = MockDependent()
        dc = MockDependent()
        dd = MockDependent()

        a.bind(da)
        b.bind(db)
        c.bind(dc)
        d.bind(dd)

        self.assertTrue(a.isAvailable())
        self.assertTrue(b.isAvailable())
        self.assertTrue(c.isAvailable())
        self.assertTrue(d.isAvailable())

        c.setAvailability(False)
        self.assertTrue(a.isAvailable())
        self.assertTrue(b.isAvailable())
        self.assertFalse(c.isAvailable())
        self.assertFalse(d.isAvailable())
        da.assertNotNotified()
        db.assertNotNotified()
        dc.assertNotificationsEqual([c])
        dd.assertNotificationsEqual([d])

        d.setAvailability(False)
        self.assertTrue(a.isAvailable())
        self.assertTrue(b.isAvailable())
        self.assertFalse(c.isAvailable())
        self.assertFalse(d.isAvailable())
        da.assertNotNotified()
        db.assertNotNotified()
        dc.assertNotNotified()
        dd.assertNotNotified()

        c.setAvailability(True)
        self.assertTrue(a.isAvailable())
        self.assertTrue(b.isAvailable())
        self.assertTrue(c.isAvailable())
        self.assertFalse(d.isAvailable())
        da.assertNotNotified()
        db.assertNotNotified()
        dc.assertNotificationsEqual([c])
        dd.assertNotificationsEqual([d])
Exemplo n.º 2
0
        logging.disable(logging.CRITICAL)
    else:
        logging.basicConfig(level=args.loglevel[0])

    logging.getLogger("dvbcss.protocol.client.wc").setLevel(args.wcloglevel[0])

    sysclock=SysClock()
    wallClock=CorrelatedClock(sysclock,tickRate=1000000000) # nanos
    
    algorithm = LowestDispersionCandidate(wallClock,repeatSecs=1,timeoutSecs=0.5)
    
    wc_client=WallClockClient(wc_bind, wc_dest, wallClock, algorithm)
    wc_client.start()
    
    timelineClock = CorrelatedClock(wallClock, timelineFreq)
    timelineClock.setAvailability(False)

    print "Connecting, requesting timeline for:"
    print "   Any contentId beginning with:",contentIdStem
    print "   and using timeline selector: ",timelineSelector
    print

    ts = TSClientClockController(tsUrl, contentIdStem, timelineSelector, timelineClock, correlationChangeThresholdSecs=0.001)
    
    exiting=False
    tsClientLogger = logging.getLogger("TSClient")
    def reportCallback(msg,exit=False):
        def callback(*a,**k):
            global exiting
            tsClientLogger.info(msg+"\n")
            if exit:
Exemplo n.º 3
0
                                          wallClock=wallClock,
                                          clock=ptsTimeline,
                                          speedSource=ptsTimeline)
    temiSource = SimpleClockTimelineSource("urn:dvb:css:timeline:temi:1:1",
                                           wallClock=wallClock,
                                           clock=temiTimeline,
                                           speedSource=ptsTimeline)

    tsServer.attachTimelineSource(ptsSource)
    tsServer.attachTimelineSource(temiSource)

    wcServer.start()

    cherrypy.engine.start()

    try:
        while True:
            time.sleep(30)
            temiTimeline.setAvailability(False)
            tsServer.updateAllClients()

            time.sleep(30)
            temiTimeline.setAvailability(True)
            tsServer.updateAllClients()

    except KeyboardInterrupt:
        pass
    finally:
        cherrypy.engine.exit()
        wcServer.stop()
Exemplo n.º 4
0
        ptsClock.speed = 1.0

    try:
        while True:
            tsServer.updateAllClients()

            time.sleep(5)
            tweakPtsClock()
            tsServer.updateAllClients()
            print "Tweaked correlation timestamp for PTS and TEMI."
            print "PTS clock at %f (units of seconds)" % (
                float(ptsClock.ticks) / ptsClock.tickRate)

            time.sleep(5)
            tsServer.removeTimelineSource(sporadicTimeline)
            sporadicTemiClock.setAvailability(True)
            tsServer.updateAllClients()
            print "Made timeline " + sporadicTimeline._timelineSelector + " unavailable."

            time.sleep(5)
            pausePtsClock()
            tsServer.updateAllClients()
            print "Paused the PTS and TEMI timelines."
            print "PTS clock at %f (units of seconds)" % (
                float(ptsClock.ticks) / ptsClock.tickRate)

            time.sleep(5)
            sporadicTemiClock.setAvailability(False)
            tsServer.attachTimelineSource(sporadicTimeline)
            tsServer.updateAllClients()
            print "Made timeline " + sporadicTimeline._timelineSelector + " available."