1*d9f75844SAndroid Build Coastguard Worker# RTC event log 2*d9f75844SAndroid Build Coastguard Worker 3*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.owner = 'terelius' %?> 4*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.reviewed = '2021-06-02' %?> 5*d9f75844SAndroid Build Coastguard Worker 6*d9f75844SAndroid Build Coastguard Worker## Overview 7*d9f75844SAndroid Build Coastguard Worker 8*d9f75844SAndroid Build Coastguard WorkerRTC event logs can be enabled to capture in-depth inpformation about sent and 9*d9f75844SAndroid Build Coastguard Workerreceived packets and the internal state of some WebRTC components. The logs are 10*d9f75844SAndroid Build Coastguard Workeruseful to understand network behavior and to debug issues around connectivity, 11*d9f75844SAndroid Build Coastguard Workerbandwidth estimation and audio jitter buffers. 12*d9f75844SAndroid Build Coastguard Worker 13*d9f75844SAndroid Build Coastguard WorkerThe contents include: 14*d9f75844SAndroid Build Coastguard Worker 15*d9f75844SAndroid Build Coastguard Worker* Sent and received RTP headers 16*d9f75844SAndroid Build Coastguard Worker* Full RTCP feedback 17*d9f75844SAndroid Build Coastguard Worker* ICE candidates, pings and responses 18*d9f75844SAndroid Build Coastguard Worker* Bandwidth estimator events, including loss-based estimate, delay-based 19*d9f75844SAndroid Build Coastguard Worker estimate, probe results and ALR state 20*d9f75844SAndroid Build Coastguard Worker* Audio network adaptation settings 21*d9f75844SAndroid Build Coastguard Worker* Audio playout events 22*d9f75844SAndroid Build Coastguard Worker 23*d9f75844SAndroid Build Coastguard Worker## Binary wire format 24*d9f75844SAndroid Build Coastguard Worker 25*d9f75844SAndroid Build Coastguard WorkerNo guarantees are made on the wire format, and the format may change without 26*d9f75844SAndroid Build Coastguard Workerprior notice. To maintain compatibility with past and future formats, analysis 27*d9f75844SAndroid Build Coastguard Workertools should be built on top of the provided 28*d9f75844SAndroid Build Coastguard Worker[rtc_event_log_parser.h](https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/logging/rtc_event_log/rtc_event_log_parser.h) 29*d9f75844SAndroid Build Coastguard Worker 30*d9f75844SAndroid Build Coastguard WorkerIn particular, an analysis tool should *not* read the log as a protobuf. 31*d9f75844SAndroid Build Coastguard Worker 32*d9f75844SAndroid Build Coastguard Worker## Visualization 33*d9f75844SAndroid Build Coastguard Worker 34*d9f75844SAndroid Build Coastguard WorkerSince the logs contain a substantial amount of data, it is usually convenient to 35*d9f75844SAndroid Build Coastguard Workerget an overview by visualizing them as a set of plots. Use the command: 36*d9f75844SAndroid Build Coastguard Worker 37*d9f75844SAndroid Build Coastguard Worker``` 38*d9f75844SAndroid Build Coastguard Workerout/Default/event_log_visualizer /path/to/log_file | python 39*d9f75844SAndroid Build Coastguard Worker``` 40*d9f75844SAndroid Build Coastguard Worker 41*d9f75844SAndroid Build Coastguard WorkerThis visualization requires matplotlib to be installed. The tool is capable of 42*d9f75844SAndroid Build Coastguard Workerproducing a substantial number of plots, of which only a handful are generated 43*d9f75844SAndroid Build Coastguard Workerby default. You can select which plots are generated though the `--plot=` 44*d9f75844SAndroid Build Coastguard Workercommand line argument. For example, the command 45*d9f75844SAndroid Build Coastguard Worker 46*d9f75844SAndroid Build Coastguard Worker``` 47*d9f75844SAndroid Build Coastguard Workerout/Default/event_log_visualizer \ 48*d9f75844SAndroid Build Coastguard Worker --plot=incoming_packet_sizes,incoming_stream_bitrate \ 49*d9f75844SAndroid Build Coastguard Worker /path/to/log_file | python 50*d9f75844SAndroid Build Coastguard Worker``` 51*d9f75844SAndroid Build Coastguard Worker 52*d9f75844SAndroid Build Coastguard Workerplots the sizes of incoming packets and the bitrate per incoming stream. 53*d9f75844SAndroid Build Coastguard Worker 54*d9f75844SAndroid Build Coastguard WorkerYou can get a full list of options for the `--plot` argument through 55*d9f75844SAndroid Build Coastguard Worker 56*d9f75844SAndroid Build Coastguard Worker``` 57*d9f75844SAndroid Build Coastguard Workerout/Default/event_log_visualizer --list_plots /path/to/log_file 58*d9f75844SAndroid Build Coastguard Worker``` 59*d9f75844SAndroid Build Coastguard Worker 60*d9f75844SAndroid Build Coastguard WorkerYou can also synchronize the x-axis between all plots (so zooming or 61*d9f75844SAndroid Build Coastguard Workerpanning in one plot affects all of them), by adding the command line 62*d9f75844SAndroid Build Coastguard Workerargument `--shared_xaxis`. 63*d9f75844SAndroid Build Coastguard Worker 64*d9f75844SAndroid Build Coastguard Worker 65*d9f75844SAndroid Build Coastguard Worker## Viewing the raw log contents as text 66*d9f75844SAndroid Build Coastguard Worker 67*d9f75844SAndroid Build Coastguard WorkerIf you know which format version the log file uses, you can view the raw 68*d9f75844SAndroid Build Coastguard Workercontents as text. For version 1, you can use the command 69*d9f75844SAndroid Build Coastguard Worker 70*d9f75844SAndroid Build Coastguard Worker``` 71*d9f75844SAndroid Build Coastguard Workerout/Default/protoc --decode webrtc.rtclog.EventStream \ 72*d9f75844SAndroid Build Coastguard Worker ./logging/rtc_event_log/rtc_event_log.proto < /path/to/log_file 73*d9f75844SAndroid Build Coastguard Worker``` 74*d9f75844SAndroid Build Coastguard Worker 75*d9f75844SAndroid Build Coastguard WorkerSimilarly, you can use 76*d9f75844SAndroid Build Coastguard Worker 77*d9f75844SAndroid Build Coastguard Worker``` 78*d9f75844SAndroid Build Coastguard Workerout/Default/protoc --decode webrtc.rtclog2.EventStream \ 79*d9f75844SAndroid Build Coastguard Worker ./logging/rtc_event_log/rtc_event_log2.proto < /path/to/log_file 80*d9f75844SAndroid Build Coastguard Worker``` 81*d9f75844SAndroid Build Coastguard Worker 82*d9f75844SAndroid Build Coastguard Workerfor logs that use version 2. However, note that not all of the contents will be 83*d9f75844SAndroid Build Coastguard Workerhuman readable. Some fields are based on the raw RTP format or may be encoded as 84*d9f75844SAndroid Build Coastguard Workerdeltas relative to previous fields. Such fields will be printed as a list of 85*d9f75844SAndroid Build Coastguard Workerbytes. 86