def main(): usage = "Usage: %prog [options] <filename of rtc event log>" parser = optparse.OptionParser(usage=usage) parser.add_option( "--dump_header_to_stdout", default=False, action="store_true", help="print header info to stdout; similar to rtp_analyze") parser.add_option("--query_sample_rate", default=False, action="store_true", help="always query user for real sample rate") parser.add_option("--working_directory", default=None, action="store", help="directory in which to search for relative paths") (options, args) = parser.parse_args() if len(args) < 1: parser.print_help() sys.exit(0) input_file = args[0] if options.working_directory and not os.path.isabs(input_file): input_file = os.path.join(options.working_directory, input_file) data_points = pb_parse.parse_protobuf(input_file) rtp_stats = RTPStatistics(data_points) if options.dump_header_to_stdout: print("Printing header info to stdout.", file=sys.stderr) rtp_stats.print_header_statistics() sys.exit(0) chosen_ssrc = rtp_stats.choose_ssrc() print("Chosen SSRC: 0X{:X}".format(chosen_ssrc)) rtp_stats.filter_ssrc(chosen_ssrc) print("Statistics:") rtp_stats.print_sequence_number_statistics() rtp_stats.estimate_frequency(options.query_sample_rate) rtp_stats.print_duration_statistics() rtp_stats.remove_reordered() rtp_stats.compute_bandwidth() rtp_stats.plot_statistics()
def main(): usage = "Usage: %prog [options] <filename of rtc event log>" parser = optparse.OptionParser(usage=usage) parser.add_option("--dump_header_to_stdout", default=False, action="store_true", help="print header info to stdout; similar to rtp_analyze") parser.add_option("--query_sample_rate", default=False, action="store_true", help="always query user for real sample rate") parser.add_option("--working_directory", default=None, action="store", help="directory in which to search for relative paths") (options, args) = parser.parse_args() if len(args) < 1: parser.print_help() sys.exit(0) input_file = args[0] if options.working_directory and not os.path.isabs(input_file): input_file = os.path.join(options.working_directory, input_file) data_points = pb_parse.parse_protobuf(input_file) rtp_stats = RTPStatistics(data_points) if options.dump_header_to_stdout: print("Printing header info to stdout.", file=sys.stderr) rtp_stats.print_header_statistics() sys.exit(0) chosen_ssrc = rtp_stats.choose_ssrc() print("Chosen SSRC: 0X{:X}".format(chosen_ssrc)) rtp_stats.filter_ssrc(chosen_ssrc) print("Statistics:") rtp_stats.print_sequence_number_statistics() rtp_stats.estimate_frequency(options.query_sample_rate) rtp_stats.print_duration_statistics() rtp_stats.remove_reordered() rtp_stats.compute_bandwidth() rtp_stats.plot_statistics()
def main(): if len(sys.argv) < 2: print("Usage: python rtp_analyzer.py <filename of rtc event log>") sys.exit(0) data_points = pb_parse.parse_protobuf(sys.argv[1]) rtp_stats = RTPStatistics(data_points) chosen_ssrc = rtp_stats.choose_ssrc() print("Chosen SSRC: 0X{:X}".format(chosen_ssrc)) rtp_stats.filter_ssrc(chosen_ssrc) print("Statistics:") rtp_stats.print_sequence_number_statistics() rtp_stats.estimate_frequency() rtp_stats.print_duration_statistics() rtp_stats.remove_reordered() rtp_stats.compute_bandwidth() rtp_stats.plot_statistics()