コード例 #1
0
    def __init__(self, id):
        SimpleModule.__init__(self, id)
        self.initial_time = 0
        self.qi = []

        # for traffic shaping
        config_parser = ConfigurationParser.get_instance()
        self.traffic_shaping_interval = int(
            config_parser.get_parameter('traffic_shaping_profile_interval'))
        self.traffic_shaping_seed = int(
            config_parser.get_parameter('traffic_shaping_seed'))
        self.traffic_shaping_values = []

        # mark the current traffic shapping interval
        self.current_traffic_shaping_interval = 0

        self.traffic_shaping_sequence = []
        # traffic shaping sequence position
        self.tss_position = 0
        # traffic shaping values position
        self.tsv_position = 0

        token = config_parser.get_parameter('traffic_shaping_profile_sequence')
        for i in range(len(token)):
            if token[i] == 'L':
                self.traffic_shaping_sequence.append(0)
            elif token[i] == 'M':
                self.traffic_shaping_sequence.append(1)
            elif token[i] == 'H':
                self.traffic_shaping_sequence.append(2)

        self.timer = Timer.get_instance()
コード例 #2
0
ファイル: player.py プロジェクト: luandkg/pydash
    def __init__(self, id):
        SimpleModule.__init__(self, id)

        config_parser = ConfigurationParser.get_instance()

        self.buffering_until = int(config_parser.get_parameter('buffering_until'))
        self.max_buffer_size = int(config_parser.get_parameter('max_buffer_size'))
        self.playback_step = int(config_parser.get_parameter('playbak_step'))
        self.url_mpd = config_parser.get_parameter('url_mpd')

        # last pause started at time
        self.pause_started_at = None
        self.pauses_number = 0

        # tag to verify if buffer has an minimal amount of data
        self.buffer_initialization = True

        # Does the player already started to download a segment?
        self.already_downloading = False

        # buffer itself
        self.buffer = []

        # the buffer played position
        self.buffer_played = 0

        # history of what was played in buffer
        self.playback_history = []

        #initialize with the first segment sequence number to download
        self.segment_id   = 1

        self.parsed_mpd = ''
        self.qi         = []

        self.timer = Timer.get_instance()

        #threading playback
        self.playback_thread = threading.Thread(target=self.handle_video_playback)
        self.player_thread_events = threading.Event()
        self.lock = threading.Lock()
        self.kill_playback_thread = False

        self.request_time = 0

        self.playback_qi = OutVector()
        self.playback_quality_qi = OutVector()
        self.playback_pauses = OutVector()
        self.playback = OutVector()
        self.playback_buffer_size = OutVector()
        self.throughput = OutVector()

        self.whiteboard = Whiteboard.get_instance()
        self.whiteboard.add_playback_history(self.playback.get_items())
        self.whiteboard.add_playback_qi(self.playback_qi.get_items())
        self.whiteboard.add_playback_pauses(self.playback_pauses.get_items())
        self.whiteboard.add_playback_buffer_size(self.playback_buffer_size.get_items())
        self.whiteboard.add_buffer(self.buffer)

        self.whiteboard.add_max_buffer_size(self.max_buffer_size)
コード例 #3
0
    def __init__(self, id):
        SimpleModule.__init__(self, id)

        # Whiteboard object to change statistical information between Player and R2A algorithm
        self.whiteboard = Whiteboard.get_instance()