From 418f0c5ff97cb5afc6bb7f1471f13bac8fdffd90 Mon Sep 17 00:00:00 2001 From: Alessio Bazzica Date: Wed, 24 Jul 2019 16:33:01 +0200 Subject: [PATCH] Fix rtp_analyzer tool - Make rtp_analyzer work with a single SSRC - Simplify rtp_analyzer.sh (it allows to run the python script from any directory) - Update README.md (simplified, added missing dependency) Bug: webrtc:10829 Change-Id: Idb82e7228918a973778762a39b732ce3b26b6bbc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146711 Reviewed-by: Artem Titov Reviewed-by: Mirko Bonadei Commit-Queue: Alessio Bazzica Cr-Commit-Position: refs/heads/master@{#28668} --- rtc_tools/py_event_log_analyzer/README | 32 ------------------- rtc_tools/py_event_log_analyzer/README.md | 26 +++++++++++++++ .../py_event_log_analyzer/rtp_analyzer.py | 2 +- .../py_event_log_analyzer/rtp_analyzer.sh | 13 ++------ 4 files changed, 30 insertions(+), 43 deletions(-) delete mode 100644 rtc_tools/py_event_log_analyzer/README create mode 100644 rtc_tools/py_event_log_analyzer/README.md diff --git a/rtc_tools/py_event_log_analyzer/README b/rtc_tools/py_event_log_analyzer/README deleted file mode 100644 index 6c77136d04..0000000000 --- a/rtc_tools/py_event_log_analyzer/README +++ /dev/null @@ -1,32 +0,0 @@ -This file describes how to set up and use the RTP log analyzer. - -First build the tool with - - ninja -C out/my_build webrtc:rtp_analyzer - -The tool is built by default, so - - ninja -C out/my_build - -is enough. - -After building, run the tool as follows: - - ./out/my_build/rtp_analyzer.sh [options] - -where is a recorded RTC event log, which is stored in -protobuf format. Such logs are generated in multiple ways, e.g. by -Chrome through the chrome://webrtc-internals page. - -Options: - -h, --help show this help message and exit - --dump_header_to_stdout - print header info to stdout; similar to rtp_analyze - --query_sample_rate always query user for real sample rate - -The script has been tested to work in python versions 3.4.1 and 2.7.6, -but should work in all python versions. - -Working versions of NumPy (http://www.numpy.org/) and matplotlib -(http://matplotlib.org/) are needed to run this tool. See this link -with installation instructions (http://www.scipy.org/install.html). diff --git a/rtc_tools/py_event_log_analyzer/README.md b/rtc_tools/py_event_log_analyzer/README.md new file mode 100644 index 0000000000..12f436c3d7 --- /dev/null +++ b/rtc_tools/py_event_log_analyzer/README.md @@ -0,0 +1,26 @@ +# RTP log analyzer +This file describes how to set up and use the RTP log analyzer. + +## Build + +```shell +$ autoninja -C out/my_build webrtc:rtp_analyzer +``` + +## Usage + +```shell +./out/my_build/rtp_analyzer.sh [options] /path/to/rtc_event.log +``` + +where `/path/to/rtc_event.log` is a recorded RTC event log, which is stored in +protobuf format. Such logs are generated in multiple ways, e.g. by Chrome +through the chrome://webrtc-internals page. + +Use `--help` for the options. + +The script requires Python (2.7 or 3+) and it has the following dependencies: +Dependencies (available on pip): +- matplotlib (http://matplotlib.org/) +- numpy (http://www.numpy.org/) +- protobuf (https://pypi.org/project/protobuf/) diff --git a/rtc_tools/py_event_log_analyzer/rtp_analyzer.py b/rtc_tools/py_event_log_analyzer/rtp_analyzer.py index 23e15fc0dc..ebf4d7fb2a 100644 --- a/rtc_tools/py_event_log_analyzer/rtp_analyzer.py +++ b/rtc_tools/py_event_log_analyzer/rtp_analyzer.py @@ -90,7 +90,7 @@ class RTPStatistics(object): """Queries user for SSRC.""" if len(self.ssrc_frequencies) == 1: - chosen_ssrc = self.ssrc_frequencies[0][-1] + chosen_ssrc = self.ssrc_frequencies.keys()[0] self.PrintSsrcInfo("", chosen_ssrc) return chosen_ssrc diff --git a/rtc_tools/py_event_log_analyzer/rtp_analyzer.sh b/rtc_tools/py_event_log_analyzer/rtp_analyzer.sh index 817ca4f1c4..7467e493d2 100755 --- a/rtc_tools/py_event_log_analyzer/rtp_analyzer.sh +++ b/rtc_tools/py_event_log_analyzer/rtp_analyzer.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license @@ -6,12 +6,5 @@ # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. -set -e -WORKING_DIR=$(pwd) -cd $(dirname $0) -PYTHONPATH="../../third_party/protobuf/python/" -if [ -z ${PYTHON_EXECUTABLE+x} ] -then - PYTHON_EXECUTABLE=python3 -fi -exec $PYTHON_EXECUTABLE "rtp_analyzer.py" $@ --working_dir $WORKING_DIR +BASE_DIR=`dirname $0` +python "${BASE_DIR}/rtp_analyzer.py" $@ --working_dir $BASE_DIR