Beispiel #1
0
    def test_avsync(self):
        from xpra.server.source.avsync_mixin import AVSyncMixin
        #test disabled:
        #what the client sets doesn't matter:
        for e in (True, False):
            av = AVSyncMixin(False)
            av.window_sources = {}
            av.init_state()
            caps = typedict({"av-sync": e})
            av.parse_client_caps(caps)
            i = av.get_info()
            assert i
            avi = i.get("av-sync")
            assert avi and not avi.get("enabled", True)
        #now enabled:
        def get_sound_source_latency():
            return 20

        for e in (True, False):
            av = AVSyncMixin(True)
            av.window_sources = {}
            av.init_state()
            av.get_sound_source_latency = get_sound_source_latency
            caps = typedict({"av-sync": e})
            av.parse_client_caps(caps)
            i = av.get_info()
            assert i
            avi = i.get("av-sync")
            assert avi and avi.get("enabled", not e) == e
Beispiel #2
0
 def test_avsync(self):
     #needs both mixins:
     from xpra.server.source.windows_mixin import WindowsMixin
     from xpra.server.source.audio_mixin import AudioMixin
     from xpra.server.source.avsync_mixin import AVSyncMixin
     server_props = SourceMixinsTest.AUDIO_SERVER_PROPS.copy()
     server_props.update({
         "av_sync" : True,
         "sound_properties"  : {"foo" : "bar"},
         "sound.pulseaudio_id"   : "fake-one",
         "sound.pulseaudio.server" : "some-path",
         })
     server_props.update(self._get_window_mixin_server_attributes())
     self._test_mixin_classes((WindowsMixin, AudioMixin, AVSyncMixin), server_props, {
         "sound.send"    : True,
         "sound.receive" : True,
         })
     #test disabled:
     #what the client sets doesn't matter:
     for e in (True, False):
         av = AVSyncMixin()
         av.av_sync = False
         av.window_sources = {}
         av.init_state()
         caps = typedict({"av-sync" : e})
         av.parse_client_caps(caps)
         i = av.get_info()
         assert i
         avi = i.get("av-sync")
         assert avi and not avi.get("enabled", True)
     #now enabled:
     def get_sound_source_latency():
         return 20
     for e in (True, False):
         av = AVSyncMixin()
         av.av_sync = True
         av.window_sources = {}
         av.init_state()
         av.get_sound_source_latency = get_sound_source_latency
         caps = typedict({"av-sync" : e})
         av.parse_client_caps(caps)
         i = av.get_info()
         assert i
         avi = i.get("av-sync")
         assert avi and avi.get("enabled", not e)==e
         av.set_av_sync_delay(10)
         av.sound_control_av_sync_delta("100")
         try:
             av.sound_control_av_sync_delta("invalid")
         except Exception:
             pass
         assert av.get_info().get("av-sync").get("delta")==100
    def test_avsync(self):
        from xpra.server.source.avsync_mixin import AVSyncMixin
        self._test_mixin_class(AVSyncMixin)
        #test disabled:
        #what the client sets doesn't matter:
        for e in (True, False):
            av = AVSyncMixin()
            av.av_sync = False
            av.window_sources = {}
            av.init_state()
            caps = typedict({"av-sync": e})
            av.parse_client_caps(caps)
            i = av.get_info()
            assert i
            avi = i.get("av-sync")
            assert avi and not avi.get("enabled", True)
        #now enabled:
        def get_sound_source_latency():
            return 20

        for e in (True, False):
            av = AVSyncMixin()
            av.av_sync = True
            av.window_sources = {}
            av.init_state()
            av.get_sound_source_latency = get_sound_source_latency
            caps = typedict({"av-sync": e})
            av.parse_client_caps(caps)
            i = av.get_info()
            assert i
            avi = i.get("av-sync")
            assert avi and avi.get("enabled", not e) == e
            av.set_av_sync_delay(10)
            av.sound_control_av_sync_delta("100")
            try:
                av.sound_control_av_sync_delta("invalid")
            except Exception:
                pass
            assert av.get_info().get("av-sync").get("delta") == 100