def __init__( self, numpieces, rarest_first_cutoff=1, rarest_first_priority_cutoff=3, priority_step=20, helper=None, rate_predictor=None, piecesize=0, ): PiecePicker.__init__( self, numpieces, rarest_first_cutoff, rarest_first_priority_cutoff, priority_step, helper, rate_predictor ) # maximum existing piece number, to avoid scanning beyond it in next() self.maxhave = 0 # some statistics self.stats = {} self.stats["high"] = 0 self.stats["mid"] = 0 self.stats["low"] = 0 # playback module self.transporter = None # self.outstanding_requests contains (piece-id, begin, # length):timestamp pairs for each outstanding request. self.outstanding_requests = {} # The playing_delay and buffering_delay give three values # (min, max, offeset) in seconds. # # The min tells how long before the cancel policy is allowed # to kick in. We can not expect to receive a piece instantly, # so we have to wait this time before having a download speed # estimation. # # The max tells how long before we cancel the request. The # request may also be canceled because the chunk will not be # completed given the current download speed. # # The offset gives a grace period that is taken into account # when choosing to cancel a request. For instance, when the # peer download speed is to low to receive the chunk within 10 # seconds, a grace offset of 15 would ensure that the chunk is # NOT canceled (usefull while buffering) self.playing_delay = (5, 20, -0.5) self.buffering_delay = (7.5, 30, 10)
def __init__(self, numpieces, rarest_first_cutoff=1, rarest_first_priority_cutoff=3, priority_step=20, helper=None, rate_predictor=None, piecesize=0): PiecePicker.__init__(self, numpieces, rarest_first_cutoff, rarest_first_priority_cutoff, priority_step, helper, rate_predictor) # maximum existing piece number, to avoid scanning beyond it in next() self.maxhave = 0 # some statistics self.stats = {} self.stats["high"] = 0 self.stats["mid"] = 0 self.stats["low"] = 0 # playback module self.transporter = None # self.outstanding_requests contains (piece-id, begin, # length):timestamp pairs for each outstanding request. self.outstanding_requests = {} # The playing_delay and buffering_delay give three values # (min, max, offeset) in seconds. # # The min tells how long before the cancel policy is allowed # to kick in. We can not expect to receive a piece instantly, # so we have to wait this time before having a download speed # estimation. # # The max tells how long before we cancel the request. The # request may also be canceled because the chunk will not be # completed given the current download speed. # # The offset gives a grace period that is taken into account # when choosing to cancel a request. For instance, when the # peer download speed is to low to receive the chunk within 10 # seconds, a grace offset of 15 would ensure that the chunk is # NOT canceled (usefull while buffering) self.playing_delay = (5, 20, -0.5) self.buffering_delay = (7.5, 30, 10)