Chromium Code Reviews| 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 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 ssrc_sources.begin()->timestamp_ms()); | 248 ssrc_sources.begin()->timestamp_ms()); |
| 249 | 249 |
| 250 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); | 250 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); |
| 251 ASSERT_EQ(1u, csrc_sources.size()); | 251 ASSERT_EQ(1u, csrc_sources.size()); |
| 252 EXPECT_EQ(kCsrc1, csrc_sources.begin()->source_id()); | 252 EXPECT_EQ(kCsrc1, csrc_sources.begin()->source_id()); |
| 253 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); | 253 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); |
| 254 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), | 254 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), |
| 255 csrc_sources.begin()->timestamp_ms()); | 255 csrc_sources.begin()->timestamp_ms()); |
| 256 } | 256 } |
| 257 | 257 |
| 258 // The audio level from the RTPHeader extension should be stored in the | |
| 259 // RTPSource with the matching SSRC. | |
| 260 TEST_F(RtpReceiverTest, GetSourcesContainsAudioLevelExtension) { | |
| 261 RTPHeader header; | |
| 262 int64_t time1_ms = fake_clock_.TimeInMilliseconds(); | |
| 263 header.payloadType = kPcmuPayloadType; | |
| 264 header.ssrc = kSsrc1; | |
| 265 header.timestamp = rtp_timestamp(time1_ms); | |
| 266 header.extension.hasAudioLevel = true; | |
| 267 header.extension.audioLevel = 10; | |
| 268 PayloadUnion payload_specific = {AudioPayload()}; | |
| 269 | |
| 270 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( | |
| 271 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); | |
| 272 auto sources = rtp_receiver_->GetSources(); | |
| 273 EXPECT_THAT(sources, UnorderedElementsAre(RtpSource( | |
|
danilchap
2017/08/15 08:18:29
ASSERT_THAT
otherwise next line might crash if thi
Zach Stein
2017/08/15 21:44:59
The following line is actually redundant with this
| |
| 274 time1_ms, kSsrc1, RtpSourceType::SSRC, 10))); | |
| 275 ASSERT_EQ(rtc::Optional<uint8_t>(10), sources.begin()->audio_level()); | |
|
danilchap
2017/08/15 08:18:29
there is a compare operator between optional<T> an
Zach Stein
2017/08/15 21:44:59
Acknowledged.
| |
| 276 | |
| 277 fake_clock_.AdvanceTimeMilliseconds(1); | |
| 278 int64_t time2_ms = fake_clock_.TimeInMilliseconds(); | |
| 279 header.ssrc = kSsrc2; | |
| 280 header.timestamp = rtp_timestamp(time2_ms); | |
| 281 header.extension.hasAudioLevel = true; | |
| 282 header.extension.audioLevel = 20; | |
| 283 | |
| 284 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( | |
| 285 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); | |
| 286 sources = rtp_receiver_->GetSources(); | |
| 287 EXPECT_THAT(sources, | |
| 288 UnorderedElementsAre( | |
| 289 RtpSource(time1_ms, kSsrc1, RtpSourceType::SSRC, 10), | |
| 290 RtpSource(time2_ms, kSsrc2, RtpSourceType::SSRC, 20))); | |
| 291 | |
| 292 fake_clock_.AdvanceTimeMilliseconds(1); | |
| 293 int64_t time3_ms = fake_clock_.TimeInMilliseconds(); | |
| 294 header.ssrc = kSsrc1; | |
| 295 header.timestamp = rtp_timestamp(time3_ms); | |
| 296 header.extension.hasAudioLevel = true; | |
| 297 header.extension.audioLevel = 30; | |
| 298 | |
| 299 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket( | |
| 300 header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder)); | |
| 301 sources = rtp_receiver_->GetSources(); | |
| 302 EXPECT_THAT(sources, | |
| 303 UnorderedElementsAre( | |
| 304 RtpSource(time3_ms, kSsrc1, RtpSourceType::SSRC, 30), | |
| 305 RtpSource(time2_ms, kSsrc2, RtpSourceType::SSRC, 20))); | |
| 306 } | |
| 307 | |
|
danilchap
2017/08/15 08:18:29
may be add a test that absent of audio level exten
Zach Stein
2017/08/15 21:44:59
Done.
| |
| 258 } // namespace webrtc | 308 } // namespace webrtc |
| OLD | NEW |