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> |
| 12 |
11 #include "webrtc/base/criticalsection.h" | 13 #include "webrtc/base/criticalsection.h" |
12 #include "webrtc/system_wrappers/include/atomic32.h" | 14 #include "webrtc/system_wrappers/include/atomic32.h" |
13 #include "webrtc/system_wrappers/include/event_wrapper.h" | 15 #include "webrtc/system_wrappers/include/event_wrapper.h" |
14 #include "webrtc/test/testsupport/fileutils.h" | 16 #include "webrtc/test/testsupport/fileutils.h" |
15 #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" |
16 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h" | 18 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h" |
17 | 19 |
18 class TestRtpObserver : public webrtc::VoERTPObserver { | 20 class TestRtpObserver : public webrtc::VoERTPObserver { |
19 public: | 21 public: |
20 TestRtpObserver() : changed_ssrc_event_(voetest::EventWrapper::Create()) {} | 22 TestRtpObserver() : changed_ssrc_event_(voetest::EventWrapper::Create()) {} |
21 virtual ~TestRtpObserver() {} | 23 virtual ~TestRtpObserver() {} |
22 virtual void OnIncomingCSRCChanged(int channel, | 24 virtual void OnIncomingCSRCChanged(int channel, |
23 unsigned int CSRC, | 25 unsigned int CSRC, |
24 bool added) {} | 26 bool added) {} |
25 virtual void OnIncomingSSRCChanged(int channel, | 27 virtual void OnIncomingSSRCChanged(int channel, |
26 unsigned int SSRC); | 28 unsigned int SSRC); |
27 void WaitForChangedSsrc() { | 29 void WaitForChangedSsrc() { |
28 // 10 seconds should be enough. | 30 // 10 seconds should be enough. |
29 EXPECT_EQ(voetest::kEventSignaled, changed_ssrc_event_->Wait(10*1000)); | 31 EXPECT_EQ(voetest::kEventSignaled, changed_ssrc_event_->Wait(10*1000)); |
30 } | 32 } |
31 void SetIncomingSsrc(unsigned int ssrc) { | 33 void SetIncomingSsrc(unsigned int ssrc) { |
32 rtc::CritScope lock(&crit_); | 34 rtc::CritScope lock(&crit_); |
33 incoming_ssrc_ = ssrc; | 35 incoming_ssrc_ = ssrc; |
34 } | 36 } |
35 public: | 37 public: |
36 rtc::CriticalSection crit_; | 38 rtc::CriticalSection crit_; |
37 unsigned int incoming_ssrc_; | 39 unsigned int incoming_ssrc_; |
38 rtc::scoped_ptr<voetest::EventWrapper> changed_ssrc_event_; | 40 std::unique_ptr<voetest::EventWrapper> changed_ssrc_event_; |
39 }; | 41 }; |
40 | 42 |
41 void TestRtpObserver::OnIncomingSSRCChanged(int channel, | 43 void TestRtpObserver::OnIncomingSSRCChanged(int channel, |
42 unsigned int SSRC) { | 44 unsigned int SSRC) { |
43 char msg[128]; | 45 char msg[128]; |
44 sprintf(msg, "\n=> OnIncomingSSRCChanged(channel=%d, SSRC=%u)\n", channel, | 46 sprintf(msg, "\n=> OnIncomingSSRCChanged(channel=%d, SSRC=%u)\n", channel, |
45 SSRC); | 47 SSRC); |
46 TEST_LOG("%s", msg); | 48 TEST_LOG("%s", msg); |
47 | 49 |
48 { | 50 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 109 |
108 Sleep(1000); | 110 Sleep(1000); |
109 | 111 |
110 unsigned int ssrc; | 112 unsigned int ssrc; |
111 EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, ssrc)); | 113 EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, ssrc)); |
112 EXPECT_EQ(local_ssrc, ssrc); | 114 EXPECT_EQ(local_ssrc, ssrc); |
113 | 115 |
114 EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); | 116 EXPECT_EQ(0, voe_rtp_rtcp_->GetRemoteSSRC(channel_, ssrc)); |
115 EXPECT_EQ(local_ssrc, ssrc); | 117 EXPECT_EQ(local_ssrc, ssrc); |
116 } | 118 } |
OLD | NEW |