aboutsummaryrefslogtreecommitdiff
path: root/webrtc/voice_engine/voe_base_unittest.cc
diff options
context:
space:
mode:
authorMinyue <minyue@webrtc.org>2015-05-13 14:14:42 +0200
committerMinyue <minyue@webrtc.org>2015-05-13 12:14:36 +0000
commit2013aeced2b7821a407f302802c4a16fd02728b1 (patch)
tree4f75898e8ba58eff1c143a2d6dff010a46faa17a /webrtc/voice_engine/voe_base_unittest.cc
parent070376697a4eea6d0c7f030b4553bcb9e2948474 (diff)
downloadwebrtc-2013aeced2b7821a407f302802c4a16fd02728b1.tar.gz
Propagating RTT from send-only channel to receive-only channel.
This is important for obtaining ntp time at receiver-only channel, which does not have RTT directly. BUG=3978 TEST=chromium with hangout calls R=henrika@webrtc.org, mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/29989004 Cr-Commit-Position: refs/heads/master@{#9186}
Diffstat (limited to 'webrtc/voice_engine/voe_base_unittest.cc')
-rw-r--r--webrtc/voice_engine/voe_base_unittest.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/webrtc/voice_engine/voe_base_unittest.cc b/webrtc/voice_engine/voe_base_unittest.cc
index 08b935805f..5c71784b4f 100644
--- a/webrtc/voice_engine/voe_base_unittest.cc
+++ b/webrtc/voice_engine/voe_base_unittest.cc
@@ -12,7 +12,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
+#include "webrtc/voice_engine/channel_manager.h"
+#include "webrtc/voice_engine/shared_data.h"
#include "webrtc/voice_engine/voice_engine_fixture.h"
+#include "webrtc/voice_engine/voice_engine_impl.h"
namespace webrtc {
@@ -44,4 +47,35 @@ TEST_F(VoEBaseTest, CreateChannelAfterInit) {
EXPECT_EQ(0, base_->DeleteChannel(channelID));
}
+TEST_F(VoEBaseTest, AssociateSendChannel) {
+ AudioProcessing* audioproc = AudioProcessing::Create();
+ EXPECT_EQ(0, base_->Init(&adm_, audioproc));
+
+ const int channel_1 = base_->CreateChannel();
+
+ // Associating with a channel that does not exist should fail.
+ EXPECT_EQ(-1, base_->AssociateSendChannel(channel_1, channel_1 + 1));
+
+ const int channel_2 = base_->CreateChannel();
+
+ // Let the two channels associate with each other. This is not a normal use
+ // case. Actually, circular association should be avoided in practice. This
+ // is just to test that no crash is caused.
+ EXPECT_EQ(0, base_->AssociateSendChannel(channel_1, channel_2));
+ EXPECT_EQ(0, base_->AssociateSendChannel(channel_2, channel_1));
+
+ voe::SharedData* shared_data = static_cast<voe::SharedData*>(
+ static_cast<VoiceEngineImpl*>(voe_));
+ voe::ChannelOwner reference = shared_data->channel_manager()
+ .GetChannel(channel_1);
+ EXPECT_EQ(0, base_->DeleteChannel(channel_1));
+ // Make sure that the only use of the channel-to-delete is |reference|
+ // at this point.
+ EXPECT_EQ(1, reference.use_count());
+
+ reference = shared_data->channel_manager().GetChannel(channel_2);
+ EXPECT_EQ(0, base_->DeleteChannel(channel_2));
+ EXPECT_EQ(1, reference.use_count());
+}
+
} // namespace webrtc