| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 rtp_packets_sent_(0) { | 54 rtp_packets_sent_(0) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) { | 57 void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) { |
| 58 receiver_ = receiver; | 58 receiver_ = receiver; |
| 59 } | 59 } |
| 60 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { | 60 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { |
| 61 clock_ = clock; | 61 clock_ = clock; |
| 62 delay_ms_ = delay_ms; | 62 delay_ms_ = delay_ms; |
| 63 } | 63 } |
| 64 int SendPacket(const void* data, size_t len) override { | 64 bool SendRtp(const uint8_t* data, size_t len) override { |
| 65 RTPHeader header; | 65 RTPHeader header; |
| 66 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 66 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
| 67 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); | 67 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); |
| 68 ++rtp_packets_sent_; | 68 ++rtp_packets_sent_; |
| 69 last_rtp_header_ = header; | 69 last_rtp_header_ = header; |
| 70 return static_cast<int>(len); | 70 return true; |
| 71 } | 71 } |
| 72 int SendRTCPPacket(const void* data, size_t len) override { | 72 bool SendRtcp(const uint8_t* data, size_t len) override { |
| 73 test::RtcpPacketParser parser; | 73 test::RtcpPacketParser parser; |
| 74 parser.Parse(static_cast<const uint8_t*>(data), len); | 74 parser.Parse(static_cast<const uint8_t*>(data), len); |
| 75 last_nack_list_ = parser.nack_item()->last_nack_list(); | 75 last_nack_list_ = parser.nack_item()->last_nack_list(); |
| 76 | 76 |
| 77 if (clock_) { | 77 if (clock_) { |
| 78 clock_->AdvanceTimeMilliseconds(delay_ms_); | 78 clock_->AdvanceTimeMilliseconds(delay_ms_); |
| 79 } | 79 } |
| 80 EXPECT_TRUE(receiver_ != NULL); | 80 EXPECT_TRUE(receiver_ != NULL); |
| 81 EXPECT_EQ(0, receiver_->IncomingRtcpPacket( | 81 EXPECT_EQ(0, receiver_->IncomingRtcpPacket( |
| 82 static_cast<const uint8_t*>(data), len)); | 82 static_cast<const uint8_t*>(data), len)); |
| 83 return static_cast<int>(len); | 83 return true; |
| 84 } | 84 } |
| 85 ModuleRtpRtcpImpl* receiver_; | 85 ModuleRtpRtcpImpl* receiver_; |
| 86 SimulatedClock* clock_; | 86 SimulatedClock* clock_; |
| 87 int64_t delay_ms_; | 87 int64_t delay_ms_; |
| 88 int rtp_packets_sent_; | 88 int rtp_packets_sent_; |
| 89 RTPHeader last_rtp_header_; | 89 RTPHeader last_rtp_header_; |
| 90 std::vector<uint16_t> last_nack_list_; | 90 std::vector<uint16_t> last_nack_list_; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 class RtpRtcpModule : public RtcpPacketTypeCounterObserver { | 93 class RtpRtcpModule : public RtcpPacketTypeCounterObserver { |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); | 515 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); |
| 516 | 516 |
| 517 // Send module receives the request. | 517 // Send module receives the request. |
| 518 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); | 518 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); |
| 519 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); | 519 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); |
| 520 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); | 520 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); |
| 521 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); | 521 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace webrtc | 524 } // namespace webrtc |
| OLD | NEW |