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 26 matching lines...) Expand all Loading... |
37 case rtclog::MediaType::VIDEO: | 37 case rtclog::MediaType::VIDEO: |
38 return MediaType::VIDEO; | 38 return MediaType::VIDEO; |
39 case rtclog::MediaType::DATA: | 39 case rtclog::MediaType::DATA: |
40 return MediaType::DATA; | 40 return MediaType::DATA; |
41 } | 41 } |
42 RTC_NOTREACHED(); | 42 RTC_NOTREACHED(); |
43 return MediaType::ANY; | 43 return MediaType::ANY; |
44 } | 44 } |
45 | 45 |
46 BandwidthUsage GetRuntimeDetectorState( | 46 BandwidthUsage GetRuntimeDetectorState( |
47 rtclog::BwePacketDelayEvent::DetectorState detector_state) { | 47 rtclog::DelayBasedBweUpdate::DetectorState detector_state) { |
48 switch (detector_state) { | 48 switch (detector_state) { |
49 case rtclog::BwePacketDelayEvent::BWE_NORMAL: | 49 case rtclog::DelayBasedBweUpdate::BWE_NORMAL: |
50 return kBwNormal; | 50 return kBwNormal; |
51 case rtclog::BwePacketDelayEvent::BWE_UNDERUSING: | 51 case rtclog::DelayBasedBweUpdate::BWE_UNDERUSING: |
52 return kBwUnderusing; | 52 return kBwUnderusing; |
53 case rtclog::BwePacketDelayEvent::BWE_OVERUSING: | 53 case rtclog::DelayBasedBweUpdate::BWE_OVERUSING: |
54 return kBwOverusing; | 54 return kBwOverusing; |
55 } | 55 } |
56 RTC_NOTREACHED(); | 56 RTC_NOTREACHED(); |
57 return kBwNormal; | 57 return kBwNormal; |
58 } | 58 } |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 // Checks that the event has a timestamp, a type and exactly the data field | 61 // Checks that the event has a timestamp, a type and exactly the data field |
62 // corresponding to the type. | 62 // corresponding to the type. |
63 ::testing::AssertionResult IsValidBasicEvent(const rtclog::Event& event) { | 63 ::testing::AssertionResult IsValidBasicEvent(const rtclog::Event& event) { |
64 if (!event.has_timestamp_us()) { | 64 if (!event.has_timestamp_us()) { |
65 return ::testing::AssertionFailure() << "Event has no timestamp"; | 65 return ::testing::AssertionFailure() << "Event has no timestamp"; |
66 } | 66 } |
67 if (!event.has_type()) { | 67 if (!event.has_type()) { |
68 return ::testing::AssertionFailure() << "Event has no event type"; | 68 return ::testing::AssertionFailure() << "Event has no event type"; |
69 } | 69 } |
70 rtclog::Event_EventType type = event.type(); | 70 rtclog::Event_EventType type = event.type(); |
71 if ((type == rtclog::Event::RTP_EVENT) != event.has_rtp_packet()) { | 71 if ((type == rtclog::Event::RTP_EVENT) != event.has_rtp_packet()) { |
72 return ::testing::AssertionFailure() | 72 return ::testing::AssertionFailure() |
73 << "Event of type " << type << " has " | 73 << "Event of type " << type << " has " |
74 << (event.has_rtp_packet() ? "" : "no ") << "RTP packet"; | 74 << (event.has_rtp_packet() ? "" : "no ") << "RTP packet"; |
75 } | 75 } |
76 if ((type == rtclog::Event::RTCP_EVENT) != event.has_rtcp_packet()) { | 76 if ((type == rtclog::Event::RTCP_EVENT) != event.has_rtcp_packet()) { |
77 return ::testing::AssertionFailure() | 77 return ::testing::AssertionFailure() |
78 << "Event of type " << type << " has " | 78 << "Event of type " << type << " has " |
79 << (event.has_rtcp_packet() ? "" : "no ") << "RTCP packet"; | 79 << (event.has_rtcp_packet() ? "" : "no ") << "RTCP packet"; |
80 } | 80 } |
81 if ((type == rtclog::Event::BWE_PACKET_LOSS_EVENT) != | 81 if ((type == rtclog::Event::LOSS_BASED_BWE_UPDATE) != |
82 event.has_bwe_packet_loss_event()) { | 82 event.has_loss_based_bwe_update()) { |
83 return ::testing::AssertionFailure() | 83 return ::testing::AssertionFailure() |
84 << "Event of type " << type << " has " | 84 << "Event of type " << type << " has " |
85 << (event.has_bwe_packet_loss_event() ? "" : "no ") << "packet loss"; | 85 << (event.has_loss_based_bwe_update() ? "" : "no ") << "loss update"; |
86 } | 86 } |
87 if ((type == rtclog::Event::BWE_PACKET_DELAY_EVENT) != | 87 if ((type == rtclog::Event::DELAY_BASED_BWE_UPDATE) != |
88 event.has_bwe_packet_delay_event()) { | 88 event.has_delay_based_bwe_update()) { |
89 return ::testing::AssertionFailure() | 89 return ::testing::AssertionFailure() |
90 << "Event of type " << type << " has " | 90 << "Event of type " << type << " has " |
91 << (event.has_bwe_packet_delay_event() ? "" : "no ") | 91 << (event.has_delay_based_bwe_update() ? "" : "no ") |
92 << "packet delay"; | 92 << "delay update"; |
93 } | 93 } |
94 if ((type == rtclog::Event::AUDIO_PLAYOUT_EVENT) != | 94 if ((type == rtclog::Event::AUDIO_PLAYOUT_EVENT) != |
95 event.has_audio_playout_event()) { | 95 event.has_audio_playout_event()) { |
96 return ::testing::AssertionFailure() | 96 return ::testing::AssertionFailure() |
97 << "Event of type " << type << " has " | 97 << "Event of type " << type << " has " |
98 << (event.has_audio_playout_event() ? "" : "no ") | 98 << (event.has_audio_playout_event() ? "" : "no ") |
99 << "audio_playout event"; | 99 << "audio_playout event"; |
100 } | 100 } |
101 if ((type == rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT) != | 101 if ((type == rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT) != |
102 event.has_video_receiver_config()) { | 102 event.has_video_receiver_config()) { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 | 469 |
470 void RtcEventLogTestHelper::VerifyBweLossEvent( | 470 void RtcEventLogTestHelper::VerifyBweLossEvent( |
471 const ParsedRtcEventLog& parsed_log, | 471 const ParsedRtcEventLog& parsed_log, |
472 size_t index, | 472 size_t index, |
473 int32_t bitrate, | 473 int32_t bitrate, |
474 uint8_t fraction_loss, | 474 uint8_t fraction_loss, |
475 int32_t total_packets) { | 475 int32_t total_packets) { |
476 const rtclog::Event& event = parsed_log.events_[index]; | 476 const rtclog::Event& event = parsed_log.events_[index]; |
477 ASSERT_TRUE(IsValidBasicEvent(event)); | 477 ASSERT_TRUE(IsValidBasicEvent(event)); |
478 ASSERT_EQ(rtclog::Event::BWE_PACKET_LOSS_EVENT, event.type()); | 478 ASSERT_EQ(rtclog::Event::LOSS_BASED_BWE_UPDATE, event.type()); |
479 const rtclog::BwePacketLossEvent& bwe_event = event.bwe_packet_loss_event(); | 479 const rtclog::LossBasedBweUpdate& bwe_event = event.loss_based_bwe_update(); |
480 ASSERT_TRUE(bwe_event.has_bitrate()); | 480 ASSERT_TRUE(bwe_event.has_bitrate_bps()); |
481 EXPECT_EQ(bitrate, bwe_event.bitrate()); | 481 EXPECT_EQ(bitrate, bwe_event.bitrate_bps()); |
482 ASSERT_TRUE(bwe_event.has_fraction_loss()); | 482 ASSERT_TRUE(bwe_event.has_fraction_loss()); |
483 EXPECT_EQ(fraction_loss, bwe_event.fraction_loss()); | 483 EXPECT_EQ(fraction_loss, bwe_event.fraction_loss()); |
484 ASSERT_TRUE(bwe_event.has_total_packets()); | 484 ASSERT_TRUE(bwe_event.has_total_packets()); |
485 EXPECT_EQ(total_packets, bwe_event.total_packets()); | 485 EXPECT_EQ(total_packets, bwe_event.total_packets()); |
486 | 486 |
487 // Check consistency of the parser. | 487 // Check consistency of the parser. |
488 int32_t parsed_bitrate; | 488 int32_t parsed_bitrate; |
489 uint8_t parsed_fraction_loss; | 489 uint8_t parsed_fraction_loss; |
490 int32_t parsed_total_packets; | 490 int32_t parsed_total_packets; |
491 parsed_log.GetBwePacketLossEvent( | 491 parsed_log.GetLossBasedBweUpdate( |
492 index, &parsed_bitrate, &parsed_fraction_loss, &parsed_total_packets); | 492 index, &parsed_bitrate, &parsed_fraction_loss, &parsed_total_packets); |
493 EXPECT_EQ(bitrate, parsed_bitrate); | 493 EXPECT_EQ(bitrate, parsed_bitrate); |
494 EXPECT_EQ(fraction_loss, parsed_fraction_loss); | 494 EXPECT_EQ(fraction_loss, parsed_fraction_loss); |
495 EXPECT_EQ(total_packets, parsed_total_packets); | 495 EXPECT_EQ(total_packets, parsed_total_packets); |
496 } | 496 } |
497 | 497 |
498 void RtcEventLogTestHelper::VerifyBweDelayEvent( | 498 void RtcEventLogTestHelper::VerifyBweDelayEvent( |
499 const ParsedRtcEventLog& parsed_log, | 499 const ParsedRtcEventLog& parsed_log, |
500 size_t index, | 500 size_t index, |
501 int32_t bitrate, | 501 int32_t bitrate, |
502 BandwidthUsage detector_state) { | 502 BandwidthUsage detector_state) { |
503 const rtclog::Event& event = parsed_log.events_[index]; | 503 const rtclog::Event& event = parsed_log.events_[index]; |
504 ASSERT_TRUE(IsValidBasicEvent(event)); | 504 ASSERT_TRUE(IsValidBasicEvent(event)); |
505 ASSERT_EQ(rtclog::Event::BWE_PACKET_DELAY_EVENT, event.type()); | 505 ASSERT_EQ(rtclog::Event::DELAY_BASED_BWE_UPDATE, event.type()); |
506 const rtclog::BwePacketDelayEvent& bwe_event = event.bwe_packet_delay_event(); | 506 const rtclog::DelayBasedBweUpdate& bwe_event = event.delay_based_bwe_update(); |
507 ASSERT_TRUE(bwe_event.has_bitrate()); | 507 ASSERT_TRUE(bwe_event.has_bitrate_bps()); |
508 EXPECT_EQ(bitrate, bwe_event.bitrate()); | 508 EXPECT_EQ(bitrate, bwe_event.bitrate_bps()); |
509 ASSERT_TRUE(bwe_event.has_detector_state()); | 509 ASSERT_TRUE(bwe_event.has_detector_state()); |
510 EXPECT_EQ(detector_state, | 510 EXPECT_EQ(detector_state, |
511 GetRuntimeDetectorState(bwe_event.detector_state())); | 511 GetRuntimeDetectorState(bwe_event.detector_state())); |
512 | 512 |
513 // Check consistency of the parser. | 513 // Check consistency of the parser. |
514 int32_t parsed_bitrate; | 514 int32_t parsed_bitrate; |
515 BandwidthUsage parsed_detector_state; | 515 BandwidthUsage parsed_detector_state; |
516 parsed_log.GetBwePacketDelayEvent(index, &parsed_bitrate, | 516 parsed_log.GetDelayBasedBweUpdate(index, &parsed_bitrate, |
517 &parsed_detector_state); | 517 &parsed_detector_state); |
518 EXPECT_EQ(bitrate, parsed_bitrate); | 518 EXPECT_EQ(bitrate, parsed_bitrate); |
519 EXPECT_EQ(detector_state, parsed_detector_state); | 519 EXPECT_EQ(detector_state, parsed_detector_state); |
520 } | 520 } |
521 | 521 |
522 void RtcEventLogTestHelper::VerifyAudioNetworkAdaptation( | 522 void RtcEventLogTestHelper::VerifyAudioNetworkAdaptation( |
523 const ParsedRtcEventLog& parsed_log, | 523 const ParsedRtcEventLog& parsed_log, |
524 size_t index, | 524 size_t index, |
525 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { | 525 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { |
526 AudioNetworkAdaptor::EncoderRuntimeConfig parsed_config; | 526 AudioNetworkAdaptor::EncoderRuntimeConfig parsed_config; |
(...skipping 17 matching lines...) Expand all Loading... |
544 | 544 |
545 void RtcEventLogTestHelper::VerifyLogEndEvent( | 545 void RtcEventLogTestHelper::VerifyLogEndEvent( |
546 const ParsedRtcEventLog& parsed_log, | 546 const ParsedRtcEventLog& parsed_log, |
547 size_t index) { | 547 size_t index) { |
548 const rtclog::Event& event = parsed_log.events_[index]; | 548 const rtclog::Event& event = parsed_log.events_[index]; |
549 ASSERT_TRUE(IsValidBasicEvent(event)); | 549 ASSERT_TRUE(IsValidBasicEvent(event)); |
550 EXPECT_EQ(rtclog::Event::LOG_END, event.type()); | 550 EXPECT_EQ(rtclog::Event::LOG_END, event.type()); |
551 } | 551 } |
552 | 552 |
553 } // namespace webrtc | 553 } // namespace webrtc |
OLD | NEW |