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 2806173002: Fix RtpReceiver.GetParameters when SSRCs aren't signaled. (Closed)
Patch Set: Changing behavior slightly in response to comment on https://github.com/w3c/webrtc-pc/issues/1116 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
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1231
1232 // We should be able to set the params we just got. 1232 // We should be able to set the params we just got.
1233 EXPECT_TRUE(channel_->SetRtpReceiveParameters(kSsrcX, initial_params)); 1233 EXPECT_TRUE(channel_->SetRtpReceiveParameters(kSsrcX, initial_params));
1234 1234
1235 // ... And this shouldn't change the params returned by 1235 // ... And this shouldn't change the params returned by
1236 // GetRtpReceiveParameters. 1236 // GetRtpReceiveParameters.
1237 webrtc::RtpParameters new_params = channel_->GetRtpReceiveParameters(kSsrcX); 1237 webrtc::RtpParameters new_params = channel_->GetRtpReceiveParameters(kSsrcX);
1238 EXPECT_EQ(initial_params, channel_->GetRtpReceiveParameters(kSsrcX)); 1238 EXPECT_EQ(initial_params, channel_->GetRtpReceiveParameters(kSsrcX));
1239 } 1239 }
1240 1240
1241 // Test that GetRtpReceiveParameters returns parameters correctly when SSRCs
1242 // aren't signaled. It should return an empty "RtpEncodingParameters" when
1243 // configured to receive an unsignaled stream and no packets have been received
1244 // yet, and start returning the SSRC once a packet has been received.
1245 TEST_F(WebRtcVoiceEngineTestFake, GetRtpReceiveParametersWithUnsignaledSsrc) {
1246 ASSERT_TRUE(SetupChannel());
1247 // Call necessary methods to configure receiving a default stream as
1248 // soon as it arrives.
1249 cricket::AudioRecvParameters parameters;
1250 parameters.codecs.push_back(kIsacCodec);
1251 parameters.codecs.push_back(kPcmuCodec);
1252 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1253
1254 // Call GetRtpReceiveParameters before configured to receive an unsignaled
1255 // stream. Should return nothing.
1256 EXPECT_EQ(webrtc::RtpParameters(), channel_->GetRtpReceiveParameters(0));
1257
1258 // Set a sink for an unsignaled stream.
1259 std::unique_ptr<FakeAudioSink> fake_sink(new FakeAudioSink());
1260 // Value of "0" means "unsignaled stream".
1261 channel_->SetRawAudioSink(0, std::move(fake_sink));
1262
1263 // Call GetRtpReceiveParameters before the SSRC is known. Value of "0"
1264 // in this method means "unsignaled stream".
1265 webrtc::RtpParameters rtp_parameters = channel_->GetRtpReceiveParameters(0);
1266 ASSERT_EQ(1u, rtp_parameters.encodings.size());
1267 EXPECT_FALSE(rtp_parameters.encodings[0].ssrc);
1268
1269 // Receive PCMU packet (SSRC=1).
1270 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
1271
1272 // The |ssrc| member should still be unset.
1273 rtp_parameters = channel_->GetRtpReceiveParameters(0);
1274 ASSERT_EQ(1u, rtp_parameters.encodings.size());
1275 EXPECT_FALSE(rtp_parameters.encodings[0].ssrc);
1276 }
1277
1241 // Test that we apply codecs properly. 1278 // Test that we apply codecs properly.
1242 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecs) { 1279 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecs) {
1243 EXPECT_TRUE(SetupSendStream()); 1280 EXPECT_TRUE(SetupSendStream());
1244 cricket::AudioSendParameters parameters; 1281 cricket::AudioSendParameters parameters;
1245 parameters.codecs.push_back(kIsacCodec); 1282 parameters.codecs.push_back(kIsacCodec);
1246 parameters.codecs.push_back(kPcmuCodec); 1283 parameters.codecs.push_back(kPcmuCodec);
1247 parameters.codecs.push_back(kCn8000Codec); 1284 parameters.codecs.push_back(kCn8000Codec);
1248 parameters.codecs[0].id = 96; 1285 parameters.codecs[0].id = 96;
1249 parameters.codecs[0].bitrate = 48000; 1286 parameters.codecs[0].bitrate = 48000;
1250 const int initial_num = call_.GetNumCreatedSendStreams(); 1287 const int initial_num = call_.GetNumCreatedSendStreams();
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after
3844 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3881 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3845 const int num_specs = static_cast<int>(specs.size()); 3882 const int num_specs = static_cast<int>(specs.size());
3846 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3883 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3847 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3884 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3848 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3885 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3849 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3886 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3850 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3887 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3851 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3888 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3852 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3889 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3853 } 3890 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698