Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 1 | syntax = "proto2"; |
| 2 | option optimize_for = LITE_RUNTIME; |
| 3 | package webrtc.rtclog; |
| 4 | |
| 5 | |
| 6 | enum MediaType { |
| 7 | ANY = 0; |
| 8 | AUDIO = 1; |
| 9 | VIDEO = 2; |
| 10 | DATA = 3; |
| 11 | } |
| 12 | |
| 13 | |
| 14 | // This is the main message to dump to a file, it can contain multiple event |
| 15 | // messages, but it is possible to append multiple EventStreams (each with a |
| 16 | // single event) to a file. |
| 17 | // This has the benefit that there's no need to keep all data in memory. |
| 18 | message EventStream { |
| 19 | repeated Event stream = 1; |
| 20 | } |
| 21 | |
| 22 | |
| 23 | message Event { |
| 24 | // required - Elapsed wallclock time in us since the start of the log. |
| 25 | optional int64 timestamp_us = 1; |
| 26 | |
| 27 | // The different types of events that can occur, the UNKNOWN_EVENT entry |
| 28 | // is added in case future EventTypes are added, in that case old code will |
| 29 | // receive the new events as UNKNOWN_EVENT. |
| 30 | enum EventType { |
| 31 | UNKNOWN_EVENT = 0; |
Ivo Creusen | 3939297 | 2015-10-08 16:07:41 | [diff] [blame] | 32 | LOG_START = 1; |
| 33 | LOG_END = 2; |
| 34 | RTP_EVENT = 3; |
| 35 | RTCP_EVENT = 4; |
| 36 | AUDIO_PLAYOUT_EVENT = 5; |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 37 | BWE_PACKET_LOSS_EVENT = 6; |
| 38 | BWE_PACKET_DELAY_EVENT = 7; |
| 39 | VIDEO_RECEIVER_CONFIG_EVENT = 8; |
| 40 | VIDEO_SENDER_CONFIG_EVENT = 9; |
| 41 | AUDIO_RECEIVER_CONFIG_EVENT = 10; |
| 42 | AUDIO_SENDER_CONFIG_EVENT = 11; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | // required - Indicates the type of this event |
| 46 | optional EventType type = 2; |
| 47 | |
| 48 | // optional - but required if type == RTP_EVENT |
| 49 | optional RtpPacket rtp_packet = 3; |
| 50 | |
| 51 | // optional - but required if type == RTCP_EVENT |
| 52 | optional RtcpPacket rtcp_packet = 4; |
| 53 | |
Ivo Creusen | 3939297 | 2015-10-08 16:07:41 | [diff] [blame] | 54 | // optional - but required if type == AUDIO_PLAYOUT_EVENT |
| 55 | optional AudioPlayoutEvent audio_playout_event = 5; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 56 | |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 57 | // optional - but required if type == BWE_PACKET_LOSS_EVENT |
| 58 | optional BwePacketLossEvent bwe_packet_loss_event = 6; |
| 59 | |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 60 | // optional - but required if type == VIDEO_RECEIVER_CONFIG_EVENT |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 61 | optional VideoReceiveConfig video_receiver_config = 8; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 62 | |
| 63 | // optional - but required if type == VIDEO_SENDER_CONFIG_EVENT |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 64 | optional VideoSendConfig video_sender_config = 9; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 65 | |
| 66 | // optional - but required if type == AUDIO_RECEIVER_CONFIG_EVENT |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 67 | optional AudioReceiveConfig audio_receiver_config = 10; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 68 | |
| 69 | // optional - but required if type == AUDIO_SENDER_CONFIG_EVENT |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 70 | optional AudioSendConfig audio_sender_config = 11; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | |
| 74 | message RtpPacket { |
| 75 | // required - True if the packet is incoming w.r.t. the user logging the data |
| 76 | optional bool incoming = 1; |
| 77 | |
| 78 | // required |
| 79 | optional MediaType type = 2; |
| 80 | |
| 81 | // required - The size of the packet including both payload and header. |
| 82 | optional uint32 packet_length = 3; |
| 83 | |
| 84 | // required - The RTP header only. |
| 85 | optional bytes header = 4; |
| 86 | |
| 87 | // Do not add code to log user payload data without a privacy review! |
| 88 | } |
| 89 | |
| 90 | |
| 91 | message RtcpPacket { |
| 92 | // required - True if the packet is incoming w.r.t. the user logging the data |
| 93 | optional bool incoming = 1; |
| 94 | |
| 95 | // required |
| 96 | optional MediaType type = 2; |
| 97 | |
| 98 | // required - The whole packet including both payload and header. |
| 99 | optional bytes packet_data = 3; |
| 100 | } |
| 101 | |
Ivo Creusen | 3939297 | 2015-10-08 16:07:41 | [diff] [blame] | 102 | message AudioPlayoutEvent { |
| 103 | // required - The SSRC of the audio stream associated with the playout event. |
Ivo Creusen | 6ebcb2a | 2015-09-17 14:30:16 | [diff] [blame] | 104 | optional uint32 local_ssrc = 2; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 105 | } |
| 106 | |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 107 | message BwePacketLossEvent { |
| 108 | // required - Bandwidth estimate (in bps) after the update. |
| 109 | optional int32 bitrate = 1; |
| 110 | |
| 111 | // required - Fraction of lost packets since last receiver report |
| 112 | // computed as floor( 256 * (#lost_packets / #total_packets) ). |
| 113 | // The possible values range from 0 to 255. |
| 114 | optional uint32 fraction_loss = 2; |
| 115 | |
| 116 | // TODO(terelius): Is this really needed? Remove or make optional? |
| 117 | // required - Total number of packets that the BWE update is based on. |
| 118 | optional int32 total_packets = 3; |
| 119 | } |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 120 | |
| 121 | // TODO(terelius): Video and audio streams could in principle share SSRC, |
| 122 | // so identifying a stream based only on SSRC might not work. |
| 123 | // It might be better to use a combination of SSRC and media type |
| 124 | // or SSRC and port number, but for now we will rely on SSRC only. |
| 125 | message VideoReceiveConfig { |
| 126 | // required - Synchronization source (stream identifier) to be received. |
| 127 | optional uint32 remote_ssrc = 1; |
| 128 | // required - Sender SSRC used for sending RTCP (such as receiver reports). |
| 129 | optional uint32 local_ssrc = 2; |
| 130 | |
| 131 | // Compound mode is described by RFC 4585 and reduced-size |
| 132 | // RTCP mode is described by RFC 5506. |
| 133 | enum RtcpMode { |
| 134 | RTCP_COMPOUND = 1; |
| 135 | RTCP_REDUCEDSIZE = 2; |
| 136 | } |
| 137 | // required - RTCP mode to use. |
| 138 | optional RtcpMode rtcp_mode = 3; |
| 139 | |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 140 | // required - Receiver estimated maximum bandwidth. |
terelius | e37a013 | 2015-11-06 17:00:18 | [diff] [blame] | 141 | optional bool remb = 4; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 142 | |
| 143 | // Map from video RTP payload type -> RTX config. |
terelius | e37a013 | 2015-11-06 17:00:18 | [diff] [blame] | 144 | repeated RtxMap rtx_map = 5; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 145 | |
| 146 | // RTP header extensions used for the received stream. |
terelius | e37a013 | 2015-11-06 17:00:18 | [diff] [blame] | 147 | repeated RtpHeaderExtension header_extensions = 6; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 148 | |
| 149 | // List of decoders associated with the stream. |
terelius | e37a013 | 2015-11-06 17:00:18 | [diff] [blame] | 150 | repeated DecoderConfig decoders = 7; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | |
| 154 | // Maps decoder names to payload types. |
| 155 | message DecoderConfig { |
| 156 | // required |
| 157 | optional string name = 1; |
| 158 | |
| 159 | // required |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 160 | optional int32 payload_type = 2; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | |
| 164 | // Maps RTP header extension names to numerical IDs. |
| 165 | message RtpHeaderExtension { |
| 166 | // required |
| 167 | optional string name = 1; |
| 168 | |
| 169 | // required |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 170 | optional int32 id = 2; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | |
| 174 | // RTX settings for incoming video payloads that may be received. |
| 175 | // RTX is disabled if there's no config present. |
| 176 | message RtxConfig { |
| 177 | // required - SSRC to use for the RTX stream. |
| 178 | optional uint32 rtx_ssrc = 1; |
| 179 | |
| 180 | // required - Payload type to use for the RTX stream. |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 181 | optional int32 rtx_payload_type = 2; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | |
| 185 | message RtxMap { |
| 186 | // required |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 187 | optional int32 payload_type = 1; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 188 | |
| 189 | // required |
| 190 | optional RtxConfig config = 2; |
| 191 | } |
| 192 | |
| 193 | |
| 194 | message VideoSendConfig { |
| 195 | // Synchronization source (stream identifier) for outgoing stream. |
| 196 | // One stream can have several ssrcs for e.g. simulcast. |
| 197 | // At least one ssrc is required. |
| 198 | repeated uint32 ssrcs = 1; |
| 199 | |
| 200 | // RTP header extensions used for the outgoing stream. |
| 201 | repeated RtpHeaderExtension header_extensions = 2; |
| 202 | |
| 203 | // List of SSRCs for retransmitted packets. |
| 204 | repeated uint32 rtx_ssrcs = 3; |
| 205 | |
| 206 | // required if rtx_ssrcs is used - Payload type for retransmitted packets. |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 207 | optional int32 rtx_payload_type = 4; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 208 | |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 209 | // required - Encoder associated with the stream. |
terelius | e37a013 | 2015-11-06 17:00:18 | [diff] [blame] | 210 | optional EncoderConfig encoder = 5; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | |
| 214 | // Maps encoder names to payload types. |
| 215 | message EncoderConfig { |
| 216 | // required |
| 217 | optional string name = 1; |
| 218 | |
| 219 | // required |
terelius | cfdad3c | 2015-11-05 20:02:15 | [diff] [blame] | 220 | optional int32 payload_type = 2; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | |
| 224 | message AudioReceiveConfig { |
Ivo Creusen | 3939297 | 2015-10-08 16:07:41 | [diff] [blame] | 225 | // required - Synchronization source (stream identifier) to be received. |
| 226 | optional uint32 remote_ssrc = 1; |
| 227 | |
| 228 | // required - Sender SSRC used for sending RTCP (such as receiver reports). |
| 229 | optional uint32 local_ssrc = 2; |
| 230 | |
| 231 | // RTP header extensions used for the received audio stream. |
| 232 | repeated RtpHeaderExtension header_extensions = 3; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | |
| 236 | message AudioSendConfig { |
Ivo Creusen | 3939297 | 2015-10-08 16:07:41 | [diff] [blame] | 237 | // required - Synchronization source (stream identifier) for outgoing stream. |
| 238 | optional uint32 ssrc = 1; |
| 239 | |
| 240 | // RTP header extensions used for the outgoing audio stream. |
| 241 | repeated RtpHeaderExtension header_extensions = 2; |
Bjorn Terelius | bd3fce5 | 2015-07-30 10:45:18 | [diff] [blame] | 242 | } |