| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #ifdef ENABLE_RTC_EVENT_LOG | 11 #ifdef ENABLE_RTC_EVENT_LOG |
| 12 | 12 |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <utility> | 16 #include <utility> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "webrtc/base/buffer.h" | 20 #include "webrtc/base/buffer.h" |
| 21 #include "webrtc/base/checks.h" | 21 #include "webrtc/base/checks.h" |
| 22 #include "webrtc/base/random.h" | 22 #include "webrtc/base/random.h" |
| 23 #include "webrtc/base/rate_limiter.h" |
| 23 #include "webrtc/call.h" | 24 #include "webrtc/call.h" |
| 24 #include "webrtc/call/rtc_event_log.h" | 25 #include "webrtc/call/rtc_event_log.h" |
| 25 #include "webrtc/call/rtc_event_log_parser.h" | 26 #include "webrtc/call/rtc_event_log_parser.h" |
| 26 #include "webrtc/call/rtc_event_log_unittest_helper.h" | 27 #include "webrtc/call/rtc_event_log_unittest_helper.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
| 29 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" |
| 30 #include "webrtc/system_wrappers/include/clock.h" | 31 #include "webrtc/system_wrappers/include/clock.h" |
| 31 #include "webrtc/test/test_suite.h" | 32 #include "webrtc/test/test_suite.h" |
| 32 #include "webrtc/test/testsupport/fileutils.h" | 33 #include "webrtc/test/testsupport/fileutils.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 * presence of extension number i from kExtensionTypes / kExtensionNames. | 105 * presence of extension number i from kExtensionTypes / kExtensionNames. |
| 105 * The least significant bit extension_bitvector has number 0. | 106 * The least significant bit extension_bitvector has number 0. |
| 106 */ | 107 */ |
| 107 size_t GenerateRtpPacket(uint32_t extensions_bitvector, | 108 size_t GenerateRtpPacket(uint32_t extensions_bitvector, |
| 108 uint32_t csrcs_count, | 109 uint32_t csrcs_count, |
| 109 uint8_t* packet, | 110 uint8_t* packet, |
| 110 size_t packet_size, | 111 size_t packet_size, |
| 111 Random* prng) { | 112 Random* prng) { |
| 112 RTC_CHECK_GE(packet_size, 16 + 4 * csrcs_count + 4 * kNumExtensions); | 113 RTC_CHECK_GE(packet_size, 16 + 4 * csrcs_count + 4 * kNumExtensions); |
| 113 Clock* clock = Clock::GetRealTimeClock(); | 114 Clock* clock = Clock::GetRealTimeClock(); |
| 115 RateLimiter retranmission_rate_limiter(clock, 1000); |
| 114 | 116 |
| 115 RTPSender rtp_sender(false, // bool audio | 117 RTPSender rtp_sender(false, // bool audio |
| 116 clock, // Clock* clock | 118 clock, // Clock* clock |
| 117 nullptr, // Transport* | 119 nullptr, // Transport* |
| 118 nullptr, // PacedSender* | 120 nullptr, // PacedSender* |
| 119 nullptr, // PacketRouter* | 121 nullptr, // PacketRouter* |
| 120 nullptr, // SendTimeObserver* | 122 nullptr, // SendTimeObserver* |
| 121 nullptr, // BitrateStatisticsObserver* | 123 nullptr, // BitrateStatisticsObserver* |
| 122 nullptr, // FrameCountObserver* | 124 nullptr, // FrameCountObserver* |
| 123 nullptr, // SendSideDelayObserver* | 125 nullptr, // SendSideDelayObserver* |
| 124 nullptr, // RtcEventLog* | 126 nullptr, // RtcEventLog* |
| 125 nullptr, // SendPacketObserver* | 127 nullptr, // SendPacketObserver* |
| 126 nullptr); // NackRateLimiter* | 128 &retranmission_rate_limiter); |
| 127 | 129 |
| 128 std::vector<uint32_t> csrcs; | 130 std::vector<uint32_t> csrcs; |
| 129 for (unsigned i = 0; i < csrcs_count; i++) { | 131 for (unsigned i = 0; i < csrcs_count; i++) { |
| 130 csrcs.push_back(prng->Rand<uint32_t>()); | 132 csrcs.push_back(prng->Rand<uint32_t>()); |
| 131 } | 133 } |
| 132 rtp_sender.SetCsrcs(csrcs); | 134 rtp_sender.SetCsrcs(csrcs); |
| 133 rtp_sender.SetSSRC(prng->Rand<uint32_t>()); | 135 rtp_sender.SetSSRC(prng->Rand<uint32_t>()); |
| 134 rtp_sender.SetStartTimestamp(prng->Rand<uint32_t>(), true); | 136 rtp_sender.SetStartTimestamp(prng->Rand<uint32_t>(), true); |
| 135 rtp_sender.SetSequenceNumber(prng->Rand<uint16_t>()); | 137 rtp_sender.SetSequenceNumber(prng->Rand<uint16_t>()); |
| 136 | 138 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 rtcp_packet.size()); | 470 rtcp_packet.size()); |
| 469 | 471 |
| 470 RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 3); | 472 RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 3); |
| 471 | 473 |
| 472 // Clean up temporary file - can be pretty slow. | 474 // Clean up temporary file - can be pretty slow. |
| 473 remove(temp_filename.c_str()); | 475 remove(temp_filename.c_str()); |
| 474 } | 476 } |
| 475 } // namespace webrtc | 477 } // namespace webrtc |
| 476 | 478 |
| 477 #endif // ENABLE_RTC_EVENT_LOG | 479 #endif // ENABLE_RTC_EVENT_LOG |
| OLD | NEW |