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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 break; | 739 break; |
740 } | 740 } |
741 return SEND_PACKET; | 741 return SEND_PACKET; |
742 } | 742 } |
743 | 743 |
744 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { | 744 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { |
745 rtc::CritScope lock_(&crit_); | 745 rtc::CritScope lock_(&crit_); |
746 if (state_ == kVerifyFecPacketNotInNackList) { | 746 if (state_ == kVerifyFecPacketNotInNackList) { |
747 test::RtcpPacketParser rtcp_parser; | 747 test::RtcpPacketParser rtcp_parser; |
748 rtcp_parser.Parse(packet, length); | 748 rtcp_parser.Parse(packet, length); |
749 std::vector<uint16_t> nacks = rtcp_parser.nack_item()->last_nack_list(); | 749 const std::vector<uint16_t>& nacks = rtcp_parser.nack()->packet_ids(); |
750 EXPECT_TRUE(std::find(nacks.begin(), nacks.end(), | 750 EXPECT_TRUE(std::find(nacks.begin(), nacks.end(), |
751 fec_sequence_number_) == nacks.end()) | 751 fec_sequence_number_) == nacks.end()) |
752 << "Got nack for FEC packet"; | 752 << "Got nack for FEC packet"; |
753 if (!nacks.empty() && | 753 if (!nacks.empty() && |
754 IsNewerSequenceNumber(nacks.back(), fec_sequence_number_)) { | 754 IsNewerSequenceNumber(nacks.back(), fec_sequence_number_)) { |
755 observation_complete_.Set(); | 755 observation_complete_.Set(); |
756 } | 756 } |
757 } | 757 } |
758 return SEND_PACKET; | 758 return SEND_PACKET; |
759 } | 759 } |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 return DROP_PACKET; | 2027 return DROP_PACKET; |
2028 } | 2028 } |
2029 VerifyStats(); | 2029 VerifyStats(); |
2030 return SEND_PACKET; | 2030 return SEND_PACKET; |
2031 } | 2031 } |
2032 | 2032 |
2033 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { | 2033 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { |
2034 rtc::CritScope lock(&crit_); | 2034 rtc::CritScope lock(&crit_); |
2035 test::RtcpPacketParser rtcp_parser; | 2035 test::RtcpPacketParser rtcp_parser; |
2036 rtcp_parser.Parse(packet, length); | 2036 rtcp_parser.Parse(packet, length); |
2037 std::vector<uint16_t> nacks = rtcp_parser.nack_item()->last_nack_list(); | 2037 const std::vector<uint16_t>& nacks = rtcp_parser.nack()->packet_ids(); |
2038 if (!nacks.empty() && std::find( | 2038 if (!nacks.empty() && std::find( |
2039 nacks.begin(), nacks.end(), dropped_rtp_packet_) != nacks.end()) { | 2039 nacks.begin(), nacks.end(), dropped_rtp_packet_) != nacks.end()) { |
2040 dropped_rtp_packet_requested_ = true; | 2040 dropped_rtp_packet_requested_ = true; |
2041 } | 2041 } |
2042 return SEND_PACKET; | 2042 return SEND_PACKET; |
2043 } | 2043 } |
2044 | 2044 |
2045 void VerifyStats() EXCLUSIVE_LOCKS_REQUIRED(&crit_) { | 2045 void VerifyStats() EXCLUSIVE_LOCKS_REQUIRED(&crit_) { |
2046 if (!dropped_rtp_packet_requested_) | 2046 if (!dropped_rtp_packet_requested_) |
2047 return; | 2047 return; |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 } | 3148 } |
3149 } | 3149 } |
3150 | 3150 |
3151 return SEND_PACKET; | 3151 return SEND_PACKET; |
3152 } | 3152 } |
3153 | 3153 |
3154 Action OnSendRtcp(const uint8_t* packet, size_t length) override { | 3154 Action OnSendRtcp(const uint8_t* packet, size_t length) override { |
3155 test::RtcpPacketParser rtcp_parser; | 3155 test::RtcpPacketParser rtcp_parser; |
3156 rtcp_parser.Parse(packet, length); | 3156 rtcp_parser.Parse(packet, length); |
3157 if (rtcp_parser.sender_report()->num_packets() > 0) { | 3157 if (rtcp_parser.sender_report()->num_packets() > 0) { |
3158 uint32_t ssrc = rtcp_parser.sender_report()->Ssrc(); | 3158 uint32_t ssrc = rtcp_parser.sender_report()->sender_ssrc(); |
3159 uint32_t rtcp_timestamp = rtcp_parser.sender_report()->RtpTimestamp(); | 3159 uint32_t rtcp_timestamp = rtcp_parser.sender_report()->rtp_timestamp(); |
3160 | 3160 |
3161 rtc::CritScope lock(&crit_); | 3161 rtc::CritScope lock(&crit_); |
3162 ValidateTimestampGap(ssrc, rtcp_timestamp, false); | 3162 ValidateTimestampGap(ssrc, rtcp_timestamp, false); |
3163 } | 3163 } |
3164 return SEND_PACKET; | 3164 return SEND_PACKET; |
3165 } | 3165 } |
3166 | 3166 |
3167 SequenceNumberUnwrapper seq_numbers_unwrapper_; | 3167 SequenceNumberUnwrapper seq_numbers_unwrapper_; |
3168 std::map<uint32_t, std::list<int64_t>> last_observed_seq_numbers_; | 3168 std::map<uint32_t, std::list<int64_t>> last_observed_seq_numbers_; |
3169 std::map<uint32_t, uint32_t> last_observed_timestamp_; | 3169 std::map<uint32_t, uint32_t> last_observed_timestamp_; |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3734 private: | 3734 private: |
3735 bool video_observed_; | 3735 bool video_observed_; |
3736 bool audio_observed_; | 3736 bool audio_observed_; |
3737 SequenceNumberUnwrapper unwrapper_; | 3737 SequenceNumberUnwrapper unwrapper_; |
3738 std::set<int64_t> received_packet_ids_; | 3738 std::set<int64_t> received_packet_ids_; |
3739 } test; | 3739 } test; |
3740 | 3740 |
3741 RunBaseTest(&test); | 3741 RunBaseTest(&test); |
3742 } | 3742 } |
3743 } // namespace webrtc | 3743 } // namespace webrtc |
OLD | NEW |