OLD | NEW |
1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 """Displays statistics and plots graphs from RTC protobuf dump.""" | 9 """Displays statistics and plots graphs from RTC protobuf dump.""" |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 def calculate_delay(start, stop, step, points): | 274 def calculate_delay(start, stop, step, points): |
275 """Quantizes the time coordinates for the delay. | 275 """Quantizes the time coordinates for the delay. |
276 | 276 |
277 Quantizes points by rounding the timestamps downwards to the nearest | 277 Quantizes points by rounding the timestamps downwards to the nearest |
278 point in the time sequence start, start+step, start+2*step... Takes | 278 point in the time sequence start, start+step, start+2*step... Takes |
279 the average of the delays of points rounded to the same. Returns | 279 the average of the delays of points rounded to the same. Returns |
280 masked array, in which time points with no value are masked. | 280 masked array, in which time points with no value are masked. |
281 | 281 |
282 """ | 282 """ |
283 grouped_delays = [[] for _ in numpy.arange(start, stop, step)] | 283 grouped_delays = [[] for _ in numpy.arange(start, stop + step, step)] |
284 rounded_value_index = lambda x: int((x - start) / step) | 284 rounded_value_index = lambda x: int((x - start) / step) |
285 for point in points: | 285 for point in points: |
286 grouped_delays[rounded_value_index(point.real_send_time_ms) | 286 grouped_delays[rounded_value_index(point.real_send_time_ms) |
287 ].append(point.absdelay) | 287 ].append(point.absdelay) |
288 regularized_delays = [numpy.average(arr) if arr else -1 for arr in | 288 regularized_delays = [numpy.average(arr) if arr else -1 for arr in |
289 grouped_delays] | 289 grouped_delays] |
290 return numpy.ma.masked_values(regularized_delays, -1) | 290 return numpy.ma.masked_values(regularized_delays, -1) |
291 | 291 |
292 | 292 |
293 def main(): | 293 def main(): |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 print("Statistics:") | 331 print("Statistics:") |
332 rtp_stats.print_sequence_number_statistics() | 332 rtp_stats.print_sequence_number_statistics() |
333 rtp_stats.estimate_frequency(options.query_sample_rate) | 333 rtp_stats.estimate_frequency(options.query_sample_rate) |
334 rtp_stats.print_duration_statistics() | 334 rtp_stats.print_duration_statistics() |
335 rtp_stats.remove_reordered() | 335 rtp_stats.remove_reordered() |
336 rtp_stats.compute_bandwidth() | 336 rtp_stats.compute_bandwidth() |
337 rtp_stats.plot_statistics() | 337 rtp_stats.plot_statistics() |
338 | 338 |
339 if __name__ == "__main__": | 339 if __name__ == "__main__": |
340 main() | 340 main() |
OLD | NEW |