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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 ADD_FAILURE() << "Unexpected RTCP sent."; | 73 ADD_FAILURE() << "Unexpected RTCP sent."; |
74 return false; | 74 return false; |
75 } | 75 } |
76 }; | 76 }; |
77 | 77 |
78 void DecodesRetransmittedFrame(bool use_rtx, bool use_red); | 78 void DecodesRetransmittedFrame(bool use_rtx, bool use_red); |
79 void ReceivesPliAndRecovers(int rtp_history_ms); | 79 void ReceivesPliAndRecovers(int rtp_history_ms); |
80 void RespectsRtcpMode(RtcpMode rtcp_mode); | 80 void RespectsRtcpMode(RtcpMode rtcp_mode); |
81 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); | 81 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); |
82 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); | 82 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); |
83 void TestRtpStatePreservation(bool use_rtx); | 83 void TestRtpStatePreservation(bool use_rtx, bool wait_rtcp); |
84 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); | 84 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); |
85 }; | 85 }; |
86 | 86 |
87 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { | 87 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { |
88 CreateCalls(Call::Config(), Call::Config()); | 88 CreateCalls(Call::Config(), Call::Config()); |
89 | 89 |
90 test::NullTransport transport; | 90 test::NullTransport transport; |
91 CreateSendConfig(1, 0, &transport); | 91 CreateSendConfig(1, 0, &transport); |
92 CreateMatchingReceiveConfigs(&transport); | 92 CreateMatchingReceiveConfigs(&transport); |
93 | 93 |
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2929 | 2929 |
2930 private: | 2930 private: |
2931 size_t ssrcs_to_observe_; | 2931 size_t ssrcs_to_observe_; |
2932 std::map<uint32_t, bool> observed_redundant_retransmission_; | 2932 std::map<uint32_t, bool> observed_redundant_retransmission_; |
2933 std::map<uint32_t, bool> registered_rtx_ssrc_; | 2933 std::map<uint32_t, bool> registered_rtx_ssrc_; |
2934 } test; | 2934 } test; |
2935 | 2935 |
2936 RunBaseTest(&test); | 2936 RunBaseTest(&test); |
2937 } | 2937 } |
2938 | 2938 |
2939 void EndToEndTest::TestRtpStatePreservation(bool use_rtx) { | 2939 void EndToEndTest::TestRtpStatePreservation(bool use_rtx, bool wait_rtcp) { |
2940 static const uint32_t kMaxSequenceNumberGap = 100; | 2940 static const uint32_t kMaxSequenceNumberGap = 100; |
2941 class RtpSequenceObserver : public test::RtpRtcpObserver { | 2941 class RtpSequenceObserver : public test::RtpRtcpObserver { |
2942 public: | 2942 public: |
2943 explicit RtpSequenceObserver(bool use_rtx) | 2943 explicit RtpSequenceObserver(bool use_rtx) |
2944 : test::RtpRtcpObserver(kDefaultTimeoutMs), | 2944 : test::RtpRtcpObserver(kDefaultTimeoutMs), |
2945 ssrcs_to_observe_(kNumSsrcs) { | 2945 ssrcs_to_observe_(kNumSsrcs) { |
2946 for (size_t i = 0; i < kNumSsrcs; ++i) { | 2946 for (size_t i = 0; i < kNumSsrcs; ++i) { |
2947 configured_ssrcs_[kVideoSendSsrcs[i]] = true; | 2947 configured_ssrcs_[kVideoSendSsrcs[i]] = true; |
2948 if (use_rtx) | 2948 if (use_rtx) |
2949 configured_ssrcs_[kSendRtxSsrcs[i]] = true; | 2949 configured_ssrcs_[kSendRtxSsrcs[i]] = true; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3098 // Test stream resetting more than once to make sure that the state doesn't | 3098 // Test stream resetting more than once to make sure that the state doesn't |
3099 // get set once (this could be due to using std::map::insert for instance). | 3099 // get set once (this could be due to using std::map::insert for instance). |
3100 for (size_t i = 0; i < 3; ++i) { | 3100 for (size_t i = 0; i < 3; ++i) { |
3101 frame_generator_capturer_->Stop(); | 3101 frame_generator_capturer_->Stop(); |
3102 sender_call_->DestroyVideoSendStream(video_send_stream_); | 3102 sender_call_->DestroyVideoSendStream(video_send_stream_); |
3103 | 3103 |
3104 // Re-create VideoSendStream with only one stream. | 3104 // Re-create VideoSendStream with only one stream. |
3105 video_send_stream_ = | 3105 video_send_stream_ = |
3106 sender_call_->CreateVideoSendStream(video_send_config_, one_stream); | 3106 sender_call_->CreateVideoSendStream(video_send_config_, one_stream); |
3107 video_send_stream_->Start(); | 3107 video_send_stream_->Start(); |
3108 if (wait_rtcp) { | |
3109 // Wait for SR rtcp packet before generating rtp packets. | |
stefan-webrtc
2016/02/01 17:32:07
I'm not sure I understand this test change. How ca
danilchap
2016/02/01 18:24:18
RTP packets will not be send until FrameGeneratorC
| |
3110 // There should be no rtcp packet or its time should be in sync with rtp. | |
3111 | |
3112 // Rapid Resync Request forces sending RTCP Sender Report back. | |
3113 // Alternative approach is to wait several seconds for SR to be generated. | |
3114 // TODO(danilchap): Create rtcp packet with dedicated class when it lands. | |
3115 const uint8_t kPacket[] = {0x85, 205, 0x00, 0x02, 0, 0, 0, 0, 0, 0, 0, 0}; | |
3116 video_send_stream_->DeliverRtcp(kPacket, sizeof(kPacket)); | |
3117 } | |
3108 CreateFrameGeneratorCapturer(); | 3118 CreateFrameGeneratorCapturer(); |
3109 frame_generator_capturer_->Start(); | 3119 frame_generator_capturer_->Start(); |
3110 | 3120 |
3111 observer.ResetExpectedSsrcs(1); | 3121 observer.ResetExpectedSsrcs(1); |
3112 EXPECT_TRUE(observer.Wait()) << "Timed out waiting for single RTP packet."; | 3122 EXPECT_TRUE(observer.Wait()) << "Timed out waiting for single RTP packet."; |
3113 | 3123 |
3114 // Reconfigure back to use all streams. | 3124 // Reconfigure back to use all streams. |
3115 video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_); | 3125 video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_); |
3116 observer.ResetExpectedSsrcs(kNumSsrcs); | 3126 observer.ResetExpectedSsrcs(kNumSsrcs); |
3117 EXPECT_TRUE(observer.Wait()) | 3127 EXPECT_TRUE(observer.Wait()) |
(...skipping 12 matching lines...) Expand all Loading... | |
3130 } | 3140 } |
3131 | 3141 |
3132 send_transport.StopSending(); | 3142 send_transport.StopSending(); |
3133 receive_transport.StopSending(); | 3143 receive_transport.StopSending(); |
3134 | 3144 |
3135 Stop(); | 3145 Stop(); |
3136 DestroyStreams(); | 3146 DestroyStreams(); |
3137 } | 3147 } |
3138 | 3148 |
3139 TEST_F(EndToEndTest, DISABLED_RestartingSendStreamPreservesRtpState) { | 3149 TEST_F(EndToEndTest, DISABLED_RestartingSendStreamPreservesRtpState) { |
3140 TestRtpStatePreservation(false); | 3150 TestRtpStatePreservation(false, false); |
3141 } | 3151 } |
3142 | 3152 |
3143 TEST_F(EndToEndTest, RestartingSendStreamPreservesRtpStatesWithRtx) { | 3153 TEST_F(EndToEndTest, RestartingSendStreamPreservesRtpStatesWithRtx) { |
3144 TestRtpStatePreservation(true); | 3154 TestRtpStatePreservation(true, false); |
3155 } | |
3156 | |
3157 TEST_F(EndToEndTest, RestartingSendStreamKeepsRtpAndRtcpTimestampsSynced) { | |
3158 TestRtpStatePreservation(true, true); | |
3145 } | 3159 } |
3146 | 3160 |
3147 TEST_F(EndToEndTest, RespectsNetworkState) { | 3161 TEST_F(EndToEndTest, RespectsNetworkState) { |
3148 // TODO(pbos): Remove accepted downtime packets etc. when signaling network | 3162 // TODO(pbos): Remove accepted downtime packets etc. when signaling network |
3149 // down blocks until no more packets will be sent. | 3163 // down blocks until no more packets will be sent. |
3150 | 3164 |
3151 // Pacer will send from its packet list and then send required padding before | 3165 // Pacer will send from its packet list and then send required padding before |
3152 // checking paused_ again. This should be enough for one round of pacing, | 3166 // checking paused_ again. This should be enough for one round of pacing, |
3153 // otherwise increase. | 3167 // otherwise increase. |
3154 static const int kNumAcceptedDowntimeRtp = 5; | 3168 static const int kNumAcceptedDowntimeRtp = 5; |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3520 private: | 3534 private: |
3521 bool video_observed_; | 3535 bool video_observed_; |
3522 bool audio_observed_; | 3536 bool audio_observed_; |
3523 SequenceNumberUnwrapper unwrapper_; | 3537 SequenceNumberUnwrapper unwrapper_; |
3524 std::set<int64_t> received_packet_ids_; | 3538 std::set<int64_t> received_packet_ids_; |
3525 } test; | 3539 } test; |
3526 | 3540 |
3527 RunBaseTest(&test); | 3541 RunBaseTest(&test); |
3528 } | 3542 } |
3529 } // namespace webrtc | 3543 } // namespace webrtc |
OLD | NEW |