| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/rtc_base/criticalsection.h" | 13 #include "webrtc/rtc_base/criticalsection.h" |
| 14 #include "webrtc/rtc_base/flags.h" |
| 14 #include "webrtc/system_wrappers/include/event_wrapper.h" | 15 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 15 #include "webrtc/test/testsupport/fileutils.h" | 16 #include "webrtc/test/testsupport/fileutils.h" |
| 16 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" | 17 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" |
| 17 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h" | 18 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h" |
| 18 | 19 |
| 20 DECLARE_bool(include_timing_dependent_tests); |
| 21 |
| 19 class TestRtpObserver : public webrtc::VoERTPObserver { | 22 class TestRtpObserver : public webrtc::VoERTPObserver { |
| 20 public: | 23 public: |
| 21 TestRtpObserver() : changed_ssrc_event_(webrtc::EventWrapper::Create()) {} | 24 TestRtpObserver() : changed_ssrc_event_(webrtc::EventWrapper::Create()) {} |
| 22 virtual ~TestRtpObserver() {} | 25 virtual ~TestRtpObserver() {} |
| 23 virtual void OnIncomingCSRCChanged(int channel, | 26 virtual void OnIncomingCSRCChanged(int channel, |
| 24 unsigned int CSRC, | 27 unsigned int CSRC, |
| 25 bool added) {} | 28 bool added) {} |
| 26 virtual void OnIncomingSSRCChanged(int channel, | 29 virtual void OnIncomingSSRCChanged(int channel, |
| 27 unsigned int SSRC); | 30 unsigned int SSRC); |
| 28 void WaitForChangedSsrc() { | 31 void WaitForChangedSsrc() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(second_channel_)); | 81 EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(second_channel_)); |
| 79 voe_base_->DeleteChannel(second_channel_); | 82 voe_base_->DeleteChannel(second_channel_); |
| 80 delete transport_; | 83 delete transport_; |
| 81 } | 84 } |
| 82 | 85 |
| 83 int second_channel_; | 86 int second_channel_; |
| 84 LoopBackTransport* transport_; | 87 LoopBackTransport* transport_; |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 TEST_F(RtpRtcpTest, RemoteRtcpCnameHasPropagatedToRemoteSide) { | 90 TEST_F(RtpRtcpTest, RemoteRtcpCnameHasPropagatedToRemoteSide) { |
| 88 if (!FLAGS_include_timing_dependent_tests) { | 91 if (!FLAG_include_timing_dependent_tests) { |
| 89 TEST_LOG("Skipping test - running in slow execution environment...\n"); | 92 TEST_LOG("Skipping test - running in slow execution environment...\n"); |
| 90 return; | 93 return; |
| 91 } | 94 } |
| 92 | 95 |
| 93 // We need to sleep a bit here for the name to propagate. For | 96 // We need to sleep a bit here for the name to propagate. For |
| 94 // instance, 200 milliseconds is not enough, 1 second still flaky, | 97 // instance, 200 milliseconds is not enough, 1 second still flaky, |
| 95 // so we'll go with five seconds here. | 98 // so we'll go with five seconds here. |
| 96 Sleep(5000); | 99 Sleep(5000); |
| 97 | 100 |
| 98 char char_buffer[256]; | 101 char char_buffer[256]; |
| 99 voe_rtp_rtcp_->GetRemoteRTCP_CNAME(channel_, char_buffer); | 102 voe_rtp_rtcp_->GetRemoteRTCP_CNAME(channel_, char_buffer); |
| 100 EXPECT_STREQ(RTCP_CNAME, char_buffer); | 103 EXPECT_STREQ(RTCP_CNAME, char_buffer); |
| 101 } | 104 } |
| 102 | 105 |
| 103 TEST_F(RtpRtcpTest, SSRCPropagatesCorrectly) { | 106 TEST_F(RtpRtcpTest, SSRCPropagatesCorrectly) { |
| 104 unsigned int local_ssrc = 1234; | 107 unsigned int local_ssrc = 1234; |
| 105 EXPECT_EQ(0, voe_base_->StopSend(channel_)); | 108 EXPECT_EQ(0, voe_base_->StopSend(channel_)); |
| 106 EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(channel_, local_ssrc)); | 109 EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(channel_, local_ssrc)); |
| 107 EXPECT_EQ(0, voe_base_->StartSend(channel_)); | 110 EXPECT_EQ(0, voe_base_->StartSend(channel_)); |
| 108 | 111 |
| 109 Sleep(1000); | 112 Sleep(1000); |
| 110 | 113 |
| 111 unsigned int ssrc; | 114 unsigned int ssrc; |
| 112 EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, ssrc)); | 115 EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, ssrc)); |
| 113 EXPECT_EQ(local_ssrc, ssrc); | 116 EXPECT_EQ(local_ssrc, ssrc); |
| 114 | 117 |
| 115 EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); | 118 EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); |
| 116 EXPECT_EQ(local_ssrc, ssrc); | 119 EXPECT_EQ(local_ssrc, ssrc); |
| 117 } | 120 } |
| OLD | NEW |