| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 rtp_packets_sent_(0) { | 55 rtp_packets_sent_(0) { |
| 56 } | 56 } |
| 57 | 57 |
| 58 void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) { | 58 void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) { |
| 59 receiver_ = receiver; | 59 receiver_ = receiver; |
| 60 } | 60 } |
| 61 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { | 61 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { |
| 62 clock_ = clock; | 62 clock_ = clock; |
| 63 delay_ms_ = delay_ms; | 63 delay_ms_ = delay_ms; |
| 64 } | 64 } |
| 65 int SendPacket(int /*ch*/, const void* data, size_t len) override { | 65 int SendPacket(const void* data, size_t len) override { |
| 66 RTPHeader header; | 66 RTPHeader header; |
| 67 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 67 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
| 68 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); | 68 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); |
| 69 ++rtp_packets_sent_; | 69 ++rtp_packets_sent_; |
| 70 last_rtp_header_ = header; | 70 last_rtp_header_ = header; |
| 71 return static_cast<int>(len); | 71 return static_cast<int>(len); |
| 72 } | 72 } |
| 73 int SendRTCPPacket(int /*ch*/, const void* data, size_t len) override { | 73 int SendRTCPPacket(const void* data, size_t len) override { |
| 74 test::RtcpPacketParser parser; | 74 test::RtcpPacketParser parser; |
| 75 parser.Parse(static_cast<const uint8_t*>(data), len); | 75 parser.Parse(static_cast<const uint8_t*>(data), len); |
| 76 last_nack_list_ = parser.nack_item()->last_nack_list(); | 76 last_nack_list_ = parser.nack_item()->last_nack_list(); |
| 77 | 77 |
| 78 if (clock_) { | 78 if (clock_) { |
| 79 clock_->AdvanceTimeMilliseconds(delay_ms_); | 79 clock_->AdvanceTimeMilliseconds(delay_ms_); |
| 80 } | 80 } |
| 81 EXPECT_TRUE(receiver_ != NULL); | 81 EXPECT_TRUE(receiver_ != NULL); |
| 82 EXPECT_EQ(0, receiver_->IncomingRtcpPacket( | 82 EXPECT_EQ(0, receiver_->IncomingRtcpPacket( |
| 83 static_cast<const uint8_t*>(data), len)); | 83 static_cast<const uint8_t*>(data), len)); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); | 516 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); |
| 517 | 517 |
| 518 // Send module receives the request. | 518 // Send module receives the request. |
| 519 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); | 519 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); |
| 520 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); | 520 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); |
| 521 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); | 521 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); |
| 522 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); | 522 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); |
| 523 } | 523 } |
| 524 | 524 |
| 525 } // namespace webrtc | 525 } // namespace webrtc |
| OLD | NEW |