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

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

Issue 2516993002: Pass SdpAudioFormat through Channel, without converting to CodecInst (Closed)
Patch Set: . Created 4 years 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 * 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 EXPECT_EQ(107, gcodec.pltype); 744 EXPECT_EQ(107, gcodec.pltype);
745 EXPECT_STREQ("telephone-event", gcodec.plname); 745 EXPECT_STREQ("telephone-event", gcodec.plname);
746 } 746 }
747 747
748 // Test that we fail to set an unknown inbound codec. 748 // Test that we fail to set an unknown inbound codec.
749 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsUnsupportedCodec) { 749 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsUnsupportedCodec) {
750 EXPECT_TRUE(SetupChannel()); 750 EXPECT_TRUE(SetupChannel());
751 cricket::AudioRecvParameters parameters; 751 cricket::AudioRecvParameters parameters;
752 parameters.codecs.push_back(kIsacCodec); 752 parameters.codecs.push_back(kIsacCodec);
753 parameters.codecs.push_back(cricket::AudioCodec(127, "XYZ", 32000, 0, 1)); 753 parameters.codecs.push_back(cricket::AudioCodec(127, "XYZ", 32000, 0, 1));
754 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); 754
755 // TODO(kwiberg): Should this succeed or fail? With SdpAudioFormat, we
756 // currently don't check the codec spec early enough to be able to fail here.
757 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
758 //EXPECT_FALSE(channel_->SetRecvParameters(parameters));
kwiberg-webrtc 2016/12/08 09:44:06 Should this test simply be changed, or do we want
the sun 2016/12/08 10:53:52 The call to SetRecvParameters() should still fail
kwiberg-webrtc 2016/12/09 02:39:01 Sounds good.
the sun 2016/12/09 12:29:49 I don't think we should do the 2-stage right now.
ossu 2016/12/09 13:23:39 I don't see the immediate benefit of adding anothe
kwiberg-webrtc 2016/12/11 11:24:55 Checked against GetSupportedCodecs(), since IsSupp
755 } 759 }
756 760
757 // Test that we fail if we have duplicate types in the inbound list. 761 // Test that we fail if we have duplicate types in the inbound list.
758 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsDuplicatePayloadType) { 762 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsDuplicatePayloadType) {
759 EXPECT_TRUE(SetupChannel()); 763 EXPECT_TRUE(SetupChannel());
760 cricket::AudioRecvParameters parameters; 764 cricket::AudioRecvParameters parameters;
761 parameters.codecs.push_back(kIsacCodec); 765 parameters.codecs.push_back(kIsacCodec);
762 parameters.codecs.push_back(kCn16000Codec); 766 parameters.codecs.push_back(kCn16000Codec);
763 parameters.codecs[1].id = kIsacCodec.id; 767 parameters.codecs[1].id = kIsacCodec.id;
764 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); 768 EXPECT_FALSE(channel_->SetRecvParameters(parameters));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 cricket::AudioRecvParameters parameters; 872 cricket::AudioRecvParameters parameters;
869 parameters.codecs.push_back(kIsacCodec); 873 parameters.codecs.push_back(kIsacCodec);
870 parameters.codecs[0].id = 106; // collide with existing CN 32k 874 parameters.codecs[0].id = 106; // collide with existing CN 32k
871 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 875 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
872 876
873 int channel_num2 = voe_.GetLastChannel(); 877 int channel_num2 = voe_.GetLastChannel();
874 webrtc::CodecInst gcodec; 878 webrtc::CodecInst gcodec;
875 rtc::strcpyn(gcodec.plname, arraysize(gcodec.plname), "ISAC"); 879 rtc::strcpyn(gcodec.plname, arraysize(gcodec.plname), "ISAC");
876 gcodec.plfreq = 16000; 880 gcodec.plfreq = 16000;
877 gcodec.channels = 1; 881 gcodec.channels = 1;
878 EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num2, gcodec)); 882
879 EXPECT_EQ(106, gcodec.pltype); 883 // TODO(kwiberg): channel_->SetRecvParameters recreates the
880 EXPECT_STREQ("ISAC", gcodec.plname); 884 // AudioReceiveStream, which has no effect on the FakeWebRtcVoiceEngine in
885 // voe_. Not sure how to handle this---should FakeWebRtcVoiceEngine be fixed?
the sun 2016/12/08 10:53:52 You should remove the call to FakeWebRtcVoiceEngin
kwiberg-webrtc 2016/12/09 02:39:01 Acknowledged.
886 EXPECT_EQ(-1, voe_.GetRecPayloadType(channel_num2, gcodec));
887 //EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num2, gcodec));
888 //EXPECT_EQ(106, gcodec.pltype);
889 //EXPECT_STREQ("ISAC", gcodec.plname);
kwiberg-webrtc 2016/12/08 09:44:06 As the comment says, I think this is fundamentally
the sun 2016/12/08 10:53:52 See above
881 } 890 }
882 891
883 // Test that we can apply the same set of codecs again while playing. 892 // Test that we can apply the same set of codecs again while playing.
884 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsWhilePlaying) { 893 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsWhilePlaying) {
885 EXPECT_TRUE(SetupRecvStream()); 894 EXPECT_TRUE(SetupRecvStream());
886 cricket::AudioRecvParameters parameters; 895 cricket::AudioRecvParameters parameters;
887 parameters.codecs.push_back(kIsacCodec); 896 parameters.codecs.push_back(kIsacCodec);
888 parameters.codecs.push_back(kCn16000Codec); 897 parameters.codecs.push_back(kCn16000Codec);
889 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 898 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
890 channel_->SetPlayout(true); 899 channel_->SetPlayout(true);
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); 3615 nullptr, webrtc::CreateBuiltinAudioDecoderFactory());
3607 webrtc::RtcEventLogNullImpl event_log; 3616 webrtc::RtcEventLogNullImpl event_log;
3608 std::unique_ptr<webrtc::Call> call( 3617 std::unique_ptr<webrtc::Call> call(
3609 webrtc::Call::Create(webrtc::Call::Config(&event_log))); 3618 webrtc::Call::Create(webrtc::Call::Config(&event_log)));
3610 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3619 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3611 cricket::AudioOptions(), call.get()); 3620 cricket::AudioOptions(), call.get());
3612 cricket::AudioRecvParameters parameters; 3621 cricket::AudioRecvParameters parameters;
3613 parameters.codecs = engine.recv_codecs(); 3622 parameters.codecs = engine.recv_codecs();
3614 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3623 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3615 } 3624 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698