def process_video_sent_pt(self, pt, ts, session): video_ts = int(pt['video_ts']) self.out[session][video_ts] = {} sv = self.out[session][video_ts] # short name sv['sent_ts'] = ts sv['format'] = pt['format'] sv['size'] = float(pt['size']) # bytes sv['delivery_rate'] = float(pt['delivery_rate']) # byte/second sv['cwnd'] = float(pt['cwnd']) # packets sv['in_flight'] = float(pt['in_flight']) # packets sv['min_rtt'] = float(pt['min_rtt']) / MILLION # us -> s sv['rtt'] = float(pt['rtt']) / MILLION # us -> s sv['ssim_index'] = get_ssim_index(pt) # unitless sv['channel'] = pt['channel']
def do_collect_ssim(s_str, e_str, d): sys.stderr.write('Processing video_acked data between {} and {}\n' .format(s_str, e_str)) video_acked_results = query_measurement( influx_client, 'video_acked', s_str, e_str)['video_acked'] for pt in video_acked_results: expt_id = str(pt['expt_id']) expt_config = retrieve_expt_config(expt_id, expt, postgres_cursor) abr_cc = get_abr_cc(expt_config) if abr_cc not in d: d[abr_cc] = [0.0, 0] # sum, count ssim_index = get_ssim_index(pt) if ssim_index is not None and ssim_index != 1: d[abr_cc][0] += ssim_index d[abr_cc][1] += 1
def process_video_sent_pt(self, pt, ts, session): video_ts = int(pt['video_ts']) if video_ts in self.out[session]: sys.exit( 'VideoStream: video_ts {} already exists in session {}'.format( video_ts, session)) self.out[session][video_ts] = {} sv = self.out[session][video_ts] # short name sv['sent_ts'] = ts # np.datetime64 sv['format'] = pt['format'] # e.g., '1280x720-24' sv['size'] = float(pt['size']) # bytes sv['delivery_rate'] = float(pt['delivery_rate']) # byte/second sv['cwnd'] = float(pt['cwnd']) # packets sv['in_flight'] = float(pt['in_flight']) # packets sv['min_rtt'] = float(pt['min_rtt']) / MILLION # us -> s sv['rtt'] = float(pt['rtt']) / MILLION # us -> s sv['ssim_index'] = get_ssim_index(pt) # unitless float sv['channel'] = pt['channel'] # e.g., 'cbs'
def do_collect_ssim(video_acked_results, expt_id_cache, postgres_cursor): # process InfluxDB data x = {} for pt in video_acked_results['video_acked']: expt_id = get_expt_id(pt) expt_config = retrieve_expt_config(expt_id, expt_id_cache, postgres_cursor) abr_cc = get_abr_cc(expt_config) if abr_cc not in x: x[abr_cc] = [] ssim_index = get_ssim_index(pt) if ssim_index is not None: x[abr_cc].append(ssim_index) # calculate average SSIM in dB for abr_cc in x: avg_ssim_index = np.mean(x[abr_cc]) avg_ssim_db = ssim_index_to_db(avg_ssim_index) x[abr_cc] = avg_ssim_db return x
def collect_ssim(video_acked_results, postgres_cursor): # process InfluxDB data x = {} for pt in video_acked_results['video_acked']: expt_id = int(pt['expt_id']) expt_config = retrieve_expt_config(expt_id, expt_id_cache, postgres_cursor) # index x by (abr, cc) abr_cc = (expt_config['abr'], expt_config['cc']) if abr_cc not in x: x[abr_cc] = [] ssim_index = get_ssim_index(pt) if ssim_index is not None: x[abr_cc].append(ssim_index) # calculate average SSIM in dB ssim = {} for abr_cc in x: avg_ssim_index = np.mean(x[abr_cc]) avg_ssim_db = ssim_index_to_db(avg_ssim_index) ssim[abr_cc] = avg_ssim_db return ssim