Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: talk/media/webrtc/webrtcvoiceengine_unittest.cc

Issue 1388733002: Remove default receive channel from WVoE; baby step 2. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@wvoe_default_rch_a
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2008 Google Inc. 3 * Copyright 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); 2849 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
2850 } 2850 }
2851 2851
2852 // Test that GetReceiveChannelId returns the default channel for the first 2852 // Test that GetReceiveChannelId returns the default channel for the first
2853 // recv stream in 1-1 calls. 2853 // recv stream in 1-1 calls.
2854 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelIdIn1To1Calls) { 2854 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelIdIn1To1Calls) {
2855 EXPECT_TRUE(SetupEngine()); 2855 EXPECT_TRUE(SetupEngine());
2856 cricket::WebRtcVoiceMediaChannel* media_channel = 2856 cricket::WebRtcVoiceMediaChannel* media_channel =
2857 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 2857 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
2858 // Test that GetChannelNum returns the default channel if the SSRC is unknown. 2858 // Test that GetChannelNum returns the default channel if the SSRC is unknown.
2859 EXPECT_EQ(media_channel->voe_channel(), 2859 EXPECT_EQ(media_channel->default_send_channel_id(),
2860 media_channel->GetReceiveChannelId(0)); 2860 media_channel->GetReceiveChannelId(0));
2861 cricket::StreamParams stream; 2861 cricket::StreamParams stream;
2862 stream.ssrcs.push_back(kSsrc2); 2862 stream.ssrcs.push_back(kSsrc2);
2863 EXPECT_TRUE(channel_->AddRecvStream(stream)); 2863 EXPECT_TRUE(channel_->AddRecvStream(stream));
2864 EXPECT_EQ(media_channel->voe_channel(), 2864 EXPECT_EQ(media_channel->default_send_channel_id(),
2865 media_channel->GetReceiveChannelId(kSsrc2)); 2865 media_channel->GetReceiveChannelId(kSsrc2));
2866 } 2866 }
2867 2867
2868 // Test that GetReceiveChannelId doesn't return the default channel for the 2868 // Test that GetReceiveChannelId doesn't return the default channel for the
2869 // first recv stream in conference calls. 2869 // first recv stream in conference calls.
2870 TEST_F(WebRtcVoiceEngineTestFake, TestGetChannelNumInConferenceCalls) { 2870 TEST_F(WebRtcVoiceEngineTestFake, TestGetChannelNumInConferenceCalls) {
2871 EXPECT_TRUE(SetupEngine()); 2871 EXPECT_TRUE(SetupEngine());
2872 send_parameters_.options = options_conference_; 2872 send_parameters_.options = options_conference_;
2873 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2873 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2874 cricket::StreamParams stream; 2874 cricket::StreamParams stream;
2875 stream.ssrcs.push_back(kSsrc2); 2875 stream.ssrcs.push_back(kSsrc2);
2876 EXPECT_TRUE(channel_->AddRecvStream(stream)); 2876 EXPECT_TRUE(channel_->AddRecvStream(stream));
2877 cricket::WebRtcVoiceMediaChannel* media_channel = 2877 cricket::WebRtcVoiceMediaChannel* media_channel =
2878 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 2878 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
2879 EXPECT_LT(media_channel->voe_channel(), 2879 EXPECT_LT(media_channel->default_send_channel_id(),
2880 media_channel->GetReceiveChannelId(kSsrc2)); 2880 media_channel->GetReceiveChannelId(kSsrc2));
2881 } 2881 }
2882 2882
2883 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) { 2883 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) {
2884 EXPECT_TRUE(SetupEngine()); 2884 EXPECT_TRUE(SetupEngine());
2885 float scale; 2885 float scale;
2886 EXPECT_TRUE(channel_->SetOutputVolume(0, 2)); 2886 EXPECT_TRUE(channel_->SetOutputVolume(0, 2));
2887 int channel_id = voe_.GetLastChannel(); 2887 int channel_id = voe_.GetLastChannel();
2888 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale)); 2888 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
2889 EXPECT_DOUBLE_EQ(2, scale); 2889 EXPECT_DOUBLE_EQ(2, scale);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 3074 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
3075 int recv_ch = voe_.GetLastChannel(); 3075 int recv_ch = voe_.GetLastChannel();
3076 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), -1); 3076 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), -1);
3077 } 3077 }
3078 3078
3079 // This test is an extension of AssociateChannelUnset1On1. We create two receive 3079 // This test is an extension of AssociateChannelUnset1On1. We create two receive
3080 // channels. The second should be associated with the default channel, since it 3080 // channels. The second should be associated with the default channel, since it
3081 // does not send RTCP SR. 3081 // does not send RTCP SR.
3082 TEST_F(WebRtcVoiceEngineTestFake, AssociateDefaultChannelOnSecondRecvChannel) { 3082 TEST_F(WebRtcVoiceEngineTestFake, AssociateDefaultChannelOnSecondRecvChannel) {
3083 EXPECT_TRUE(SetupEngine()); 3083 EXPECT_TRUE(SetupEngine());
3084 cricket::WebRtcVoiceMediaChannel* media_channel = 3084 int default_channel = voe_.GetLastChannel();
3085 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
3086 int default_channel = media_channel->voe_channel();
3087 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 3085 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
3088 int recv_ch_1 = voe_.GetLastChannel(); 3086 int recv_ch_1 = voe_.GetLastChannel();
3089 EXPECT_EQ(recv_ch_1, default_channel); 3087 EXPECT_EQ(recv_ch_1, default_channel);
3090 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2))); 3088 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2)));
3091 int recv_ch_2 = voe_.GetLastChannel(); 3089 int recv_ch_2 = voe_.GetLastChannel();
3092 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_1), -1); 3090 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_1), -1);
3093 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_2), default_channel); 3091 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_2), default_channel);
3094 // Add send stream, the association remains. 3092 // Add send stream, the association remains.
3095 EXPECT_TRUE(channel_->AddSendStream(cricket::StreamParams::CreateLegacy(3))); 3093 EXPECT_TRUE(channel_->AddSendStream(cricket::StreamParams::CreateLegacy(3)));
3096 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_1), -1); 3094 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_1), -1);
3097 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_2), default_channel); 3095 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch_2), default_channel);
3098 } 3096 }
3099 3097
3100 // In conference mode, all receive channels should be associated with the 3098 // In conference mode, all receive channels should be associated with the
3101 // default channel, since they do not send RTCP SR. 3099 // default channel, since they do not send RTCP SR.
3102 TEST_F(WebRtcVoiceEngineTestFake, AssociateDefaultChannelOnConference) { 3100 TEST_F(WebRtcVoiceEngineTestFake, AssociateDefaultChannelOnConference) {
3103 EXPECT_TRUE(SetupEngine()); 3101 EXPECT_TRUE(SetupEngine());
3104 send_parameters_.options = options_conference_; 3102 send_parameters_.options = options_conference_;
3105 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 3103 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
3106 cricket::WebRtcVoiceMediaChannel* media_channel = 3104 int default_channel = voe_.GetLastChannel();
3107 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
3108 int default_channel = media_channel->voe_channel();
3109 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 3105 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
3110 int recv_ch = voe_.GetLastChannel(); 3106 int recv_ch = voe_.GetLastChannel();
3111 EXPECT_NE(recv_ch, default_channel); 3107 EXPECT_NE(recv_ch, default_channel);
3112 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), default_channel); 3108 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), default_channel);
3113 EXPECT_TRUE(channel_->AddSendStream(cricket::StreamParams::CreateLegacy(2))); 3109 EXPECT_TRUE(channel_->AddSendStream(cricket::StreamParams::CreateLegacy(2)));
3114 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), default_channel); 3110 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), default_channel);
3115 } 3111 }
3116 3112
3117 TEST_F(WebRtcVoiceEngineTestFake, AssociateChannelResetUponDeleteChannnel) { 3113 TEST_F(WebRtcVoiceEngineTestFake, AssociateChannelResetUponDeleteChannnel) {
3118 EXPECT_TRUE(SetupEngine()); 3114 EXPECT_TRUE(SetupEngine());
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 cricket::WebRtcVoiceEngine engine; 3274 cricket::WebRtcVoiceEngine engine;
3279 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3275 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3280 rtc::scoped_ptr<webrtc::Call> call( 3276 rtc::scoped_ptr<webrtc::Call> call(
3281 webrtc::Call::Create(webrtc::Call::Config())); 3277 webrtc::Call::Create(webrtc::Call::Config()));
3282 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3278 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(),
3283 call.get()); 3279 call.get());
3284 cricket::AudioRecvParameters parameters; 3280 cricket::AudioRecvParameters parameters;
3285 parameters.codecs = engine.codecs(); 3281 parameters.codecs = engine.codecs();
3286 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3282 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3287 } 3283 }
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698