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

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

Issue 1604563002: Add send-side BWE to WebRtcVoiceEngine under a finch experiment. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 4 years, 11 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
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 11 matching lines...) Expand all
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "webrtc/base/arraysize.h" 28 #include "webrtc/base/arraysize.h"
29 #include "webrtc/base/byteorder.h" 29 #include "webrtc/base/byteorder.h"
30 #include "webrtc/base/gunit.h" 30 #include "webrtc/base/gunit.h"
31 #include "webrtc/call.h" 31 #include "webrtc/call.h"
32 #include "webrtc/p2p/base/faketransportcontroller.h"
33 #include "webrtc/test/field_trial.h"
32 #include "talk/media/base/constants.h" 34 #include "talk/media/base/constants.h"
33 #include "talk/media/base/fakemediaengine.h" 35 #include "talk/media/base/fakemediaengine.h"
34 #include "talk/media/base/fakenetworkinterface.h" 36 #include "talk/media/base/fakenetworkinterface.h"
35 #include "talk/media/base/fakertp.h" 37 #include "talk/media/base/fakertp.h"
36 #include "talk/media/webrtc/fakewebrtccall.h" 38 #include "talk/media/webrtc/fakewebrtccall.h"
37 #include "talk/media/webrtc/fakewebrtcvoiceengine.h" 39 #include "talk/media/webrtc/fakewebrtcvoiceengine.h"
38 #include "talk/media/webrtc/webrtcvoiceengine.h" 40 #include "talk/media/webrtc/webrtcvoiceengine.h"
39 #include "webrtc/p2p/base/faketransportcontroller.h"
40 #include "talk/session/media/channel.h" 41 #include "talk/session/media/channel.h"
41 42
42 using cricket::kRtpAudioLevelHeaderExtension; 43 using cricket::kRtpAudioLevelHeaderExtension;
43 using cricket::kRtpAbsoluteSenderTimeHeaderExtension; 44 using cricket::kRtpAbsoluteSenderTimeHeaderExtension;
44 45
45 namespace { 46 namespace {
46 47
47 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1, 0); 48 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1, 0);
48 const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1, 0); 49 const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1, 0);
49 const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 64000, 2, 0); 50 const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 64000, 2, 0);
(...skipping 22 matching lines...) Expand all
72 }; 73 };
73 } // namespace 74 } // namespace
74 75
75 class FakeAudioSink : public webrtc::AudioSinkInterface { 76 class FakeAudioSink : public webrtc::AudioSinkInterface {
76 public: 77 public:
77 void OnData(const Data& audio) override {} 78 void OnData(const Data& audio) override {}
78 }; 79 };
79 80
80 class WebRtcVoiceEngineTestFake : public testing::Test { 81 class WebRtcVoiceEngineTestFake : public testing::Test {
81 public: 82 public:
82 WebRtcVoiceEngineTestFake() 83 explicit WebRtcVoiceEngineTestFake() : WebRtcVoiceEngineTestFake("") {}
84
85 explicit WebRtcVoiceEngineTestFake(const char* field_trials)
83 : call_(webrtc::Call::Config()), 86 : call_(webrtc::Call::Config()),
84 engine_(new FakeVoEWrapper(&voe_)), 87 engine_(new FakeVoEWrapper(&voe_)),
85 channel_(nullptr) { 88 channel_(nullptr),
89 override_field_trials_(field_trials) {
86 send_parameters_.codecs.push_back(kPcmuCodec); 90 send_parameters_.codecs.push_back(kPcmuCodec);
87 recv_parameters_.codecs.push_back(kPcmuCodec); 91 recv_parameters_.codecs.push_back(kPcmuCodec);
88 } 92 }
89 bool SetupEngine() { 93 bool SetupEngine() {
90 if (!engine_.Init(rtc::Thread::Current())) { 94 if (!engine_.Init(rtc::Thread::Current())) {
91 return false; 95 return false;
92 } 96 }
93 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 97 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions());
94 return (channel_ != nullptr); 98 return (channel_ != nullptr);
95 } 99 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms); 407 EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms);
404 } 408 }
405 409
406 protected: 410 protected:
407 cricket::FakeCall call_; 411 cricket::FakeCall call_;
408 cricket::FakeWebRtcVoiceEngine voe_; 412 cricket::FakeWebRtcVoiceEngine voe_;
409 cricket::WebRtcVoiceEngine engine_; 413 cricket::WebRtcVoiceEngine engine_;
410 cricket::VoiceMediaChannel* channel_; 414 cricket::VoiceMediaChannel* channel_;
411 cricket::AudioSendParameters send_parameters_; 415 cricket::AudioSendParameters send_parameters_;
412 cricket::AudioRecvParameters recv_parameters_; 416 cricket::AudioRecvParameters recv_parameters_;
417
418 private:
419 webrtc::test::ScopedFieldTrials override_field_trials_;
413 }; 420 };
414 421
415 // Tests that our stub library "works". 422 // Tests that our stub library "works".
416 TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) { 423 TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) {
417 EXPECT_FALSE(voe_.IsInited()); 424 EXPECT_FALSE(voe_.IsInited());
418 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 425 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
419 EXPECT_TRUE(voe_.IsInited()); 426 EXPECT_TRUE(voe_.IsInited());
420 engine_.Terminate(); 427 engine_.Terminate();
421 EXPECT_FALSE(voe_.IsInited()); 428 EXPECT_FALSE(voe_.IsInited());
422 } 429 }
(...skipping 14 matching lines...) Expand all
437 EXPECT_EQ(48000, codecs[0].clockrate); 444 EXPECT_EQ(48000, codecs[0].clockrate);
438 EXPECT_EQ(2, codecs[0].channels); 445 EXPECT_EQ(2, codecs[0].channels);
439 EXPECT_EQ(64000, codecs[0].bitrate); 446 EXPECT_EQ(64000, codecs[0].bitrate);
440 int pref = codecs[0].preference; 447 int pref = codecs[0].preference;
441 for (size_t i = 1; i < codecs.size(); ++i) { 448 for (size_t i = 1; i < codecs.size(); ++i) {
442 EXPECT_GT(pref, codecs[i].preference); 449 EXPECT_GT(pref, codecs[i].preference);
443 pref = codecs[i].preference; 450 pref = codecs[i].preference;
444 } 451 }
445 } 452 }
446 453
454 TEST_F(WebRtcVoiceEngineTestFake, OpusSupportsTransportCc) {
455 const std::vector<cricket::AudioCodec>& codecs = engine_.codecs();
456 bool opus_found = false;
457 for (cricket::AudioCodec codec : codecs) {
458 if (codec.name == "opus") {
459 EXPECT_TRUE(HasTransportCc(codec));
460 opus_found = true;
461 }
462 }
463 EXPECT_TRUE(opus_found);
464 }
465
447 // Tests that we can find codecs by name or id, and that we interpret the 466 // Tests that we can find codecs by name or id, and that we interpret the
448 // clockrate and bitrate fields properly. 467 // clockrate and bitrate fields properly.
449 TEST_F(WebRtcVoiceEngineTestFake, FindCodec) { 468 TEST_F(WebRtcVoiceEngineTestFake, FindCodec) {
450 cricket::AudioCodec codec; 469 cricket::AudioCodec codec;
451 webrtc::CodecInst codec_inst; 470 webrtc::CodecInst codec_inst;
452 // Find PCMU with explicit clockrate and bitrate. 471 // Find PCMU with explicit clockrate and bitrate.
453 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kPcmuCodec, &codec_inst)); 472 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kPcmuCodec, &codec_inst));
454 // Find ISAC with explicit clockrate and 0 bitrate. 473 // Find ISAC with explicit clockrate and 0 bitrate.
455 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kIsacCodec, &codec_inst)); 474 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kIsacCodec, &codec_inst));
456 // Find telephone-event with explicit clockrate and 0 bitrate. 475 // Find telephone-event with explicit clockrate and 0 bitrate.
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 int channel_num = voe_.GetLastChannel(); 1299 int channel_num = voe_.GetLastChannel();
1281 cricket::AudioSendParameters parameters; 1300 cricket::AudioSendParameters parameters;
1282 parameters.codecs.push_back(kOpusCodec); 1301 parameters.codecs.push_back(kOpusCodec);
1283 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1302 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1284 EXPECT_FALSE(voe_.GetCodecFEC(channel_num)); 1303 EXPECT_FALSE(voe_.GetCodecFEC(channel_num));
1285 parameters.codecs[0].params["useinbandfec"] = "1"; 1304 parameters.codecs[0].params["useinbandfec"] = "1";
1286 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1305 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1287 EXPECT_TRUE(voe_.GetCodecFEC(channel_num)); 1306 EXPECT_TRUE(voe_.GetCodecFEC(channel_num));
1288 } 1307 }
1289 1308
1309 TEST_F(WebRtcVoiceEngineTestFake, TransportCcCanBeEnabledAndDisabled) {
1310 EXPECT_TRUE(SetupEngine());
1311 cricket::AudioSendParameters send_parameters;
1312 send_parameters.codecs.push_back(kOpusCodec);
1313 EXPECT_TRUE(send_parameters.codecs[0].feedback_params.params().empty());
1314 EXPECT_TRUE(channel_->SetSendParameters(send_parameters));
1315
1316 cricket::AudioRecvParameters recv_parameters;
1317 recv_parameters.codecs.push_back(kOpusCodec);
1318 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters));
1319 EXPECT_TRUE(
1320 channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc1)));
1321 ASSERT_TRUE(call_.GetAudioReceiveStream(kSsrc1) != nullptr);
1322 EXPECT_FALSE(
1323 call_.GetAudioReceiveStream(kSsrc1)->GetConfig().rtp.transport_cc);
1324
1325 send_parameters.codecs = engine_.codecs();
1326 EXPECT_TRUE(channel_->SetSendParameters(send_parameters));
1327 ASSERT_TRUE(call_.GetAudioReceiveStream(kSsrc1) != nullptr);
1328 EXPECT_TRUE(
1329 call_.GetAudioReceiveStream(kSsrc1)->GetConfig().rtp.transport_cc);
1330 }
1331
1290 // Test maxplaybackrate <= 8000 triggers Opus narrow band mode. 1332 // Test maxplaybackrate <= 8000 triggers Opus narrow band mode.
1291 TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateNb) { 1333 TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateNb) {
1292 EXPECT_TRUE(SetupEngineWithSendStream()); 1334 EXPECT_TRUE(SetupEngineWithSendStream());
1293 int channel_num = voe_.GetLastChannel(); 1335 int channel_num = voe_.GetLastChannel();
1294 cricket::AudioSendParameters parameters; 1336 cricket::AudioSendParameters parameters;
1295 parameters.codecs.push_back(kOpusCodec); 1337 parameters.codecs.push_back(kOpusCodec);
1296 parameters.codecs[0].bitrate = 0; 1338 parameters.codecs[0].bitrate = 0;
1297 parameters.codecs[0].SetParam(cricket::kCodecParamMaxPlaybackRate, 8000); 1339 parameters.codecs[0].SetParam(cricket::kCodecParamMaxPlaybackRate, 8000);
1298 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1340 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1299 EXPECT_EQ(cricket::kOpusBandwidthNb, 1341 EXPECT_EQ(cricket::kOpusBandwidthNb,
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 parameters.codecs[0].params[""] = "97/97"; 1964 parameters.codecs[0].params[""] = "97/97";
1923 parameters.codecs[1].id = 96; 1965 parameters.codecs[1].id = 96;
1924 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1966 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1925 webrtc::CodecInst gcodec; 1967 webrtc::CodecInst gcodec;
1926 EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); 1968 EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
1927 EXPECT_EQ(96, gcodec.pltype); 1969 EXPECT_EQ(96, gcodec.pltype);
1928 EXPECT_STREQ("ISAC", gcodec.plname); 1970 EXPECT_STREQ("ISAC", gcodec.plname);
1929 EXPECT_FALSE(voe_.GetRED(channel_num)); 1971 EXPECT_FALSE(voe_.GetRED(channel_num));
1930 } 1972 }
1931 1973
1974 class WebRtcVoiceEngineWithSendSideBweTest : public WebRtcVoiceEngineTestFake {
1975 public:
1976 WebRtcVoiceEngineWithSendSideBweTest()
1977 : WebRtcVoiceEngineTestFake("WebRTC-Audio-SendSideBwe/Enabled/") {}
1978 };
1979
1980 TEST_F(WebRtcVoiceEngineWithSendSideBweTest,
1981 SupportsTransportSequenceNumberHeaderExtension) {
1982 cricket::RtpCapabilities capabilities = engine_.GetCapabilities();
1983 ASSERT_FALSE(capabilities.header_extensions.empty());
1984 for (const cricket::RtpHeaderExtension& extension :
1985 capabilities.header_extensions) {
1986 if (extension.uri == cricket::kRtpTransportSequenceNumberHeaderExtension) {
1987 EXPECT_EQ(cricket::kRtpTransportSequenceNumberHeaderExtensionDefaultId,
1988 extension.id);
1989 return;
1990 }
1991 }
1992 FAIL() << "Transport sequence number extension not in header-extension list.";
1993 }
1994
1932 // Test support for audio level header extension. 1995 // Test support for audio level header extension.
1933 TEST_F(WebRtcVoiceEngineTestFake, SendAudioLevelHeaderExtensions) { 1996 TEST_F(WebRtcVoiceEngineTestFake, SendAudioLevelHeaderExtensions) {
1934 TestSetSendRtpHeaderExtensions(kRtpAudioLevelHeaderExtension); 1997 TestSetSendRtpHeaderExtensions(kRtpAudioLevelHeaderExtension);
1935 } 1998 }
1936 TEST_F(WebRtcVoiceEngineTestFake, RecvAudioLevelHeaderExtensions) { 1999 TEST_F(WebRtcVoiceEngineTestFake, RecvAudioLevelHeaderExtensions) {
1937 TestSetRecvRtpHeaderExtensions(kRtpAudioLevelHeaderExtension); 2000 TestSetRecvRtpHeaderExtensions(kRtpAudioLevelHeaderExtension);
1938 } 2001 }
1939 2002
1940 // Test support for absolute send time header extension. 2003 // Test support for absolute send time header extension.
1941 TEST_F(WebRtcVoiceEngineTestFake, SendAbsoluteSendTimeHeaderExtensions) { 2004 TEST_F(WebRtcVoiceEngineTestFake, SendAbsoluteSendTimeHeaderExtensions) {
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
2921 2984
2922 ASSERT_EQ(2, call_.GetAudioReceiveStreams().size()); 2985 ASSERT_EQ(2, call_.GetAudioReceiveStreams().size());
2923 EXPECT_EQ(kSyncLabel, 2986 EXPECT_EQ(kSyncLabel,
2924 call_.GetAudioReceiveStream(kAudioSsrc)->GetConfig().sync_group) 2987 call_.GetAudioReceiveStream(kAudioSsrc)->GetConfig().sync_group)
2925 << "SyncGroup should be set based on sync_label"; 2988 << "SyncGroup should be set based on sync_label";
2926 EXPECT_EQ(kSyncLabel, 2989 EXPECT_EQ(kSyncLabel,
2927 call_.GetAudioReceiveStream(kAudioSsrc + 1)->GetConfig().sync_group) 2990 call_.GetAudioReceiveStream(kAudioSsrc + 1)->GetConfig().sync_group)
2928 << "SyncGroup should be set based on sync_label"; 2991 << "SyncGroup should be set based on sync_label";
2929 } 2992 }
2930 2993
2931 TEST_F(WebRtcVoiceEngineTestFake, CanChangeCombinedBweOption) {
2932 // Test that changing the combined_audio_video_bwe option results in the
2933 // expected state changes on an associated Call.
2934 std::vector<uint32_t> ssrcs;
2935 ssrcs.push_back(223);
2936 ssrcs.push_back(224);
2937
2938 EXPECT_TRUE(SetupEngineWithSendStream());
2939 cricket::WebRtcVoiceMediaChannel* media_channel =
2940 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
2941 for (uint32_t ssrc : ssrcs) {
2942 EXPECT_TRUE(media_channel->AddRecvStream(
2943 cricket::StreamParams::CreateLegacy(ssrc)));
2944 }
2945 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size());
2946
2947 // Combined BWE should be disabled.
2948 for (uint32_t ssrc : ssrcs) {
2949 const auto* s = call_.GetAudioReceiveStream(ssrc);
2950 EXPECT_NE(nullptr, s);
2951 EXPECT_FALSE(s->GetConfig().combined_audio_video_bwe);
2952 }
2953
2954 // Enable combined BWE option - now it should be set up.
2955 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true);
2956 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_));
2957 for (uint32_t ssrc : ssrcs) {
2958 const auto* s = call_.GetAudioReceiveStream(ssrc);
2959 EXPECT_NE(nullptr, s);
2960 EXPECT_EQ(true, s->GetConfig().combined_audio_video_bwe);
2961 }
2962
2963 // Disable combined BWE option - should be disabled again.
2964 send_parameters_.options.combined_audio_video_bwe =
2965 rtc::Optional<bool>(false);
2966 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_));
2967 for (uint32_t ssrc : ssrcs) {
2968 const auto* s = call_.GetAudioReceiveStream(ssrc);
2969 EXPECT_NE(nullptr, s);
2970 EXPECT_FALSE(s->GetConfig().combined_audio_video_bwe);
2971 }
2972
2973 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size());
2974 }
2975
2976 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBweForNewRecvStreams) {
2977 // Test that adding receive streams after enabling combined bandwidth
2978 // estimation will correctly configure each channel.
2979 EXPECT_TRUE(SetupEngineWithSendStream());
2980 cricket::WebRtcVoiceMediaChannel* media_channel =
2981 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
2982 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true);
2983 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_));
2984
2985 for (uint32_t ssrc : kSsrcs4) {
2986 EXPECT_TRUE(media_channel->AddRecvStream(
2987 cricket::StreamParams::CreateLegacy(ssrc)));
2988 EXPECT_NE(nullptr, call_.GetAudioReceiveStream(ssrc));
2989 }
2990 EXPECT_EQ(arraysize(kSsrcs4), call_.GetAudioReceiveStreams().size());
2991 }
2992
2993 // TODO(solenberg): Remove, once recv streams are configured through Call. 2994 // TODO(solenberg): Remove, once recv streams are configured through Call.
2994 // (This is then covered by TestSetRecvRtpHeaderExtensions.) 2995 // (This is then covered by TestSetRecvRtpHeaderExtensions.)
2995 TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) { 2996 TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) {
2996 // Test that setting the header extensions results in the expected state 2997 // Test that setting the header extensions results in the expected state
2997 // changes on an associated Call. 2998 // changes on an associated Call.
2998 std::vector<uint32_t> ssrcs; 2999 std::vector<uint32_t> ssrcs;
2999 ssrcs.push_back(223); 3000 ssrcs.push_back(223);
3000 ssrcs.push_back(224); 3001 ssrcs.push_back(224);
3001 3002
3002 EXPECT_TRUE(SetupEngineWithSendStream()); 3003 EXPECT_TRUE(SetupEngineWithSendStream());
3003 cricket::WebRtcVoiceMediaChannel* media_channel = 3004 cricket::WebRtcVoiceMediaChannel* media_channel =
3004 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 3005 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
3005 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true);
3006 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); 3006 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_));
3007 for (uint32_t ssrc : ssrcs) { 3007 for (uint32_t ssrc : ssrcs) {
3008 EXPECT_TRUE(media_channel->AddRecvStream( 3008 EXPECT_TRUE(media_channel->AddRecvStream(
3009 cricket::StreamParams::CreateLegacy(ssrc))); 3009 cricket::StreamParams::CreateLegacy(ssrc)));
3010 } 3010 }
3011 3011
3012 // Combined BWE should be set up, but with no configured extensions.
3013 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); 3012 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size());
3014 for (uint32_t ssrc : ssrcs) { 3013 for (uint32_t ssrc : ssrcs) {
3015 const auto* s = call_.GetAudioReceiveStream(ssrc); 3014 const auto* s = call_.GetAudioReceiveStream(ssrc);
3016 EXPECT_NE(nullptr, s); 3015 EXPECT_NE(nullptr, s);
3017 EXPECT_EQ(0, s->GetConfig().rtp.extensions.size()); 3016 EXPECT_EQ(0, s->GetConfig().rtp.extensions.size());
3018 } 3017 }
3019 3018
3020 // Set up receive extensions. 3019 // Set up receive extensions.
3021 cricket::RtpCapabilities capabilities = engine_.GetCapabilities(); 3020 cricket::RtpCapabilities capabilities = engine_.GetCapabilities();
3022 cricket::AudioRecvParameters recv_parameters; 3021 cricket::AudioRecvParameters recv_parameters;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 3053 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
3055 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 3054 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
3056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 3055 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3057 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 3056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
3058 }; 3057 };
3059 rtc::Buffer kRtcpPacket(kRtcp, sizeof(kRtcp)); 3058 rtc::Buffer kRtcpPacket(kRtcp, sizeof(kRtcp));
3060 3059
3061 EXPECT_TRUE(SetupEngineWithSendStream()); 3060 EXPECT_TRUE(SetupEngineWithSendStream());
3062 cricket::WebRtcVoiceMediaChannel* media_channel = 3061 cricket::WebRtcVoiceMediaChannel* media_channel =
3063 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 3062 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
3064 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true);
3065 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 3063 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
3066 EXPECT_TRUE(media_channel->AddRecvStream( 3064 EXPECT_TRUE(media_channel->AddRecvStream(
3067 cricket::StreamParams::CreateLegacy(kAudioSsrc))); 3065 cricket::StreamParams::CreateLegacy(kAudioSsrc)));
3068 3066
3069 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size()); 3067 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size());
3070 const cricket::FakeAudioReceiveStream* s = 3068 const cricket::FakeAudioReceiveStream* s =
3071 call_.GetAudioReceiveStream(kAudioSsrc); 3069 call_.GetAudioReceiveStream(kAudioSsrc);
3072 EXPECT_EQ(0, s->received_packets()); 3070 EXPECT_EQ(0, s->received_packets());
3073 channel_->OnPacketReceived(&kPcmuPacket, rtc::PacketTime()); 3071 channel_->OnPacketReceived(&kPcmuPacket, rtc::PacketTime());
3074 EXPECT_EQ(1, s->received_packets()); 3072 EXPECT_EQ(1, s->received_packets());
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
3295 cricket::WebRtcVoiceEngine engine; 3293 cricket::WebRtcVoiceEngine engine;
3296 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3294 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3297 rtc::scoped_ptr<webrtc::Call> call( 3295 rtc::scoped_ptr<webrtc::Call> call(
3298 webrtc::Call::Create(webrtc::Call::Config())); 3296 webrtc::Call::Create(webrtc::Call::Config()));
3299 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3297 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(),
3300 call.get()); 3298 call.get());
3301 cricket::AudioRecvParameters parameters; 3299 cricket::AudioRecvParameters parameters;
3302 parameters.codecs = engine.codecs(); 3300 parameters.codecs = engine.codecs();
3303 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3301 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3304 } 3302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698