| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/common_types.h" | 13 #include "webrtc/common_types.h" |
| 14 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 14 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 15 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 15 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
| 16 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 16 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
| 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h" |
| 19 #include "webrtc/test/gmock.h" |
| 19 #include "webrtc/test/gtest.h" | 20 #include "webrtc/test/gtest.h" |
| 20 | 21 |
| 21 namespace webrtc { | 22 namespace webrtc { |
| 23 namespace { |
| 24 |
| 25 using ::testing::UnorderedElementsAre; |
| 22 | 26 |
| 23 const uint32_t kTestRate = 64000u; | 27 const uint32_t kTestRate = 64000u; |
| 24 const uint8_t kTestPayload[] = {'t', 'e', 's', 't'}; | 28 const uint8_t kTestPayload[] = {'t', 'e', 's', 't'}; |
| 25 const uint8_t kPcmuPayloadType = 96; | 29 const uint8_t kPcmuPayloadType = 96; |
| 26 const int64_t kGetSourcesTimeoutMs = 10000; | 30 const int64_t kGetSourcesTimeoutMs = 10000; |
| 27 const int kSourceListsSize = 20; | 31 const uint32_t kSsrc1 = 123; |
| 32 const uint32_t kSsrc2 = 124; |
| 33 const uint32_t kCsrc1 = 111; |
| 34 const uint32_t kCsrc2 = 222; |
| 35 const bool kInOrder = true; |
| 36 |
| 37 static uint32_t rtp_timestamp(int64_t time_ms) { |
| 38 return static_cast<uint32_t>(time_ms * kTestRate / 1000); |
| 39 } |
| 40 |
| 41 } // namespace |
| 28 | 42 |
| 29 class RtpReceiverTest : public ::testing::Test { | 43 class RtpReceiverTest : public ::testing::Test { |
| 30 protected: | 44 protected: |
| 31 RtpReceiverTest() | 45 RtpReceiverTest() |
| 32 : fake_clock_(123456), | 46 : fake_clock_(123456), |
| 33 rtp_receiver_( | 47 rtp_receiver_( |
| 34 RtpReceiver::CreateAudioReceiver(&fake_clock_, | 48 RtpReceiver::CreateAudioReceiver(&fake_clock_, |
| 35 nullptr, | 49 nullptr, |
| 36 nullptr, | 50 nullptr, |
| 37 &rtp_payload_registry_)) { | 51 &rtp_payload_registry_)) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 } | 71 } |
| 58 return false; | 72 return false; |
| 59 } | 73 } |
| 60 | 74 |
| 61 SimulatedClock fake_clock_; | 75 SimulatedClock fake_clock_; |
| 62 RTPPayloadRegistry rtp_payload_registry_; | 76 RTPPayloadRegistry rtp_payload_registry_; |
| 63 std::unique_ptr<RtpReceiver> rtp_receiver_; | 77 std::unique_ptr<RtpReceiver> rtp_receiver_; |
| 64 }; | 78 }; |
| 65 | 79 |
| 66 TEST_F(RtpReceiverTest, GetSources) { | 80 TEST_F(RtpReceiverTest, GetSources) { |
| 81 int64_t now_ms = fake_clock_.TimeInMilliseconds(); |
| 82 |
| 67 RTPHeader header; | 83 RTPHeader header; |
| 68 header.payloadType = kPcmuPayloadType; | 84 header.payloadType = kPcmuPayloadType; |
| 69 header.ssrc = 1; | 85 header.ssrc = kSsrc1; |
| 70 header.timestamp = fake_clock_.TimeInMilliseconds(); | 86 header.timestamp = rtp_timestamp(now_ms); |
| 71 header.numCSRCs = 2; | 87 header.numCSRCs = 2; |
| 72 header.arrOfCSRCs[0] = 111; | 88 header.arrOfCSRCs[0] = kCsrc1; |
| 73 header.arrOfCSRCs[1] = 222; | 89 header.arrOfCSRCs[1] = kCsrc2; |
| 74 PayloadUnion payload_specific = {AudioPayload()}; | 90 PayloadUnion payload_specific = {AudioPayload()}; |
| 75 bool in_order = false; | |
| 76 RtpSource source(0, 0, RtpSourceType::SSRC); | |
| 77 | 91 |
| 78 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 92 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 79 payload_specific, in_order)); | 93 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 80 auto sources = rtp_receiver_->GetSources(); | 94 auto sources = rtp_receiver_->GetSources(); |
| 81 // One SSRC source and two CSRC sources. | 95 // One SSRC source and two CSRC sources. |
| 82 ASSERT_EQ(3u, sources.size()); | 96 EXPECT_THAT(sources, UnorderedElementsAre( |
| 83 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | 97 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC), |
| 84 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), source.timestamp_ms()); | 98 RtpSource(now_ms, kCsrc1, RtpSourceType::CSRC), |
| 85 ASSERT_TRUE( | 99 RtpSource(now_ms, kCsrc2, RtpSourceType::CSRC))); |
| 86 FindSourceByIdAndType(sources, 222u, RtpSourceType::CSRC, &source)); | |
| 87 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), source.timestamp_ms()); | |
| 88 ASSERT_TRUE( | |
| 89 FindSourceByIdAndType(sources, 111u, RtpSourceType::CSRC, &source)); | |
| 90 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), source.timestamp_ms()); | |
| 91 | 100 |
| 92 // Advance the fake clock and the method is expected to return the | 101 // Advance the fake clock and the method is expected to return the |
| 93 // contributing source object with same source id and updated timestamp. | 102 // contributing source object with same source id and updated timestamp. |
| 94 fake_clock_.AdvanceTimeMilliseconds(1); | 103 fake_clock_.AdvanceTimeMilliseconds(1); |
| 95 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 104 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 96 payload_specific, in_order)); | 105 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 97 sources = rtp_receiver_->GetSources(); | 106 sources = rtp_receiver_->GetSources(); |
| 98 ASSERT_EQ(3u, sources.size()); | 107 now_ms = fake_clock_.TimeInMilliseconds(); |
| 99 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | 108 EXPECT_THAT(sources, UnorderedElementsAre( |
| 100 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), source.timestamp_ms()); | 109 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC), |
| 101 ASSERT_TRUE( | 110 RtpSource(now_ms, kCsrc1, RtpSourceType::CSRC), |
| 102 FindSourceByIdAndType(sources, 222u, RtpSourceType::CSRC, &source)); | 111 RtpSource(now_ms, kCsrc2, RtpSourceType::CSRC))); |
| 103 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), source.timestamp_ms()); | |
| 104 ASSERT_TRUE( | |
| 105 FindSourceByIdAndType(sources, 111u, RtpSourceType::CSRC, &source)); | |
| 106 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), source.timestamp_ms()); | |
| 107 | 112 |
| 108 // Test the edge case that the sources are still there just before the | 113 // Test the edge case that the sources are still there just before the |
| 109 // timeout. | 114 // timeout. |
| 110 int64_t prev_timestamp = fake_clock_.TimeInMilliseconds(); | 115 int64_t prev_time_ms = fake_clock_.TimeInMilliseconds(); |
| 111 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); | 116 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); |
| 112 sources = rtp_receiver_->GetSources(); | 117 sources = rtp_receiver_->GetSources(); |
| 113 ASSERT_EQ(3u, sources.size()); | 118 EXPECT_THAT(sources, |
| 114 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | 119 UnorderedElementsAre( |
| 115 EXPECT_EQ(prev_timestamp, source.timestamp_ms()); | 120 RtpSource(prev_time_ms, kSsrc1, RtpSourceType::SSRC), |
| 116 ASSERT_TRUE( | 121 RtpSource(prev_time_ms, kCsrc1, RtpSourceType::CSRC), |
| 117 FindSourceByIdAndType(sources, 222u, RtpSourceType::CSRC, &source)); | 122 RtpSource(prev_time_ms, kCsrc2, RtpSourceType::CSRC))); |
| 118 EXPECT_EQ(prev_timestamp, source.timestamp_ms()); | |
| 119 ASSERT_TRUE( | |
| 120 FindSourceByIdAndType(sources, 111u, RtpSourceType::CSRC, &source)); | |
| 121 EXPECT_EQ(prev_timestamp, source.timestamp_ms()); | |
| 122 | 123 |
| 123 // Time out. | 124 // Time out. |
| 124 fake_clock_.AdvanceTimeMilliseconds(1); | 125 fake_clock_.AdvanceTimeMilliseconds(1); |
| 125 sources = rtp_receiver_->GetSources(); | 126 sources = rtp_receiver_->GetSources(); |
| 126 // All the sources should be out of date. | 127 // All the sources should be out of date. |
| 127 ASSERT_EQ(0u, sources.size()); | 128 ASSERT_EQ(0u, sources.size()); |
| 128 } | 129 } |
| 129 | 130 |
| 130 // Test the case that the SSRC is changed. | 131 // Test the case that the SSRC is changed. |
| 131 TEST_F(RtpReceiverTest, GetSourcesChangeSSRC) { | 132 TEST_F(RtpReceiverTest, GetSourcesChangeSSRC) { |
| 132 int64_t prev_time = -1; | 133 int64_t prev_time_ms = -1; |
| 133 int64_t cur_time = fake_clock_.TimeInMilliseconds(); | 134 int64_t now_ms = fake_clock_.TimeInMilliseconds(); |
| 135 |
| 134 RTPHeader header; | 136 RTPHeader header; |
| 135 header.payloadType = kPcmuPayloadType; | 137 header.payloadType = kPcmuPayloadType; |
| 136 header.ssrc = 1; | 138 header.ssrc = kSsrc1; |
| 137 header.timestamp = cur_time; | 139 header.timestamp = rtp_timestamp(now_ms); |
| 138 PayloadUnion payload_specific = {AudioPayload()}; | 140 PayloadUnion payload_specific = {AudioPayload()}; |
| 139 bool in_order = false; | |
| 140 RtpSource source(0, 0, RtpSourceType::SSRC); | |
| 141 | 141 |
| 142 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 142 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 143 payload_specific, in_order)); | 143 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 144 auto sources = rtp_receiver_->GetSources(); | 144 auto sources = rtp_receiver_->GetSources(); |
| 145 ASSERT_EQ(1u, sources.size()); | 145 EXPECT_THAT(sources, UnorderedElementsAre( |
| 146 EXPECT_EQ(1u, sources[0].source_id()); | 146 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC))); |
| 147 EXPECT_EQ(cur_time, sources[0].timestamp_ms()); | |
| 148 | 147 |
| 149 // The SSRC is changed and the old SSRC is expected to be returned. | 148 // The SSRC is changed and the old SSRC is expected to be returned. |
| 150 fake_clock_.AdvanceTimeMilliseconds(100); | 149 fake_clock_.AdvanceTimeMilliseconds(100); |
| 151 prev_time = cur_time; | 150 prev_time_ms = now_ms; |
| 152 cur_time = fake_clock_.TimeInMilliseconds(); | 151 now_ms = fake_clock_.TimeInMilliseconds(); |
| 153 header.ssrc = 2; | 152 header.ssrc = kSsrc2; |
| 154 header.timestamp = cur_time; | 153 header.timestamp = rtp_timestamp(now_ms); |
| 155 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 154 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 156 payload_specific, in_order)); | 155 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 157 sources = rtp_receiver_->GetSources(); | 156 sources = rtp_receiver_->GetSources(); |
| 158 ASSERT_EQ(2u, sources.size()); | 157 EXPECT_THAT(sources, UnorderedElementsAre( |
| 159 ASSERT_TRUE(FindSourceByIdAndType(sources, 2u, RtpSourceType::SSRC, &source)); | 158 RtpSource(prev_time_ms, kSsrc1, RtpSourceType::SSRC), |
| 160 EXPECT_EQ(cur_time, source.timestamp_ms()); | 159 RtpSource(now_ms, kSsrc2, RtpSourceType::SSRC))); |
| 161 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | |
| 162 EXPECT_EQ(prev_time, source.timestamp_ms()); | |
| 163 | 160 |
| 164 // The SSRC is changed again and happen to be changed back to 1. No | 161 // The SSRC is changed again and happen to be changed back to 1. No |
| 165 // duplication is expected. | 162 // duplication is expected. |
| 166 fake_clock_.AdvanceTimeMilliseconds(100); | 163 fake_clock_.AdvanceTimeMilliseconds(100); |
| 167 header.ssrc = 1; | 164 header.ssrc = kSsrc1; |
| 168 header.timestamp = cur_time; | 165 header.timestamp = rtp_timestamp(now_ms); |
| 169 prev_time = cur_time; | 166 prev_time_ms = now_ms; |
| 170 cur_time = fake_clock_.TimeInMilliseconds(); | 167 now_ms = fake_clock_.TimeInMilliseconds(); |
| 171 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 168 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 172 payload_specific, in_order)); | 169 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 173 sources = rtp_receiver_->GetSources(); | 170 sources = rtp_receiver_->GetSources(); |
| 174 ASSERT_EQ(2u, sources.size()); | 171 EXPECT_THAT(sources, UnorderedElementsAre( |
| 175 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | 172 RtpSource(prev_time_ms, kSsrc2, RtpSourceType::SSRC), |
| 176 EXPECT_EQ(cur_time, source.timestamp_ms()); | 173 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC))); |
| 177 ASSERT_TRUE(FindSourceByIdAndType(sources, 2u, RtpSourceType::SSRC, &source)); | |
| 178 EXPECT_EQ(prev_time, source.timestamp_ms()); | |
| 179 | 174 |
| 180 // Old SSRC source timeout. | 175 // Old SSRC source timeout. |
| 181 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); | 176 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); |
| 182 cur_time = fake_clock_.TimeInMilliseconds(); | 177 now_ms = fake_clock_.TimeInMilliseconds(); |
| 183 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 178 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 184 payload_specific, in_order)); | 179 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 185 sources = rtp_receiver_->GetSources(); | 180 sources = rtp_receiver_->GetSources(); |
| 186 ASSERT_EQ(1u, sources.size()); | 181 EXPECT_THAT(sources, UnorderedElementsAre( |
| 187 EXPECT_EQ(1u, sources[0].source_id()); | 182 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC))); |
| 188 EXPECT_EQ(cur_time, sources[0].timestamp_ms()); | |
| 189 EXPECT_EQ(RtpSourceType::SSRC, sources[0].source_type()); | |
| 190 } | 183 } |
| 191 | 184 |
| 192 TEST_F(RtpReceiverTest, GetSourcesRemoveOutdatedSource) { | 185 TEST_F(RtpReceiverTest, GetSourcesRemoveOutdatedSource) { |
| 193 int64_t timestamp = fake_clock_.TimeInMilliseconds(); | 186 int64_t now_ms = fake_clock_.TimeInMilliseconds(); |
| 194 bool in_order = false; | 187 |
| 195 RTPHeader header; | 188 RTPHeader header; |
| 196 header.payloadType = kPcmuPayloadType; | 189 header.payloadType = kPcmuPayloadType; |
| 197 header.timestamp = timestamp; | 190 header.timestamp = rtp_timestamp(now_ms); |
| 198 PayloadUnion payload_specific = {AudioPayload()}; | 191 PayloadUnion payload_specific = {AudioPayload()}; |
| 199 header.numCSRCs = 1; | 192 header.numCSRCs = 1; |
| 200 RtpSource source(0, 0, RtpSourceType::SSRC); | 193 size_t kSourceListSize = 20; |
| 201 | 194 |
| 202 for (size_t i = 0; i < kSourceListsSize; ++i) { | 195 for (size_t i = 0; i < kSourceListSize; ++i) { |
| 203 header.ssrc = i; | 196 header.ssrc = i; |
| 204 header.arrOfCSRCs[0] = (i + 1); | 197 header.arrOfCSRCs[0] = (i + 1); |
| 205 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 198 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, |
| 206 payload_specific, in_order)); | 199 sizeof(kTestPayload), |
| 200 payload_specific, !kInOrder)); |
| 207 } | 201 } |
| 208 | 202 |
| 203 RtpSource source(0, 0, RtpSourceType::SSRC); |
| 209 auto sources = rtp_receiver_->GetSources(); | 204 auto sources = rtp_receiver_->GetSources(); |
| 210 // Expect |kSourceListsSize| SSRC sources and |kSourceListsSize| CSRC sources. | 205 // Expect |kSourceListSize| SSRC sources and |kSourceListSize| CSRC sources. |
| 211 ASSERT_TRUE(sources.size() == 2 * kSourceListsSize); | 206 ASSERT_EQ(2 * kSourceListSize, sources.size()); |
| 212 for (size_t i = 0; i < kSourceListsSize; ++i) { | 207 for (size_t i = 0; i < kSourceListSize; ++i) { |
| 213 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 | 208 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 |
| 214 ASSERT_TRUE( | 209 ASSERT_TRUE( |
| 215 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); | 210 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); |
| 216 EXPECT_EQ(timestamp, source.timestamp_ms()); | 211 EXPECT_EQ(now_ms, source.timestamp_ms()); |
| 217 | 212 |
| 218 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 | 213 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 |
| 219 ASSERT_TRUE( | 214 ASSERT_TRUE( |
| 220 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); | 215 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); |
| 221 EXPECT_EQ(timestamp, source.timestamp_ms()); | 216 EXPECT_EQ(now_ms, source.timestamp_ms()); |
| 222 } | 217 } |
| 223 | 218 |
| 224 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); | 219 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); |
| 225 for (size_t i = 0; i < kSourceListsSize; ++i) { | 220 for (size_t i = 0; i < kSourceListSize; ++i) { |
| 226 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 | 221 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 |
| 227 ASSERT_TRUE( | 222 ASSERT_TRUE( |
| 228 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); | 223 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); |
| 229 EXPECT_EQ(timestamp, source.timestamp_ms()); | 224 EXPECT_EQ(now_ms, source.timestamp_ms()); |
| 230 | 225 |
| 231 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 | 226 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 |
| 232 ASSERT_TRUE( | 227 ASSERT_TRUE( |
| 233 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); | 228 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); |
| 234 EXPECT_EQ(timestamp, source.timestamp_ms()); | 229 EXPECT_EQ(now_ms, source.timestamp_ms()); |
| 235 } | 230 } |
| 236 | 231 |
| 237 // Timeout. All the existing objects are out of date and are expected to be | 232 // Timeout. All the existing objects are out of date and are expected to be |
| 238 // removed. | 233 // removed. |
| 239 fake_clock_.AdvanceTimeMilliseconds(1); | 234 fake_clock_.AdvanceTimeMilliseconds(1); |
| 240 header.ssrc = 111; | 235 header.ssrc = kSsrc1; |
| 241 header.arrOfCSRCs[0] = 222; | 236 header.arrOfCSRCs[0] = kCsrc1; |
| 242 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 237 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
| 243 payload_specific, in_order)); | 238 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
| 244 auto rtp_receiver_impl = static_cast<RtpReceiverImpl*>(rtp_receiver_.get()); | 239 auto rtp_receiver_impl = static_cast<RtpReceiverImpl*>(rtp_receiver_.get()); |
| 245 auto ssrc_sources = rtp_receiver_impl->ssrc_sources_for_testing(); | 240 auto ssrc_sources = rtp_receiver_impl->ssrc_sources_for_testing(); |
| 246 ASSERT_EQ(1u, ssrc_sources.size()); | 241 ASSERT_EQ(1u, ssrc_sources.size()); |
| 247 EXPECT_EQ(111u, ssrc_sources.begin()->source_id()); | 242 EXPECT_EQ(kSsrc1, ssrc_sources.begin()->source_id()); |
| 248 EXPECT_EQ(RtpSourceType::SSRC, ssrc_sources.begin()->source_type()); | 243 EXPECT_EQ(RtpSourceType::SSRC, ssrc_sources.begin()->source_type()); |
| 249 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), | 244 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), |
| 250 ssrc_sources.begin()->timestamp_ms()); | 245 ssrc_sources.begin()->timestamp_ms()); |
| 251 | 246 |
| 252 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); | 247 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); |
| 253 ASSERT_EQ(1u, csrc_sources.size()); | 248 ASSERT_EQ(1u, csrc_sources.size()); |
| 254 EXPECT_EQ(222u, csrc_sources.begin()->source_id()); | 249 EXPECT_EQ(kCsrc1, csrc_sources.begin()->source_id()); |
| 255 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); | 250 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); |
| 256 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), | 251 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), |
| 257 csrc_sources.begin()->timestamp_ms()); | 252 csrc_sources.begin()->timestamp_ms()); |
| 258 } | 253 } |
| 259 | 254 |
| 260 } // namespace webrtc | 255 } // namespace webrtc |
| OLD | NEW |