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

Side by Side Diff: webrtc/pc/mediasession_unittest.cc

Issue 1871993002: Only generate one CNAME per PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Renaming: cname -> rtcp_cname. Modified the peerconnectioninterface unit tests. Created 4 years, 7 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/pc/mediasession.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 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 EXPECT_EQ(audio_streams[0], updated_audio_streams[0]); 1305 EXPECT_EQ(audio_streams[0], updated_audio_streams[0]);
1306 EXPECT_EQ(kAudioTrack3, updated_audio_streams[1].id); // New audio track. 1306 EXPECT_EQ(kAudioTrack3, updated_audio_streams[1].id); // New audio track.
1307 ASSERT_EQ(1U, updated_audio_streams[1].ssrcs.size()); 1307 ASSERT_EQ(1U, updated_audio_streams[1].ssrcs.size());
1308 EXPECT_NE(0U, updated_audio_streams[1].ssrcs[0]); 1308 EXPECT_NE(0U, updated_audio_streams[1].ssrcs[0]);
1309 EXPECT_EQ(updated_audio_streams[0].cname, updated_audio_streams[1].cname); 1309 EXPECT_EQ(updated_audio_streams[0].cname, updated_audio_streams[1].cname);
1310 1310
1311 const StreamParamsVec& updated_video_streams = updated_vcd->streams(); 1311 const StreamParamsVec& updated_video_streams = updated_vcd->streams();
1312 ASSERT_EQ(2U, updated_video_streams.size()); 1312 ASSERT_EQ(2U, updated_video_streams.size());
1313 EXPECT_EQ(video_streams[0], updated_video_streams[0]); 1313 EXPECT_EQ(video_streams[0], updated_video_streams[0]);
1314 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id); 1314 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id);
1315 EXPECT_NE(updated_video_streams[1].cname, updated_video_streams[0].cname); 1315 // All the media streams in one PeerConnection share one RTCP CNAME.
1316 EXPECT_EQ(updated_video_streams[1].cname, updated_video_streams[0].cname);
1316 1317
1317 const StreamParamsVec& updated_data_streams = updated_dcd->streams(); 1318 const StreamParamsVec& updated_data_streams = updated_dcd->streams();
1318 ASSERT_EQ(2U, updated_data_streams.size()); 1319 ASSERT_EQ(2U, updated_data_streams.size());
1319 EXPECT_EQ(data_streams[0], updated_data_streams[0]); 1320 EXPECT_EQ(data_streams[0], updated_data_streams[0]);
1320 EXPECT_EQ(kDataTrack3, updated_data_streams[1].id); // New data track. 1321 EXPECT_EQ(kDataTrack3, updated_data_streams[1].id); // New data track.
1321 ASSERT_EQ(1U, updated_data_streams[1].ssrcs.size()); 1322 ASSERT_EQ(1U, updated_data_streams[1].ssrcs.size());
1322 EXPECT_NE(0U, updated_data_streams[1].ssrcs[0]); 1323 EXPECT_NE(0U, updated_data_streams[1].ssrcs[0]);
1323 EXPECT_EQ(updated_data_streams[0].cname, updated_data_streams[1].cname); 1324 EXPECT_EQ(updated_data_streams[0].cname, updated_data_streams[1].cname);
1325 // The stream correctly got the CNAME from the MediaSessionOptions.
1326 // The Expected RTCP CNAME is the default one as we are using the default
1327 // MediaSessionOptions.
1328 EXPECT_EQ(updated_data_streams[0].cname, cricket::kDefaultRtcpCname);
1324 } 1329 }
1325 1330
1326 // Create an offer with simulcast video stream. 1331 // Create an offer with simulcast video stream.
1327 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSimulcastVideoOffer) { 1332 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSimulcastVideoOffer) {
1328 MediaSessionOptions opts; 1333 MediaSessionOptions opts;
1329 const int num_sim_layers = 3; 1334 const int num_sim_layers = 3;
1330 opts.AddSendVideoStream(kVideoTrack1, kMediaStream1, num_sim_layers); 1335 opts.AddSendVideoStream(kVideoTrack1, kMediaStream1, num_sim_layers);
1331 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); 1336 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
1332 1337
1333 ASSERT_TRUE(offer.get() != NULL); 1338 ASSERT_TRUE(offer.get() != NULL);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 EXPECT_NE(0U, data_streams[0].ssrcs[0]); 1429 EXPECT_NE(0U, data_streams[0].ssrcs[0]);
1425 EXPECT_EQ(kDataTrack2, data_streams[1].id); 1430 EXPECT_EQ(kDataTrack2, data_streams[1].id);
1426 ASSERT_EQ(1U, data_streams[1].ssrcs.size()); 1431 ASSERT_EQ(1U, data_streams[1].ssrcs.size());
1427 EXPECT_NE(0U, data_streams[1].ssrcs[0]); 1432 EXPECT_NE(0U, data_streams[1].ssrcs[0]);
1428 1433
1429 EXPECT_EQ(cricket::kDataMaxBandwidth, 1434 EXPECT_EQ(cricket::kDataMaxBandwidth,
1430 dcd->bandwidth()); // default bandwidth (auto) 1435 dcd->bandwidth()); // default bandwidth (auto)
1431 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on 1436 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on
1432 1437
1433 // Update the answer. Add a new video track that is not synched to the 1438 // Update the answer. Add a new video track that is not synched to the
1434 // other traacks and remove 1 audio track. 1439 // other tracks and remove 1 audio track.
1435 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2); 1440 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2);
1436 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2); 1441 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2);
1437 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2); 1442 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2);
1438 std::unique_ptr<SessionDescription> updated_answer( 1443 std::unique_ptr<SessionDescription> updated_answer(
1439 f2_.CreateAnswer(offer.get(), opts, answer.get())); 1444 f2_.CreateAnswer(offer.get(), opts, answer.get()));
1440 1445
1441 ASSERT_TRUE(updated_answer.get() != NULL); 1446 ASSERT_TRUE(updated_answer.get() != NULL);
1442 ac = updated_answer->GetContentByName("audio"); 1447 ac = updated_answer->GetContentByName("audio");
1443 vc = updated_answer->GetContentByName("video"); 1448 vc = updated_answer->GetContentByName("video");
1444 dc = updated_answer->GetContentByName("data"); 1449 dc = updated_answer->GetContentByName("data");
(...skipping 22 matching lines...) Expand all
1467 EXPECT_EQ(dcd->codecs(), updated_dcd->codecs()); 1472 EXPECT_EQ(dcd->codecs(), updated_dcd->codecs());
1468 1473
1469 const StreamParamsVec& updated_audio_streams = updated_acd->streams(); 1474 const StreamParamsVec& updated_audio_streams = updated_acd->streams();
1470 ASSERT_EQ(1U, updated_audio_streams.size()); 1475 ASSERT_EQ(1U, updated_audio_streams.size());
1471 EXPECT_TRUE(audio_streams[0] == updated_audio_streams[0]); 1476 EXPECT_TRUE(audio_streams[0] == updated_audio_streams[0]);
1472 1477
1473 const StreamParamsVec& updated_video_streams = updated_vcd->streams(); 1478 const StreamParamsVec& updated_video_streams = updated_vcd->streams();
1474 ASSERT_EQ(2U, updated_video_streams.size()); 1479 ASSERT_EQ(2U, updated_video_streams.size());
1475 EXPECT_EQ(video_streams[0], updated_video_streams[0]); 1480 EXPECT_EQ(video_streams[0], updated_video_streams[0]);
1476 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id); 1481 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id);
1477 EXPECT_NE(updated_video_streams[1].cname, updated_video_streams[0].cname); 1482 // All media streams in one PeerConnection share one CNAME.
1483 EXPECT_EQ(updated_video_streams[1].cname, updated_video_streams[0].cname);
1478 1484
1479 const StreamParamsVec& updated_data_streams = updated_dcd->streams(); 1485 const StreamParamsVec& updated_data_streams = updated_dcd->streams();
1480 ASSERT_EQ(1U, updated_data_streams.size()); 1486 ASSERT_EQ(1U, updated_data_streams.size());
1481 EXPECT_TRUE(data_streams[0] == updated_data_streams[0]); 1487 EXPECT_TRUE(data_streams[0] == updated_data_streams[0]);
1482 } 1488 }
1483 1489
1484 1490
1485 // Create an updated offer after creating an answer to the original offer and 1491 // Create an updated offer after creating an answer to the original offer and
1486 // verify that the codecs that were part of the original answer are not changed 1492 // verify that the codecs that were part of the original answer are not changed
1487 // in the updated offer. 1493 // in the updated offer.
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 EXPECT_EQ(GetParam(), acd->protocol()); 2443 EXPECT_EQ(GetParam(), acd->protocol());
2438 EXPECT_EQ(GetParam(), vcd->protocol()); 2444 EXPECT_EQ(GetParam(), vcd->protocol());
2439 } 2445 }
2440 2446
2441 INSTANTIATE_TEST_CASE_P(MediaProtocolPatternTest, 2447 INSTANTIATE_TEST_CASE_P(MediaProtocolPatternTest,
2442 MediaProtocolTest, 2448 MediaProtocolTest,
2443 ::testing::ValuesIn(kMediaProtocols)); 2449 ::testing::ValuesIn(kMediaProtocols));
2444 INSTANTIATE_TEST_CASE_P(MediaProtocolDtlsPatternTest, 2450 INSTANTIATE_TEST_CASE_P(MediaProtocolDtlsPatternTest,
2445 MediaProtocolTest, 2451 MediaProtocolTest,
2446 ::testing::ValuesIn(kMediaProtocolsDtls)); 2452 ::testing::ValuesIn(kMediaProtocolsDtls));
OLDNEW
« no previous file with comments | « webrtc/pc/mediasession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698