Seek bug and rewind bug
This commit is contained in:
parent
342ee3651d
commit
c0d860987c
@ -321,8 +321,8 @@ class SyncFactory(Factory):
|
|||||||
position += curtime - ctime
|
position += curtime - ctime
|
||||||
watcher.counter = counter
|
watcher.counter = counter
|
||||||
watcher.max_position = position
|
watcher.max_position = position
|
||||||
self.send_state_to(watcher, position, curtime)
|
self.send_state_to(watcher, position)
|
||||||
self.broadcast_room(watcher, lambda receiver: self.__do_seek(receiver, position, watcher, curtime))
|
self.broadcast_room(watcher, lambda receiver: self.__do_seek(receiver, position, watcher))
|
||||||
|
|
||||||
def __do_seek(self, receiver, position, watcher, curtime):
|
def __do_seek(self, receiver, position, watcher, curtime):
|
||||||
receiver.max_position = position
|
receiver.max_position = position
|
||||||
@ -345,13 +345,15 @@ class SyncFactory(Factory):
|
|||||||
|
|
||||||
def find_position(self, room):
|
def find_position(self, room):
|
||||||
curtime = time.time()
|
curtime = time.time()
|
||||||
minPos = 0.0
|
minPos = None
|
||||||
minWatcher = None
|
minWatcher = None
|
||||||
for watcher in self.watchers.itervalues():
|
for watcher in self.watchers.itervalues():
|
||||||
if watcher.last_update and watcher.room == room:
|
if watcher.last_update and watcher.room == room:
|
||||||
watcherPos = max(watcher.max_position, watcher.position + (0 if self.paused[watcher.room] else curtime-watcher.last_update))
|
watcherPos = max(watcher.max_position, watcher.position + (0 if self.paused[watcher.room] else curtime-watcher.last_update))
|
||||||
minPos = watcherPos if watcherPos < min else min
|
if minPos is None or watcherPos < minPos:
|
||||||
minWatcher = watcher
|
minPos = watcherPos
|
||||||
|
minWatcher = watcher
|
||||||
|
minPos = 0.0 if not minPos else minPos
|
||||||
return minPos, minWatcher
|
return minPos, minWatcher
|
||||||
|
|
||||||
def pong_received(self, watcher_proto, value, ctime):
|
def pong_received(self, watcher_proto, value, ctime):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user