OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2008 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 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 void SetSink(Sink* sink) override {} | 100 void SetSink(Sink* sink) override {} |
101 }; | 101 }; |
102 | 102 |
103 class WebRtcVoiceEngineTestFake : public testing::Test { | 103 class WebRtcVoiceEngineTestFake : public testing::Test { |
104 public: | 104 public: |
105 WebRtcVoiceEngineTestFake() : WebRtcVoiceEngineTestFake("") {} | 105 WebRtcVoiceEngineTestFake() : WebRtcVoiceEngineTestFake("") {} |
106 | 106 |
107 explicit WebRtcVoiceEngineTestFake(const char* field_trials) | 107 explicit WebRtcVoiceEngineTestFake(const char* field_trials) |
108 : call_(webrtc::Call::Config(&event_log_)), voe_(&apm_), | 108 : call_(webrtc::Call::Config(&event_log_)), voe_(&apm_), |
109 override_field_trials_(field_trials) { | 109 override_field_trials_(field_trials) { |
110 auto factory = webrtc::MockAudioDecoderFactory::CreateUnusedFactory(); | 110 auto factory = |
111 webrtc::MockAudioDecoderFactory::CreateUnusedPotemkinFactory(); | |
the sun
2016/12/14 08:58:24
I guess that will be explained later, but I'm not
ossu
2016/12/14 10:21:36
I had to google it. That said, it's pretty witty.
kwiberg-webrtc
2016/12/14 13:09:36
"I had to google it" and "pretty witty"---what mor
ossu
2016/12/14 13:53:35
I think I'd just set up the mock manually in this
kwiberg-webrtc
2016/12/15 14:30:50
OK, using the normal factory and adding a TODO sou
| |
111 EXPECT_CALL(adm_, AddRef()).WillOnce(Return(0)); | 112 EXPECT_CALL(adm_, AddRef()).WillOnce(Return(0)); |
112 EXPECT_CALL(adm_, Release()).WillOnce(Return(0)); | 113 EXPECT_CALL(adm_, Release()).WillOnce(Return(0)); |
113 EXPECT_CALL(adm_, BuiltInAECIsAvailable()).WillOnce(Return(false)); | 114 EXPECT_CALL(adm_, BuiltInAECIsAvailable()).WillOnce(Return(false)); |
114 EXPECT_CALL(adm_, BuiltInAGCIsAvailable()).WillOnce(Return(false)); | 115 EXPECT_CALL(adm_, BuiltInAGCIsAvailable()).WillOnce(Return(false)); |
115 EXPECT_CALL(adm_, BuiltInNSIsAvailable()).WillOnce(Return(false)); | 116 EXPECT_CALL(adm_, BuiltInNSIsAvailable()).WillOnce(Return(false)); |
116 EXPECT_CALL(apm_, ApplyConfig(testing::_)); | 117 EXPECT_CALL(apm_, ApplyConfig(testing::_)); |
117 EXPECT_CALL(apm_, SetExtraOptions(testing::_)); | 118 EXPECT_CALL(apm_, SetExtraOptions(testing::_)); |
118 EXPECT_CALL(apm_, Initialize()).WillOnce(Return(0)); | 119 EXPECT_CALL(apm_, Initialize()).WillOnce(Return(0)); |
119 engine_.reset(new cricket::WebRtcVoiceEngine(&adm_, factory, | 120 engine_.reset(new cricket::WebRtcVoiceEngine(&adm_, factory, |
120 new FakeVoEWrapper(&voe_))); | 121 new FakeVoEWrapper(&voe_))); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
863 EXPECT_STREQ("telephone-event", gcodec.plname); | 864 EXPECT_STREQ("telephone-event", gcodec.plname); |
864 } | 865 } |
865 | 866 |
866 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsAfterAddingStreams) { | 867 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsAfterAddingStreams) { |
867 EXPECT_TRUE(SetupRecvStream()); | 868 EXPECT_TRUE(SetupRecvStream()); |
868 cricket::AudioRecvParameters parameters; | 869 cricket::AudioRecvParameters parameters; |
869 parameters.codecs.push_back(kIsacCodec); | 870 parameters.codecs.push_back(kIsacCodec); |
870 parameters.codecs[0].id = 106; // collide with existing CN 32k | 871 parameters.codecs[0].id = 106; // collide with existing CN 32k |
871 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 872 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
872 | 873 |
873 int channel_num2 = voe_.GetLastChannel(); | 874 const auto& dm = GetRecvStreamConfig(kSsrc1).decoder_map; |
874 webrtc::CodecInst gcodec; | 875 ASSERT_EQ(1, dm.count(106)); |
875 rtc::strcpyn(gcodec.plname, arraysize(gcodec.plname), "ISAC"); | 876 EXPECT_EQ(webrtc::SdpAudioFormat("isac", 16000, 1), dm.at(106)); |
the sun
2016/12/14 08:58:25
Any reason "ISAC" changed to "isac"?
kwiberg-webrtc
2016/12/14 13:09:36
I re-wrote it by hand rather than copy+pasting, an
| |
876 gcodec.plfreq = 16000; | |
877 gcodec.channels = 1; | |
878 EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num2, gcodec)); | |
879 EXPECT_EQ(106, gcodec.pltype); | |
880 EXPECT_STREQ("ISAC", gcodec.plname); | |
881 } | 877 } |
882 | 878 |
883 // Test that we can apply the same set of codecs again while playing. | 879 // Test that we can apply the same set of codecs again while playing. |
884 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsWhilePlaying) { | 880 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsWhilePlaying) { |
885 EXPECT_TRUE(SetupRecvStream()); | 881 EXPECT_TRUE(SetupRecvStream()); |
886 cricket::AudioRecvParameters parameters; | 882 cricket::AudioRecvParameters parameters; |
887 parameters.codecs.push_back(kIsacCodec); | 883 parameters.codecs.push_back(kIsacCodec); |
888 parameters.codecs.push_back(kCn16000Codec); | 884 parameters.codecs.push_back(kCn16000Codec); |
889 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 885 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
890 channel_->SetPlayout(true); | 886 channel_->SetPlayout(true); |
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3606 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); | 3602 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); |
3607 webrtc::RtcEventLogNullImpl event_log; | 3603 webrtc::RtcEventLogNullImpl event_log; |
3608 std::unique_ptr<webrtc::Call> call( | 3604 std::unique_ptr<webrtc::Call> call( |
3609 webrtc::Call::Create(webrtc::Call::Config(&event_log))); | 3605 webrtc::Call::Create(webrtc::Call::Config(&event_log))); |
3610 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3606 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
3611 cricket::AudioOptions(), call.get()); | 3607 cricket::AudioOptions(), call.get()); |
3612 cricket::AudioRecvParameters parameters; | 3608 cricket::AudioRecvParameters parameters; |
3613 parameters.codecs = engine.recv_codecs(); | 3609 parameters.codecs = engine.recv_codecs(); |
3614 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3610 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3615 } | 3611 } |
OLD | NEW |