OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" | 11 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" |
12 | 12 |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 #include <fstream> | 17 #include <fstream> |
18 #include <istream> | 18 #include <istream> |
19 #include <map> | 19 #include <map> |
20 #include <utility> | 20 #include <utility> |
21 | 21 |
22 #include "webrtc/base/checks.h" | 22 #include "webrtc/base/checks.h" |
23 #include "webrtc/base/logging.h" | 23 #include "webrtc/base/logging.h" |
24 #include "webrtc/base/protobuf_utils.h" | 24 #include "webrtc/base/protobuf_utils.h" |
25 #include "webrtc/call/call.h" | |
26 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 25 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
27 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ
k_adaptor.h" | 26 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ
k_adaptor.h" |
28 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 27 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
30 | 29 |
31 namespace webrtc { | 30 namespace webrtc { |
32 | 31 |
33 namespace { | 32 namespace { |
34 MediaType GetRuntimeMediaType(rtclog::MediaType media_type) { | |
35 switch (media_type) { | |
36 case rtclog::MediaType::ANY: | |
37 return MediaType::ANY; | |
38 case rtclog::MediaType::AUDIO: | |
39 return MediaType::AUDIO; | |
40 case rtclog::MediaType::VIDEO: | |
41 return MediaType::VIDEO; | |
42 case rtclog::MediaType::DATA: | |
43 return MediaType::DATA; | |
44 } | |
45 RTC_NOTREACHED(); | |
46 return MediaType::ANY; | |
47 } | |
48 | |
49 RtcpMode GetRuntimeRtcpMode(rtclog::VideoReceiveConfig::RtcpMode rtcp_mode) { | 33 RtcpMode GetRuntimeRtcpMode(rtclog::VideoReceiveConfig::RtcpMode rtcp_mode) { |
50 switch (rtcp_mode) { | 34 switch (rtcp_mode) { |
51 case rtclog::VideoReceiveConfig::RTCP_COMPOUND: | 35 case rtclog::VideoReceiveConfig::RTCP_COMPOUND: |
52 return RtcpMode::kCompound; | 36 return RtcpMode::kCompound; |
53 case rtclog::VideoReceiveConfig::RTCP_REDUCEDSIZE: | 37 case rtclog::VideoReceiveConfig::RTCP_REDUCEDSIZE: |
54 return RtcpMode::kReducedSize; | 38 return RtcpMode::kReducedSize; |
55 } | 39 } |
56 RTC_NOTREACHED(); | 40 RTC_NOTREACHED(); |
57 return RtcpMode::kOff; | 41 return RtcpMode::kOff; |
58 } | 42 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 156 |
173 while (1) { | 157 while (1) { |
174 // Check whether we have reached end of file. | 158 // Check whether we have reached end of file. |
175 stream.peek(); | 159 stream.peek(); |
176 if (stream.eof()) { | 160 if (stream.eof()) { |
177 return true; | 161 return true; |
178 } | 162 } |
179 | 163 |
180 // Read the next message tag. The tag number is defined as | 164 // Read the next message tag. The tag number is defined as |
181 // (fieldnumber << 3) | wire_type. In our case, the field number is | 165 // (fieldnumber << 3) | wire_type. In our case, the field number is |
182 // supposed to be 1 and the wire type for an length-delimited field is 2. | 166 // supposed to be 1 and the wire type for an |
| 167 // length-delimited field is 2. |
183 const uint64_t kExpectedTag = (1 << 3) | 2; | 168 const uint64_t kExpectedTag = (1 << 3) | 2; |
184 std::tie(tag, success) = ParseVarInt(stream); | 169 std::tie(tag, success) = ParseVarInt(stream); |
185 if (!success) { | 170 if (!success) { |
186 LOG(LS_WARNING) << "Missing field tag from beginning of protobuf event."; | 171 LOG(LS_WARNING) << "Missing field tag from beginning of protobuf event."; |
187 return false; | 172 return false; |
188 } else if (tag != kExpectedTag) { | 173 } else if (tag != kExpectedTag) { |
189 LOG(LS_WARNING) << "Unexpected field tag at beginning of protobuf event."; | 174 LOG(LS_WARNING) << "Unexpected field tag at beginning of protobuf event."; |
190 return false; | 175 return false; |
191 } | 176 } |
192 | 177 |
(...skipping 13 matching lines...) Expand all Loading... |
206 LOG(LS_WARNING) << "Failed to read protobuf message from file."; | 191 LOG(LS_WARNING) << "Failed to read protobuf message from file."; |
207 return false; | 192 return false; |
208 } | 193 } |
209 | 194 |
210 // Parse the protobuf event from the buffer. | 195 // Parse the protobuf event from the buffer. |
211 rtclog::Event event; | 196 rtclog::Event event; |
212 if (!event.ParseFromArray(tmp_buffer.data(), message_length)) { | 197 if (!event.ParseFromArray(tmp_buffer.data(), message_length)) { |
213 LOG(LS_WARNING) << "Failed to parse protobuf message."; | 198 LOG(LS_WARNING) << "Failed to parse protobuf message."; |
214 return false; | 199 return false; |
215 } | 200 } |
| 201 |
| 202 EventType type = GetRuntimeEventType(event.type()); |
| 203 switch (type) { |
| 204 case VIDEO_RECEIVER_CONFIG_EVENT: { |
| 205 rtclog::StreamConfig config; |
| 206 GetVideoReceiveConfig(event, &config); |
| 207 streams_.emplace_back(config.remote_ssrc, MediaType::VIDEO, |
| 208 kIncomingPacket); |
| 209 streams_.emplace_back(config.local_ssrc, MediaType::VIDEO, |
| 210 kOutgoingPacket); |
| 211 break; |
| 212 } |
| 213 case VIDEO_SENDER_CONFIG_EVENT: { |
| 214 rtclog::StreamConfig config; |
| 215 GetVideoSendConfig(event, &config); |
| 216 streams_.emplace_back(config.local_ssrc, MediaType::VIDEO, |
| 217 kOutgoingPacket); |
| 218 |
| 219 streams_.emplace_back(config.rtx_ssrc, MediaType::VIDEO, |
| 220 kOutgoingPacket); |
| 221 break; |
| 222 } |
| 223 case AUDIO_RECEIVER_CONFIG_EVENT: { |
| 224 rtclog::StreamConfig config; |
| 225 GetAudioReceiveConfig(event, &config); |
| 226 streams_.emplace_back(config.remote_ssrc, MediaType::AUDIO, |
| 227 kIncomingPacket); |
| 228 streams_.emplace_back(config.local_ssrc, MediaType::AUDIO, |
| 229 kOutgoingPacket); |
| 230 break; |
| 231 } |
| 232 case AUDIO_SENDER_CONFIG_EVENT: { |
| 233 rtclog::StreamConfig config; |
| 234 GetAudioSendConfig(event, &config); |
| 235 streams_.emplace_back(config.local_ssrc, MediaType::AUDIO, |
| 236 kOutgoingPacket); |
| 237 break; |
| 238 } |
| 239 default: |
| 240 break; |
| 241 } |
| 242 |
216 events_.push_back(event); | 243 events_.push_back(event); |
217 } | 244 } |
218 } | 245 } |
219 | 246 |
220 size_t ParsedRtcEventLog::GetNumberOfEvents() const { | 247 size_t ParsedRtcEventLog::GetNumberOfEvents() const { |
221 return events_.size(); | 248 return events_.size(); |
222 } | 249 } |
223 | 250 |
224 int64_t ParsedRtcEventLog::GetTimestamp(size_t index) const { | 251 int64_t ParsedRtcEventLog::GetTimestamp(size_t index) const { |
225 RTC_CHECK_LT(index, GetNumberOfEvents()); | 252 RTC_CHECK_LT(index, GetNumberOfEvents()); |
226 const rtclog::Event& event = events_[index]; | 253 const rtclog::Event& event = events_[index]; |
227 RTC_CHECK(event.has_timestamp_us()); | 254 RTC_CHECK(event.has_timestamp_us()); |
228 return event.timestamp_us(); | 255 return event.timestamp_us(); |
229 } | 256 } |
230 | 257 |
231 ParsedRtcEventLog::EventType ParsedRtcEventLog::GetEventType( | 258 ParsedRtcEventLog::EventType ParsedRtcEventLog::GetEventType( |
232 size_t index) const { | 259 size_t index) const { |
233 RTC_CHECK_LT(index, GetNumberOfEvents()); | 260 RTC_CHECK_LT(index, GetNumberOfEvents()); |
234 const rtclog::Event& event = events_[index]; | 261 const rtclog::Event& event = events_[index]; |
235 RTC_CHECK(event.has_type()); | 262 RTC_CHECK(event.has_type()); |
236 return GetRuntimeEventType(event.type()); | 263 return GetRuntimeEventType(event.type()); |
237 } | 264 } |
238 | 265 |
239 // The header must have space for at least IP_PACKET_SIZE bytes. | 266 // The header must have space for at least IP_PACKET_SIZE bytes. |
240 void ParsedRtcEventLog::GetRtpHeader(size_t index, | 267 void ParsedRtcEventLog::GetRtpHeader(size_t index, |
241 PacketDirection* incoming, | 268 PacketDirection* incoming, |
242 MediaType* media_type, | |
243 uint8_t* header, | 269 uint8_t* header, |
244 size_t* header_length, | 270 size_t* header_length, |
245 size_t* total_length) const { | 271 size_t* total_length) const { |
246 RTC_CHECK_LT(index, GetNumberOfEvents()); | 272 RTC_CHECK_LT(index, GetNumberOfEvents()); |
247 const rtclog::Event& event = events_[index]; | 273 const rtclog::Event& event = events_[index]; |
248 RTC_CHECK(event.has_type()); | 274 RTC_CHECK(event.has_type()); |
249 RTC_CHECK_EQ(event.type(), rtclog::Event::RTP_EVENT); | 275 RTC_CHECK_EQ(event.type(), rtclog::Event::RTP_EVENT); |
250 RTC_CHECK(event.has_rtp_packet()); | 276 RTC_CHECK(event.has_rtp_packet()); |
251 const rtclog::RtpPacket& rtp_packet = event.rtp_packet(); | 277 const rtclog::RtpPacket& rtp_packet = event.rtp_packet(); |
252 // Get direction of packet. | 278 // Get direction of packet. |
253 RTC_CHECK(rtp_packet.has_incoming()); | 279 RTC_CHECK(rtp_packet.has_incoming()); |
254 if (incoming != nullptr) { | 280 if (incoming != nullptr) { |
255 *incoming = rtp_packet.incoming() ? kIncomingPacket : kOutgoingPacket; | 281 *incoming = rtp_packet.incoming() ? kIncomingPacket : kOutgoingPacket; |
256 } | 282 } |
257 // Get media type. | |
258 RTC_CHECK(rtp_packet.has_type()); | |
259 if (media_type != nullptr) { | |
260 *media_type = GetRuntimeMediaType(rtp_packet.type()); | |
261 } | |
262 // Get packet length. | 283 // Get packet length. |
263 RTC_CHECK(rtp_packet.has_packet_length()); | 284 RTC_CHECK(rtp_packet.has_packet_length()); |
264 if (total_length != nullptr) { | 285 if (total_length != nullptr) { |
265 *total_length = rtp_packet.packet_length(); | 286 *total_length = rtp_packet.packet_length(); |
266 } | 287 } |
267 // Get header length. | 288 // Get header length. |
268 RTC_CHECK(rtp_packet.has_header()); | 289 RTC_CHECK(rtp_packet.has_header()); |
269 if (header_length != nullptr) { | 290 if (header_length != nullptr) { |
270 *header_length = rtp_packet.header().size(); | 291 *header_length = rtp_packet.header().size(); |
271 } | 292 } |
272 // Get header contents. | 293 // Get header contents. |
273 if (header != nullptr) { | 294 if (header != nullptr) { |
274 const size_t kMinRtpHeaderSize = 12; | 295 const size_t kMinRtpHeaderSize = 12; |
275 RTC_CHECK_GE(rtp_packet.header().size(), kMinRtpHeaderSize); | 296 RTC_CHECK_GE(rtp_packet.header().size(), kMinRtpHeaderSize); |
276 RTC_CHECK_LE(rtp_packet.header().size(), | 297 RTC_CHECK_LE(rtp_packet.header().size(), |
277 static_cast<size_t>(IP_PACKET_SIZE)); | 298 static_cast<size_t>(IP_PACKET_SIZE)); |
278 memcpy(header, rtp_packet.header().data(), rtp_packet.header().size()); | 299 memcpy(header, rtp_packet.header().data(), rtp_packet.header().size()); |
279 } | 300 } |
280 } | 301 } |
281 | 302 |
282 // The packet must have space for at least IP_PACKET_SIZE bytes. | 303 // The packet must have space for at least IP_PACKET_SIZE bytes. |
283 void ParsedRtcEventLog::GetRtcpPacket(size_t index, | 304 void ParsedRtcEventLog::GetRtcpPacket(size_t index, |
284 PacketDirection* incoming, | 305 PacketDirection* incoming, |
285 MediaType* media_type, | |
286 uint8_t* packet, | 306 uint8_t* packet, |
287 size_t* length) const { | 307 size_t* length) const { |
288 RTC_CHECK_LT(index, GetNumberOfEvents()); | 308 RTC_CHECK_LT(index, GetNumberOfEvents()); |
289 const rtclog::Event& event = events_[index]; | 309 const rtclog::Event& event = events_[index]; |
290 RTC_CHECK(event.has_type()); | 310 RTC_CHECK(event.has_type()); |
291 RTC_CHECK_EQ(event.type(), rtclog::Event::RTCP_EVENT); | 311 RTC_CHECK_EQ(event.type(), rtclog::Event::RTCP_EVENT); |
292 RTC_CHECK(event.has_rtcp_packet()); | 312 RTC_CHECK(event.has_rtcp_packet()); |
293 const rtclog::RtcpPacket& rtcp_packet = event.rtcp_packet(); | 313 const rtclog::RtcpPacket& rtcp_packet = event.rtcp_packet(); |
294 // Get direction of packet. | 314 // Get direction of packet. |
295 RTC_CHECK(rtcp_packet.has_incoming()); | 315 RTC_CHECK(rtcp_packet.has_incoming()); |
296 if (incoming != nullptr) { | 316 if (incoming != nullptr) { |
297 *incoming = rtcp_packet.incoming() ? kIncomingPacket : kOutgoingPacket; | 317 *incoming = rtcp_packet.incoming() ? kIncomingPacket : kOutgoingPacket; |
298 } | 318 } |
299 // Get media type. | |
300 RTC_CHECK(rtcp_packet.has_type()); | |
301 if (media_type != nullptr) { | |
302 *media_type = GetRuntimeMediaType(rtcp_packet.type()); | |
303 } | |
304 // Get packet length. | 319 // Get packet length. |
305 RTC_CHECK(rtcp_packet.has_packet_data()); | 320 RTC_CHECK(rtcp_packet.has_packet_data()); |
306 if (length != nullptr) { | 321 if (length != nullptr) { |
307 *length = rtcp_packet.packet_data().size(); | 322 *length = rtcp_packet.packet_data().size(); |
308 } | 323 } |
309 // Get packet contents. | 324 // Get packet contents. |
310 if (packet != nullptr) { | 325 if (packet != nullptr) { |
311 RTC_CHECK_LE(rtcp_packet.packet_data().size(), | 326 RTC_CHECK_LE(rtcp_packet.packet_data().size(), |
312 static_cast<unsigned>(IP_PACKET_SIZE)); | 327 static_cast<unsigned>(IP_PACKET_SIZE)); |
313 memcpy(packet, rtcp_packet.packet_data().data(), | 328 memcpy(packet, rtcp_packet.packet_data().data(), |
314 rtcp_packet.packet_data().size()); | 329 rtcp_packet.packet_data().size()); |
315 } | 330 } |
316 } | 331 } |
317 | 332 |
318 void ParsedRtcEventLog::GetVideoReceiveConfig( | 333 void ParsedRtcEventLog::GetVideoReceiveConfig( |
319 size_t index, | 334 size_t index, |
320 rtclog::StreamConfig* config) const { | 335 rtclog::StreamConfig* config) const { |
321 RTC_CHECK_LT(index, GetNumberOfEvents()); | 336 RTC_CHECK_LT(index, GetNumberOfEvents()); |
322 const rtclog::Event& event = events_[index]; | 337 GetVideoReceiveConfig(events_[index], config); |
| 338 } |
| 339 |
| 340 void ParsedRtcEventLog::GetVideoReceiveConfig( |
| 341 const rtclog::Event& event, |
| 342 rtclog::StreamConfig* config) const { |
323 RTC_CHECK(config != nullptr); | 343 RTC_CHECK(config != nullptr); |
324 RTC_CHECK(event.has_type()); | 344 RTC_CHECK(event.has_type()); |
325 RTC_CHECK_EQ(event.type(), rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT); | 345 RTC_CHECK_EQ(event.type(), rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT); |
326 RTC_CHECK(event.has_video_receiver_config()); | 346 RTC_CHECK(event.has_video_receiver_config()); |
327 const rtclog::VideoReceiveConfig& receiver_config = | 347 const rtclog::VideoReceiveConfig& receiver_config = |
328 event.video_receiver_config(); | 348 event.video_receiver_config(); |
329 // Get SSRCs. | 349 // Get SSRCs. |
330 RTC_CHECK(receiver_config.has_remote_ssrc()); | 350 RTC_CHECK(receiver_config.has_remote_ssrc()); |
331 config->remote_ssrc = receiver_config.remote_ssrc(); | 351 config->remote_ssrc = receiver_config.remote_ssrc(); |
332 RTC_CHECK(receiver_config.has_local_ssrc()); | 352 RTC_CHECK(receiver_config.has_local_ssrc()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 394 } |
375 config->codecs.emplace_back(receiver_config.decoders(i).name(), | 395 config->codecs.emplace_back(receiver_config.decoders(i).name(), |
376 receiver_config.decoders(i).payload_type(), | 396 receiver_config.decoders(i).payload_type(), |
377 rtx_payload_type); | 397 rtx_payload_type); |
378 } | 398 } |
379 } | 399 } |
380 | 400 |
381 void ParsedRtcEventLog::GetVideoSendConfig(size_t index, | 401 void ParsedRtcEventLog::GetVideoSendConfig(size_t index, |
382 rtclog::StreamConfig* config) const { | 402 rtclog::StreamConfig* config) const { |
383 RTC_CHECK_LT(index, GetNumberOfEvents()); | 403 RTC_CHECK_LT(index, GetNumberOfEvents()); |
384 const rtclog::Event& event = events_[index]; | 404 GetVideoSendConfig(events_[index], config); |
| 405 } |
| 406 void ParsedRtcEventLog::GetVideoSendConfig(const rtclog::Event& event, |
| 407 rtclog::StreamConfig* config) const { |
385 RTC_CHECK(config != nullptr); | 408 RTC_CHECK(config != nullptr); |
386 RTC_CHECK(event.has_type()); | 409 RTC_CHECK(event.has_type()); |
387 RTC_CHECK_EQ(event.type(), rtclog::Event::VIDEO_SENDER_CONFIG_EVENT); | 410 RTC_CHECK_EQ(event.type(), rtclog::Event::VIDEO_SENDER_CONFIG_EVENT); |
388 RTC_CHECK(event.has_video_sender_config()); | 411 RTC_CHECK(event.has_video_sender_config()); |
389 const rtclog::VideoSendConfig& sender_config = event.video_sender_config(); | 412 const rtclog::VideoSendConfig& sender_config = event.video_sender_config(); |
390 // Get SSRCs. | 413 // Get SSRCs. |
391 if (sender_config.ssrcs_size() > 0) { | 414 if (sender_config.ssrcs_size() > 0) { |
392 config->local_ssrc = sender_config.ssrcs(0); | 415 config->local_ssrc = sender_config.ssrcs(0); |
393 if (sender_config.ssrcs().size() > 1) { | 416 if (sender_config.ssrcs().size() > 1) { |
394 LOG(WARNING) << "VideoSendConfig contains multiple ssrcs."; | 417 LOG(WARNING) << "VideoSendConfig contains multiple ssrcs."; |
(...skipping 17 matching lines...) Expand all Loading... |
412 config->codecs.emplace_back( | 435 config->codecs.emplace_back( |
413 sender_config.encoder().name(), sender_config.encoder().payload_type(), | 436 sender_config.encoder().name(), sender_config.encoder().payload_type(), |
414 sender_config.has_rtx_payload_type() ? sender_config.rtx_payload_type() | 437 sender_config.has_rtx_payload_type() ? sender_config.rtx_payload_type() |
415 : 0); | 438 : 0); |
416 } | 439 } |
417 | 440 |
418 void ParsedRtcEventLog::GetAudioReceiveConfig( | 441 void ParsedRtcEventLog::GetAudioReceiveConfig( |
419 size_t index, | 442 size_t index, |
420 rtclog::StreamConfig* config) const { | 443 rtclog::StreamConfig* config) const { |
421 RTC_CHECK_LT(index, GetNumberOfEvents()); | 444 RTC_CHECK_LT(index, GetNumberOfEvents()); |
422 const rtclog::Event& event = events_[index]; | 445 GetAudioReceiveConfig(events_[index], config); |
| 446 } |
| 447 |
| 448 void ParsedRtcEventLog::GetAudioReceiveConfig( |
| 449 const rtclog::Event& event, |
| 450 rtclog::StreamConfig* config) const { |
423 RTC_CHECK(config != nullptr); | 451 RTC_CHECK(config != nullptr); |
424 RTC_CHECK(event.has_type()); | 452 RTC_CHECK(event.has_type()); |
425 RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_RECEIVER_CONFIG_EVENT); | 453 RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_RECEIVER_CONFIG_EVENT); |
426 RTC_CHECK(event.has_audio_receiver_config()); | 454 RTC_CHECK(event.has_audio_receiver_config()); |
427 const rtclog::AudioReceiveConfig& receiver_config = | 455 const rtclog::AudioReceiveConfig& receiver_config = |
428 event.audio_receiver_config(); | 456 event.audio_receiver_config(); |
429 // Get SSRCs. | 457 // Get SSRCs. |
430 RTC_CHECK(receiver_config.has_remote_ssrc()); | 458 RTC_CHECK(receiver_config.has_remote_ssrc()); |
431 config->remote_ssrc = receiver_config.remote_ssrc(); | 459 config->remote_ssrc = receiver_config.remote_ssrc(); |
432 RTC_CHECK(receiver_config.has_local_ssrc()); | 460 RTC_CHECK(receiver_config.has_local_ssrc()); |
433 config->local_ssrc = receiver_config.local_ssrc(); | 461 config->local_ssrc = receiver_config.local_ssrc(); |
434 // Get header extensions. | 462 // Get header extensions. |
435 GetHeaderExtensions(&config->rtp_extensions, | 463 GetHeaderExtensions(&config->rtp_extensions, |
436 receiver_config.header_extensions()); | 464 receiver_config.header_extensions()); |
437 } | 465 } |
438 | 466 |
439 void ParsedRtcEventLog::GetAudioSendConfig(size_t index, | 467 void ParsedRtcEventLog::GetAudioSendConfig(size_t index, |
440 rtclog::StreamConfig* config) const { | 468 rtclog::StreamConfig* config) const { |
441 RTC_CHECK_LT(index, GetNumberOfEvents()); | 469 RTC_CHECK_LT(index, GetNumberOfEvents()); |
442 const rtclog::Event& event = events_[index]; | 470 GetAudioSendConfig(events_[index], config); |
| 471 } |
| 472 |
| 473 void ParsedRtcEventLog::GetAudioSendConfig(const rtclog::Event& event, |
| 474 rtclog::StreamConfig* config) const { |
443 RTC_CHECK(config != nullptr); | 475 RTC_CHECK(config != nullptr); |
444 RTC_CHECK(event.has_type()); | 476 RTC_CHECK(event.has_type()); |
445 RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_SENDER_CONFIG_EVENT); | 477 RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_SENDER_CONFIG_EVENT); |
446 RTC_CHECK(event.has_audio_sender_config()); | 478 RTC_CHECK(event.has_audio_sender_config()); |
447 const rtclog::AudioSendConfig& sender_config = event.audio_sender_config(); | 479 const rtclog::AudioSendConfig& sender_config = event.audio_sender_config(); |
448 // Get SSRCs. | 480 // Get SSRCs. |
449 RTC_CHECK(sender_config.has_ssrc()); | 481 RTC_CHECK(sender_config.has_ssrc()); |
450 config->local_ssrc = sender_config.ssrc(); | 482 config->local_ssrc = sender_config.ssrc(); |
451 // Get header extensions. | 483 // Get header extensions. |
452 GetHeaderExtensions(&config->rtp_extensions, | 484 GetHeaderExtensions(&config->rtp_extensions, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 res.failure_reason = | 613 res.failure_reason = |
582 rtc::Optional<ProbeFailureReason>(kInvalidSendReceiveRatio); | 614 rtc::Optional<ProbeFailureReason>(kInvalidSendReceiveRatio); |
583 } else if (pr_event.result() == rtclog::BweProbeResult::TIMEOUT) { | 615 } else if (pr_event.result() == rtclog::BweProbeResult::TIMEOUT) { |
584 res.failure_reason = rtc::Optional<ProbeFailureReason>(kTimeout); | 616 res.failure_reason = rtc::Optional<ProbeFailureReason>(kTimeout); |
585 } else { | 617 } else { |
586 RTC_NOTREACHED(); | 618 RTC_NOTREACHED(); |
587 } | 619 } |
588 | 620 |
589 return res; | 621 return res; |
590 } | 622 } |
| 623 |
| 624 // Returns the MediaType for registered SSRCs. Search from the end to use last |
| 625 // registered types first. |
| 626 ParsedRtcEventLog::MediaType ParsedRtcEventLog::GetMediaType( |
| 627 uint32_t ssrc, |
| 628 PacketDirection direction) const { |
| 629 for (auto rit = streams_.rbegin(); rit != streams_.rend(); ++rit) { |
| 630 if (rit->ssrc == ssrc && rit->direction == direction) |
| 631 return rit->media_type; |
| 632 } |
| 633 return MediaType::ANY; |
| 634 } |
591 } // namespace webrtc | 635 } // namespace webrtc |
OLD | NEW |