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)
def t(self, m): ''' Tendency t_m = (V * (v_m + \gamma * p) - Q) / (S_m) ''' Q = Whiteboard.get_instance().get_amount_video_to_play() return (self.V * (self.v(m) + self.g * 1) - Q) / self.S[m]
def __init__(self, id): IR2A.__init__(self, id) self.whiteboard = Whiteboard.get_instance() self.parsed_mpd = '' self.qi = [] # qi[1] = 91917bps self.throughputs = [91917] self.selected_qi = [91917] self.request_time = 0.0
def __init__(self, id): IR2A.__init__(self, id) self.parsed_mpd = '' self.qi = [] self.whiteboard = Whiteboard.get_instance() self.T = 8 #Valor do artigo T = 35 self.d = 2 # d = 60 self.ultimo = 0.0 self.penultimo = 0.0 self.firsTimeOcurrence = True self.timeParameter = 0.0
def __init__(self, id): IR2A.__init__(self, id) self.parsed_mpd = '' self.qi_list = [] self.request_time = 0 self.real_throughput_list = [] self.estimated_throughput_list = [] self.constraint_list = [] self.mu = 0.2 self.k = 21 self.p0 = 0.25 self.whiteboard = Whiteboard.get_instance()
def get_buffer_size(self): wboard = Whiteboard.get_instance() playbackBuffer = wboard.get_playback_buffer_size() bufferSize = playbackBuffer[-1][1] - 1 if len( playbackBuffer) > 0 else 0 return bufferSize
def __init__(self, id): SimpleModule.__init__(self, id) # Whiteboard object to change statistical information between Player and R2A algorithm self.whiteboard = Whiteboard.get_instance()