Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Fix a bug where CSI misses last frame
Browse files Browse the repository at this point in the history
  • Loading branch information
sefeng211 authored and ncalexan committed May 31, 2019
1 parent 594cb5f commit e09ad6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vendor/visualmetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def trim_video_end(directory, trim_time):
def adjust_frame_times(directory):
offset = None
frames = sorted(glob.glob(os.path.join(directory, 'video-*.png')))
# Special hack to the the video start
# Special hack to the the video start
# Let us tune this in the future to skip using a global
global videoRecordingStart
match = re.compile(r'video-(?P<ms>[0-9]+)\.png')
Expand Down Expand Up @@ -1484,7 +1484,7 @@ def calculate_contentful_speed_index(progress, directory):

# Assume 0 content for first frame
cont_si = 1 * (progress[1]['time'] - progress[0]['time'])
for i in xrange(1,len(progress)-2):
for i in xrange(1,len(progress)-1):
elapsed = progress[i+1]['time'] - progress[i]['time']
#print i,' time =',p['time'],'elapsed =',elapsed,'content = ',content[i]
cont_si += elapsed * (1.0 - content[i])
Expand Down Expand Up @@ -1891,8 +1891,8 @@ def main():
for metric in metrics:
data[metric['name'].replace(
' ', '')] = metric['value']
if 'videoRecordingStart' in globals():
data['videoRecordingStart'] = videoRecordingStart
if 'videoRecordingStart' in globals():
data['videoRecordingStart'] = videoRecordingStart
print json.dumps(data)
else:
for metric in metrics:
Expand Down

0 comments on commit e09ad6e

Please sign in to comment.