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