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> // max | 10 #include <algorithm> // max |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 EXPECT_EQ(kEventSignaled, Wait()) | 198 EXPECT_EQ(kEventSignaled, Wait()) |
199 << "Timed out while waiting for a single RTP packet."; | 199 << "Timed out while waiting for a single RTP packet."; |
200 } | 200 } |
201 | 201 |
202 test::DelayedEncoder encoder_; | 202 test::DelayedEncoder encoder_; |
203 } test; | 203 } test; |
204 | 204 |
205 RunBaseTest(&test); | 205 RunBaseTest(&test); |
206 } | 206 } |
207 | 207 |
| 208 TEST_F(VideoSendStreamTest, SupportsTransportWideSequenceNumbers) { |
| 209 static const uint8_t kExtensionId = 13; |
| 210 class TransportWideSequenceNumberObserver : public test::SendTest { |
| 211 public: |
| 212 TransportWideSequenceNumberObserver() |
| 213 : SendTest(kDefaultTimeoutMs), encoder_(Clock::GetRealTimeClock()) { |
| 214 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension( |
| 215 kRtpExtensionTransportSequenceNumber, kExtensionId)); |
| 216 } |
| 217 |
| 218 private: |
| 219 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 220 RTPHeader header; |
| 221 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
| 222 |
| 223 EXPECT_TRUE(header.extension.hasTransportSequenceNumber); |
| 224 EXPECT_FALSE(header.extension.hasTransmissionTimeOffset); |
| 225 EXPECT_FALSE(header.extension.hasAbsoluteSendTime); |
| 226 |
| 227 observation_complete_->Set(); |
| 228 |
| 229 return SEND_PACKET; |
| 230 } |
| 231 |
| 232 void ModifyConfigs(VideoSendStream::Config* send_config, |
| 233 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 234 VideoEncoderConfig* encoder_config) override { |
| 235 send_config->encoder_settings.encoder = &encoder_; |
| 236 send_config->rtp.extensions.push_back( |
| 237 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); |
| 238 } |
| 239 |
| 240 void PerformTest() override { |
| 241 EXPECT_EQ(kEventSignaled, Wait()) |
| 242 << "Timed out while waiting for a single RTP packet."; |
| 243 } |
| 244 |
| 245 test::FakeEncoder encoder_; |
| 246 } test; |
| 247 |
| 248 RunBaseTest(&test); |
| 249 } |
| 250 |
208 class FakeReceiveStatistics : public NullReceiveStatistics { | 251 class FakeReceiveStatistics : public NullReceiveStatistics { |
209 public: | 252 public: |
210 FakeReceiveStatistics(uint32_t send_ssrc, | 253 FakeReceiveStatistics(uint32_t send_ssrc, |
211 uint32_t last_sequence_number, | 254 uint32_t last_sequence_number, |
212 uint32_t cumulative_lost, | 255 uint32_t cumulative_lost, |
213 uint8_t fraction_lost) | 256 uint8_t fraction_lost) |
214 : lossy_stats_(new LossyStatistician(last_sequence_number, | 257 : lossy_stats_(new LossyStatistician(last_sequence_number, |
215 cumulative_lost, | 258 cumulative_lost, |
216 fraction_lost)) { | 259 fraction_lost)) { |
217 stats_map_[send_ssrc] = lossy_stats_.get(); | 260 stats_map_[send_ssrc] = lossy_stats_.get(); |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 const std::vector<VideoReceiveStream*>& receive_streams) override { | 1789 const std::vector<VideoReceiveStream*>& receive_streams) override { |
1747 send_stream_ = send_stream; | 1790 send_stream_ = send_stream; |
1748 } | 1791 } |
1749 | 1792 |
1750 VideoSendStream* send_stream_; | 1793 VideoSendStream* send_stream_; |
1751 } test; | 1794 } test; |
1752 | 1795 |
1753 RunBaseTest(&test); | 1796 RunBaseTest(&test); |
1754 } | 1797 } |
1755 } // namespace webrtc | 1798 } // namespace webrtc |
OLD | NEW |