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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 // Test that we can apply the same set of codecs again while playing. | 909 // Test that we can apply the same set of codecs again while playing. |
910 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsWhilePlaying) { | 910 TEST_F(WebRtcVoiceEngineTestFake, SetRecvCodecsWhilePlaying) { |
911 EXPECT_TRUE(SetupRecvStream()); | 911 EXPECT_TRUE(SetupRecvStream()); |
912 cricket::AudioRecvParameters parameters; | 912 cricket::AudioRecvParameters parameters; |
913 parameters.codecs.push_back(kIsacCodec); | 913 parameters.codecs.push_back(kIsacCodec); |
914 parameters.codecs.push_back(kCn16000Codec); | 914 parameters.codecs.push_back(kCn16000Codec); |
915 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 915 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
916 channel_->SetPlayout(true); | 916 channel_->SetPlayout(true); |
917 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 917 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
918 | 918 |
919 // Changing the payload type of a codec should fail. | 919 // Remapping a payload type to a different codec should fail. |
920 parameters.codecs[0].id = 127; | 920 parameters.codecs[0] = kOpusCodec; |
| 921 parameters.codecs[0].id = kIsacCodec.id; |
921 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); | 922 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); |
922 EXPECT_TRUE(GetRecvStream(kSsrcX).started()); | 923 EXPECT_TRUE(GetRecvStream(kSsrcX).started()); |
923 } | 924 } |
924 | 925 |
925 // Test that we can add a codec while playing. | 926 // Test that we can add a codec while playing. |
926 TEST_F(WebRtcVoiceEngineTestFake, AddRecvCodecsWhilePlaying) { | 927 TEST_F(WebRtcVoiceEngineTestFake, AddRecvCodecsWhilePlaying) { |
927 EXPECT_TRUE(SetupRecvStream()); | 928 EXPECT_TRUE(SetupRecvStream()); |
928 cricket::AudioRecvParameters parameters; | 929 cricket::AudioRecvParameters parameters; |
929 parameters.codecs.push_back(kIsacCodec); | 930 parameters.codecs.push_back(kIsacCodec); |
930 parameters.codecs.push_back(kCn16000Codec); | 931 parameters.codecs.push_back(kCn16000Codec); |
931 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 932 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
932 channel_->SetPlayout(true); | 933 channel_->SetPlayout(true); |
933 | 934 |
934 parameters.codecs.push_back(kOpusCodec); | 935 parameters.codecs.push_back(kOpusCodec); |
935 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 936 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
936 EXPECT_TRUE(GetRecvStream(kSsrcX).started()); | 937 EXPECT_TRUE(GetRecvStream(kSsrcX).started()); |
937 webrtc::CodecInst gcodec; | 938 webrtc::CodecInst gcodec; |
938 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kOpusCodec, &gcodec)); | 939 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kOpusCodec, &gcodec)); |
939 EXPECT_EQ(kOpusCodec.id, gcodec.pltype); | 940 EXPECT_EQ(kOpusCodec.id, gcodec.pltype); |
940 } | 941 } |
941 | 942 |
| 943 // Test that we accept adding the same codec with a different payload type. |
| 944 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5847 |
| 945 TEST_F(WebRtcVoiceEngineTestFake, ChangeRecvCodecPayloadType) { |
| 946 EXPECT_TRUE(SetupRecvStream()); |
| 947 cricket::AudioRecvParameters parameters; |
| 948 parameters.codecs.push_back(kIsacCodec); |
| 949 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
| 950 |
| 951 ++parameters.codecs[0].id; |
| 952 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
| 953 } |
| 954 |
942 TEST_F(WebRtcVoiceEngineTestFake, SetSendBandwidthAuto) { | 955 TEST_F(WebRtcVoiceEngineTestFake, SetSendBandwidthAuto) { |
943 EXPECT_TRUE(SetupSendStream()); | 956 EXPECT_TRUE(SetupSendStream()); |
944 | 957 |
945 // Test that when autobw is enabled, bitrate is kept as the default | 958 // Test that when autobw is enabled, bitrate is kept as the default |
946 // value. autobw is enabled for the following tests because the target | 959 // value. autobw is enabled for the following tests because the target |
947 // bitrate is <= 0. | 960 // bitrate is <= 0. |
948 | 961 |
949 // ISAC, default bitrate == 32000. | 962 // ISAC, default bitrate == 32000. |
950 TestMaxSendBandwidth(kIsacCodec, 0, true, 32000); | 963 TestMaxSendBandwidth(kIsacCodec, 0, true, 32000); |
951 | 964 |
(...skipping 2929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3881 // Without this cast, the comparison turned unsigned and, thus, failed for -1. | 3894 // Without this cast, the comparison turned unsigned and, thus, failed for -1. |
3882 const int num_specs = static_cast<int>(specs.size()); | 3895 const int num_specs = static_cast<int>(specs.size()); |
3883 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); | 3896 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); |
3884 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); | 3897 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); |
3885 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); | 3898 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); |
3886 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); | 3899 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); |
3887 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); | 3900 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); |
3888 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); | 3901 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); |
3889 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); | 3902 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); |
3890 } | 3903 } |
OLD | NEW |