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 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 case rtclog::Event::BWE_PACKET_DELAY_EVENT: | 72 case rtclog::Event::BWE_PACKET_DELAY_EVENT: |
73 return ParsedRtcEventLog::EventType::BWE_PACKET_DELAY_EVENT; | 73 return ParsedRtcEventLog::EventType::BWE_PACKET_DELAY_EVENT; |
74 case rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT: | 74 case rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT: |
75 return ParsedRtcEventLog::EventType::VIDEO_RECEIVER_CONFIG_EVENT; | 75 return ParsedRtcEventLog::EventType::VIDEO_RECEIVER_CONFIG_EVENT; |
76 case rtclog::Event::VIDEO_SENDER_CONFIG_EVENT: | 76 case rtclog::Event::VIDEO_SENDER_CONFIG_EVENT: |
77 return ParsedRtcEventLog::EventType::VIDEO_SENDER_CONFIG_EVENT; | 77 return ParsedRtcEventLog::EventType::VIDEO_SENDER_CONFIG_EVENT; |
78 case rtclog::Event::AUDIO_RECEIVER_CONFIG_EVENT: | 78 case rtclog::Event::AUDIO_RECEIVER_CONFIG_EVENT: |
79 return ParsedRtcEventLog::EventType::AUDIO_RECEIVER_CONFIG_EVENT; | 79 return ParsedRtcEventLog::EventType::AUDIO_RECEIVER_CONFIG_EVENT; |
80 case rtclog::Event::AUDIO_SENDER_CONFIG_EVENT: | 80 case rtclog::Event::AUDIO_SENDER_CONFIG_EVENT: |
81 return ParsedRtcEventLog::EventType::AUDIO_SENDER_CONFIG_EVENT; | 81 return ParsedRtcEventLog::EventType::AUDIO_SENDER_CONFIG_EVENT; |
| 82 case rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT: |
| 83 return ParsedRtcEventLog::EventType::AUDIO_NETWORK_ADAPTATION_EVENT; |
82 } | 84 } |
83 RTC_NOTREACHED(); | 85 RTC_NOTREACHED(); |
84 return ParsedRtcEventLog::EventType::UNKNOWN_EVENT; | 86 return ParsedRtcEventLog::EventType::UNKNOWN_EVENT; |
85 } | 87 } |
86 | 88 |
87 std::pair<uint64_t, bool> ParseVarInt(std::istream& stream) { | 89 std::pair<uint64_t, bool> ParseVarInt(std::istream& stream) { |
88 uint64_t varint = 0; | 90 uint64_t varint = 0; |
89 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) { | 91 for (size_t bytes_read = 0; bytes_read < 10; ++bytes_read) { |
90 // The most significant bit of each byte is 0 if it is the last byte in | 92 // The most significant bit of each byte is 0 if it is the last byte in |
91 // the varint and 1 otherwise. Thus, we take the 7 least significant bits | 93 // the varint and 1 otherwise. Thus, we take the 7 least significant bits |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 RTC_CHECK(loss_event.has_fraction_loss()); | 449 RTC_CHECK(loss_event.has_fraction_loss()); |
448 if (fraction_loss != nullptr) { | 450 if (fraction_loss != nullptr) { |
449 *fraction_loss = loss_event.fraction_loss(); | 451 *fraction_loss = loss_event.fraction_loss(); |
450 } | 452 } |
451 RTC_CHECK(loss_event.has_total_packets()); | 453 RTC_CHECK(loss_event.has_total_packets()); |
452 if (total_packets != nullptr) { | 454 if (total_packets != nullptr) { |
453 *total_packets = loss_event.total_packets(); | 455 *total_packets = loss_event.total_packets(); |
454 } | 456 } |
455 } | 457 } |
456 | 458 |
| 459 void ParsedRtcEventLog::GetAudioNetworkAdaptation( |
| 460 size_t index, |
| 461 AudioNetworkAdaptor::EncoderRuntimeConfig* config) const { |
| 462 RTC_CHECK_LT(index, GetNumberOfEvents()); |
| 463 const rtclog::Event& event = events_[index]; |
| 464 RTC_CHECK(event.has_type()); |
| 465 RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT); |
| 466 RTC_CHECK(event.has_audio_network_adaptation()); |
| 467 const rtclog::AudioNetworkAdaptation& ana_event = |
| 468 event.audio_network_adaptation(); |
| 469 if (ana_event.has_bitrate_bps()) |
| 470 config->bitrate_bps = rtc::Optional<int>(ana_event.bitrate_bps()); |
| 471 if (ana_event.has_enable_fec()) |
| 472 config->enable_fec = rtc::Optional<bool>(ana_event.enable_fec()); |
| 473 if (ana_event.has_enable_dtx()) |
| 474 config->enable_dtx = rtc::Optional<bool>(ana_event.enable_dtx()); |
| 475 if (ana_event.has_frame_length_ms()) |
| 476 config->frame_length_ms = rtc::Optional<int>(ana_event.frame_length_ms()); |
| 477 if (ana_event.has_num_channels()) |
| 478 config->num_channels = rtc::Optional<size_t>(ana_event.num_channels()); |
| 479 if (ana_event.has_uplink_packet_loss_fraction()) |
| 480 config->uplink_packet_loss_fraction = |
| 481 rtc::Optional<float>(ana_event.uplink_packet_loss_fraction()); |
| 482 } |
| 483 |
457 } // namespace webrtc | 484 } // namespace webrtc |
OLD | NEW |