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

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

Issue 2831333002: Allow a received audio codec's payload type to change. (Closed)
Patch Set: Created 3 years, 8 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 * 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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 channel_->SetPlayout(true); 932 channel_->SetPlayout(true);
933 933
934 parameters.codecs.push_back(kOpusCodec); 934 parameters.codecs.push_back(kOpusCodec);
935 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 935 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
936 EXPECT_TRUE(GetRecvStream(kSsrcX).started()); 936 EXPECT_TRUE(GetRecvStream(kSsrcX).started());
937 webrtc::CodecInst gcodec; 937 webrtc::CodecInst gcodec;
938 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kOpusCodec, &gcodec)); 938 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(kOpusCodec, &gcodec));
939 EXPECT_EQ(kOpusCodec.id, gcodec.pltype); 939 EXPECT_EQ(kOpusCodec.id, gcodec.pltype);
940 } 940 }
941 941
942 // Test that we accept adding the same codec with a different payload type.
943 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5847
944 TEST_F(WebRtcVoiceEngineTestFake, ChangeRecvCodecPayloadType) {
945 EXPECT_TRUE(SetupRecvStream());
946 cricket::AudioRecvParameters parameters;
947 parameters.codecs.push_back(kIsacCodec);
948 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
949
950 ++parameters.codecs[0].id;
951 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
952 }
953
942 TEST_F(WebRtcVoiceEngineTestFake, SetSendBandwidthAuto) { 954 TEST_F(WebRtcVoiceEngineTestFake, SetSendBandwidthAuto) {
943 EXPECT_TRUE(SetupSendStream()); 955 EXPECT_TRUE(SetupSendStream());
944 956
945 // Test that when autobw is enabled, bitrate is kept as the default 957 // Test that when autobw is enabled, bitrate is kept as the default
946 // value. autobw is enabled for the following tests because the target 958 // value. autobw is enabled for the following tests because the target
947 // bitrate is <= 0. 959 // bitrate is <= 0.
948 960
949 // ISAC, default bitrate == 32000. 961 // ISAC, default bitrate == 32000.
950 TestMaxSendBandwidth(kIsacCodec, 0, true, 32000); 962 TestMaxSendBandwidth(kIsacCodec, 0, true, 32000);
951 963
(...skipping 2929 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3893 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3882 const int num_specs = static_cast<int>(specs.size()); 3894 const int num_specs = static_cast<int>(specs.size());
3883 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3895 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3884 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3896 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3885 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3897 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3886 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3898 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3887 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3899 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3888 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3900 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3889 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3901 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3890 } 3902 }
OLDNEW
« webrtc/media/engine/webrtcvoiceengine.cc ('K') | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698