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 | |
36 static uint32_t rtp_timestamp(int64_t time_ms) { | |
37 return static_cast<uint32_t>(time_ms * kTestRate / 1000); | |
38 } | |
39 | |
40 } // namespace | |
28 | 41 |
29 class RtpReceiverTest : public ::testing::Test { | 42 class RtpReceiverTest : public ::testing::Test { |
30 protected: | 43 protected: |
31 RtpReceiverTest() | 44 RtpReceiverTest() |
32 : fake_clock_(123456), | 45 : fake_clock_(123456), |
33 rtp_receiver_( | 46 rtp_receiver_( |
34 RtpReceiver::CreateAudioReceiver(&fake_clock_, | 47 RtpReceiver::CreateAudioReceiver(&fake_clock_, |
35 nullptr, | 48 nullptr, |
36 nullptr, | 49 nullptr, |
37 &rtp_payload_registry_)) { | 50 &rtp_payload_registry_)) { |
(...skipping 19 matching lines...) Expand all Loading... | |
57 } | 70 } |
58 return false; | 71 return false; |
59 } | 72 } |
60 | 73 |
61 SimulatedClock fake_clock_; | 74 SimulatedClock fake_clock_; |
62 RTPPayloadRegistry rtp_payload_registry_; | 75 RTPPayloadRegistry rtp_payload_registry_; |
63 std::unique_ptr<RtpReceiver> rtp_receiver_; | 76 std::unique_ptr<RtpReceiver> rtp_receiver_; |
64 }; | 77 }; |
65 | 78 |
66 TEST_F(RtpReceiverTest, GetSources) { | 79 TEST_F(RtpReceiverTest, GetSources) { |
80 int64_t now_ms = fake_clock_.TimeInMilliseconds(); | |
81 | |
67 RTPHeader header; | 82 RTPHeader header; |
68 header.payloadType = kPcmuPayloadType; | 83 header.payloadType = kPcmuPayloadType; |
69 header.ssrc = 1; | 84 header.ssrc = kSsrc1; |
70 header.timestamp = fake_clock_.TimeInMilliseconds(); | 85 header.timestamp = rtp_timestamp(now_ms); |
71 header.numCSRCs = 2; | 86 header.numCSRCs = 2; |
72 header.arrOfCSRCs[0] = 111; | 87 header.arrOfCSRCs[0] = kCsrc1; |
73 header.arrOfCSRCs[1] = 222; | 88 header.arrOfCSRCs[1] = kCsrc2; |
74 PayloadUnion payload_specific = {AudioPayload()}; | 89 PayloadUnion payload_specific = {AudioPayload()}; |
75 bool in_order = false; | 90 bool kInOrder = true; |
Taylor Brandstetter
2017/04/10 22:35:14
kInOrder could move to the top with the other cons
| |
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; | 141 bool kInOrder = true; |
140 RtpSource source(0, 0, RtpSourceType::SSRC); | |
141 | 142 |
142 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 143 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
143 payload_specific, in_order)); | 144 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
144 auto sources = rtp_receiver_->GetSources(); | 145 auto sources = rtp_receiver_->GetSources(); |
145 ASSERT_EQ(1u, sources.size()); | 146 EXPECT_THAT(sources, UnorderedElementsAre( |
146 EXPECT_EQ(1u, sources[0].source_id()); | 147 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC))); |
147 EXPECT_EQ(cur_time, sources[0].timestamp_ms()); | |
148 | 148 |
149 // The SSRC is changed and the old SSRC is expected to be returned. | 149 // The SSRC is changed and the old SSRC is expected to be returned. |
150 fake_clock_.AdvanceTimeMilliseconds(100); | 150 fake_clock_.AdvanceTimeMilliseconds(100); |
151 prev_time = cur_time; | 151 prev_time_ms = now_ms; |
152 cur_time = fake_clock_.TimeInMilliseconds(); | 152 now_ms = fake_clock_.TimeInMilliseconds(); |
153 header.ssrc = 2; | 153 header.ssrc = kSsrc2; |
154 header.timestamp = cur_time; | 154 header.timestamp = rtp_timestamp(now_ms); |
155 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 155 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
156 payload_specific, in_order)); | 156 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
157 sources = rtp_receiver_->GetSources(); | 157 sources = rtp_receiver_->GetSources(); |
158 ASSERT_EQ(2u, sources.size()); | 158 EXPECT_THAT(sources, UnorderedElementsAre( |
159 ASSERT_TRUE(FindSourceByIdAndType(sources, 2u, RtpSourceType::SSRC, &source)); | 159 RtpSource(prev_time_ms, kSsrc1, RtpSourceType::SSRC), |
160 EXPECT_EQ(cur_time, source.timestamp_ms()); | 160 RtpSource(now_ms, kSsrc2, RtpSourceType::SSRC))); |
161 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | |
162 EXPECT_EQ(prev_time, source.timestamp_ms()); | |
163 | 161 |
164 // The SSRC is changed again and happen to be changed back to 1. No | 162 // The SSRC is changed again and happen to be changed back to 1. No |
165 // duplication is expected. | 163 // duplication is expected. |
166 fake_clock_.AdvanceTimeMilliseconds(100); | 164 fake_clock_.AdvanceTimeMilliseconds(100); |
167 header.ssrc = 1; | 165 header.ssrc = kSsrc1; |
168 header.timestamp = cur_time; | 166 header.timestamp = rtp_timestamp(now_ms); |
169 prev_time = cur_time; | 167 prev_time_ms = now_ms; |
170 cur_time = fake_clock_.TimeInMilliseconds(); | 168 now_ms = fake_clock_.TimeInMilliseconds(); |
171 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 169 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
172 payload_specific, in_order)); | 170 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
173 sources = rtp_receiver_->GetSources(); | 171 sources = rtp_receiver_->GetSources(); |
174 ASSERT_EQ(2u, sources.size()); | 172 EXPECT_THAT(sources, UnorderedElementsAre( |
175 ASSERT_TRUE(FindSourceByIdAndType(sources, 1u, RtpSourceType::SSRC, &source)); | 173 RtpSource(prev_time_ms, kSsrc2, RtpSourceType::SSRC), |
176 EXPECT_EQ(cur_time, source.timestamp_ms()); | 174 RtpSource(now_ms, kSsrc1, RtpSourceType::SSRC))); |
Zhi Huang
2017/04/10 21:29:48
It's true that this looks much cleaner but my conc
Taylor Brandstetter
2017/04/10 22:35:14
It actually does print a pretty detailed message.
| |
177 ASSERT_TRUE(FindSourceByIdAndType(sources, 2u, RtpSourceType::SSRC, &source)); | |
178 EXPECT_EQ(prev_time, source.timestamp_ms()); | |
179 | 175 |
180 // Old SSRC source timeout. | 176 // Old SSRC source timeout. |
181 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); | 177 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); |
182 cur_time = fake_clock_.TimeInMilliseconds(); | 178 now_ms = fake_clock_.TimeInMilliseconds(); |
183 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 179 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
184 payload_specific, in_order)); | 180 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
185 sources = rtp_receiver_->GetSources(); | 181 sources = rtp_receiver_->GetSources(); |
186 ASSERT_EQ(1u, sources.size()); | 182 EXPECT_THAT(sources, UnorderedElementsAre( |
187 EXPECT_EQ(1u, sources[0].source_id()); | 183 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 } | 184 } |
191 | 185 |
192 TEST_F(RtpReceiverTest, GetSourcesRemoveOutdatedSource) { | 186 TEST_F(RtpReceiverTest, GetSourcesRemoveOutdatedSource) { |
193 int64_t timestamp = fake_clock_.TimeInMilliseconds(); | 187 int64_t now_ms = fake_clock_.TimeInMilliseconds(); |
194 bool in_order = false; | 188 |
195 RTPHeader header; | 189 RTPHeader header; |
196 header.payloadType = kPcmuPayloadType; | 190 header.payloadType = kPcmuPayloadType; |
197 header.timestamp = timestamp; | 191 header.timestamp = rtp_timestamp(now_ms); |
198 PayloadUnion payload_specific = {AudioPayload()}; | 192 PayloadUnion payload_specific = {AudioPayload()}; |
199 header.numCSRCs = 1; | 193 header.numCSRCs = 1; |
200 RtpSource source(0, 0, RtpSourceType::SSRC); | 194 bool kInOrder = true; |
195 size_t kSourceListSize = 20; | |
201 | 196 |
202 for (size_t i = 0; i < kSourceListsSize; ++i) { | 197 for (size_t i = 0; i < kSourceListSize; ++i) { |
203 header.ssrc = i; | 198 header.ssrc = i; |
204 header.arrOfCSRCs[0] = (i + 1); | 199 header.arrOfCSRCs[0] = (i + 1); |
Zhi Huang
2017/04/10 21:29:48
This is just an arbitrary number and it doesn't ha
| |
205 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 200 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, |
206 payload_specific, in_order)); | 201 sizeof(kTestPayload), |
202 payload_specific, !kInOrder)); | |
207 } | 203 } |
208 | 204 |
205 RtpSource source(0, 0, RtpSourceType::SSRC); | |
209 auto sources = rtp_receiver_->GetSources(); | 206 auto sources = rtp_receiver_->GetSources(); |
210 // Expect |kSourceListsSize| SSRC sources and |kSourceListsSize| CSRC sources. | 207 // Expect |kSourceListSize| SSRC sources and |kSourceListSize| CSRC sources. |
211 ASSERT_TRUE(sources.size() == 2 * kSourceListsSize); | 208 ASSERT_TRUE(sources.size() == 2 * kSourceListSize); |
danilchap
2017/04/11 07:48:32
ASSERT_EQ
| |
212 for (size_t i = 0; i < kSourceListsSize; ++i) { | 209 for (size_t i = 0; i < kSourceListSize; ++i) { |
213 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 | 210 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 |
214 ASSERT_TRUE( | 211 ASSERT_TRUE( |
215 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); | 212 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); |
216 EXPECT_EQ(timestamp, source.timestamp_ms()); | 213 EXPECT_EQ(now_ms, source.timestamp_ms()); |
217 | 214 |
218 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 | 215 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 |
219 ASSERT_TRUE( | 216 ASSERT_TRUE( |
220 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); | 217 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); |
221 EXPECT_EQ(timestamp, source.timestamp_ms()); | 218 EXPECT_EQ(now_ms, source.timestamp_ms()); |
222 } | 219 } |
223 | 220 |
224 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); | 221 fake_clock_.AdvanceTimeMilliseconds(kGetSourcesTimeoutMs); |
225 for (size_t i = 0; i < kSourceListsSize; ++i) { | 222 for (size_t i = 0; i < kSourceListSize; ++i) { |
226 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 | 223 // The SSRC source IDs are expected to be 19, 18, 17 ... 0 |
227 ASSERT_TRUE( | 224 ASSERT_TRUE( |
228 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); | 225 FindSourceByIdAndType(sources, i, RtpSourceType::SSRC, &source)); |
229 EXPECT_EQ(timestamp, source.timestamp_ms()); | 226 EXPECT_EQ(now_ms, source.timestamp_ms()); |
230 | 227 |
231 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 | 228 // The CSRC source IDs are expected to be 20, 19, 18 ... 1 |
232 ASSERT_TRUE( | 229 ASSERT_TRUE( |
233 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); | 230 FindSourceByIdAndType(sources, (i + 1), RtpSourceType::CSRC, &source)); |
234 EXPECT_EQ(timestamp, source.timestamp_ms()); | 231 EXPECT_EQ(now_ms, source.timestamp_ms()); |
235 } | 232 } |
236 | 233 |
237 // Timeout. All the existing objects are out of date and are expected to be | 234 // Timeout. All the existing objects are out of date and are expected to be |
238 // removed. | 235 // removed. |
239 fake_clock_.AdvanceTimeMilliseconds(1); | 236 fake_clock_.AdvanceTimeMilliseconds(1); |
240 header.ssrc = 111; | 237 header.ssrc = kSsrc1; |
241 header.arrOfCSRCs[0] = 222; | 238 header.arrOfCSRCs[0] = kCsrc1; |
242 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, kTestPayload, 4, | 239 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( |
243 payload_specific, in_order)); | 240 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); |
244 auto rtp_receiver_impl = static_cast<RtpReceiverImpl*>(rtp_receiver_.get()); | 241 auto rtp_receiver_impl = static_cast<RtpReceiverImpl*>(rtp_receiver_.get()); |
245 auto ssrc_sources = rtp_receiver_impl->ssrc_sources_for_testing(); | 242 auto ssrc_sources = rtp_receiver_impl->ssrc_sources_for_testing(); |
246 ASSERT_EQ(1u, ssrc_sources.size()); | 243 ASSERT_EQ(1u, ssrc_sources.size()); |
247 EXPECT_EQ(111u, ssrc_sources.begin()->source_id()); | 244 EXPECT_EQ(kSsrc1, ssrc_sources.begin()->source_id()); |
248 EXPECT_EQ(RtpSourceType::SSRC, ssrc_sources.begin()->source_type()); | 245 EXPECT_EQ(RtpSourceType::SSRC, ssrc_sources.begin()->source_type()); |
249 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), | 246 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), |
250 ssrc_sources.begin()->timestamp_ms()); | 247 ssrc_sources.begin()->timestamp_ms()); |
251 | 248 |
252 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); | 249 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); |
253 ASSERT_EQ(1u, csrc_sources.size()); | 250 ASSERT_EQ(1u, csrc_sources.size()); |
254 EXPECT_EQ(222u, csrc_sources.begin()->source_id()); | 251 EXPECT_EQ(kCsrc1, csrc_sources.begin()->source_id()); |
255 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); | 252 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); |
256 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), | 253 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), |
257 csrc_sources.begin()->timestamp_ms()); | 254 csrc_sources.begin()->timestamp_ms()); |
258 } | 255 } |
259 | 256 |
260 } // namespace webrtc | 257 } // namespace webrtc |
OLD | NEW |