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

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: Add unit tests in peerconnectioninterface_unittest Created 4 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
« webrtc/pc/mediasession.h ('K') | « 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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 EXPECT_EQ(audio_streams[0], updated_audio_streams[0]); 1299 EXPECT_EQ(audio_streams[0], updated_audio_streams[0]);
1300 EXPECT_EQ(kAudioTrack3, updated_audio_streams[1].id); // New audio track. 1300 EXPECT_EQ(kAudioTrack3, updated_audio_streams[1].id); // New audio track.
1301 ASSERT_EQ(1U, updated_audio_streams[1].ssrcs.size()); 1301 ASSERT_EQ(1U, updated_audio_streams[1].ssrcs.size());
1302 EXPECT_NE(0U, updated_audio_streams[1].ssrcs[0]); 1302 EXPECT_NE(0U, updated_audio_streams[1].ssrcs[0]);
1303 EXPECT_EQ(updated_audio_streams[0].cname, updated_audio_streams[1].cname); 1303 EXPECT_EQ(updated_audio_streams[0].cname, updated_audio_streams[1].cname);
1304 1304
1305 const StreamParamsVec& updated_video_streams = updated_vcd->streams(); 1305 const StreamParamsVec& updated_video_streams = updated_vcd->streams();
1306 ASSERT_EQ(2U, updated_video_streams.size()); 1306 ASSERT_EQ(2U, updated_video_streams.size());
1307 EXPECT_EQ(video_streams[0], updated_video_streams[0]); 1307 EXPECT_EQ(video_streams[0], updated_video_streams[0]);
1308 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id); 1308 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id);
1309 EXPECT_NE(updated_video_streams[1].cname, updated_video_streams[0].cname); 1309 // All the media streams in one PeerConnection share one CNAME.
1310 EXPECT_EQ(updated_video_streams[1].cname, updated_video_streams[0].cname);
1310 1311
1311 const StreamParamsVec& updated_data_streams = updated_dcd->streams(); 1312 const StreamParamsVec& updated_data_streams = updated_dcd->streams();
1312 ASSERT_EQ(2U, updated_data_streams.size()); 1313 ASSERT_EQ(2U, updated_data_streams.size());
1313 EXPECT_EQ(data_streams[0], updated_data_streams[0]); 1314 EXPECT_EQ(data_streams[0], updated_data_streams[0]);
1314 EXPECT_EQ(kDataTrack3, updated_data_streams[1].id); // New data track. 1315 EXPECT_EQ(kDataTrack3, updated_data_streams[1].id); // New data track.
1315 ASSERT_EQ(1U, updated_data_streams[1].ssrcs.size()); 1316 ASSERT_EQ(1U, updated_data_streams[1].ssrcs.size());
1316 EXPECT_NE(0U, updated_data_streams[1].ssrcs[0]); 1317 EXPECT_NE(0U, updated_data_streams[1].ssrcs[0]);
1317 EXPECT_EQ(updated_data_streams[0].cname, updated_data_streams[1].cname); 1318 EXPECT_EQ(updated_data_streams[0].cname, updated_data_streams[1].cname);
1319 // The stream correctly got the CNAME from the MediaSessionOptions.
1320 // The Expected CNAME is the default one as we are using the default
1321 // MediaSessionOptions.
1322 EXPECT_EQ(updated_data_streams[0].cname, cricket::kDefaultCname);
1318 } 1323 }
1319 1324
1320 // Create an offer with simulcast video stream. 1325 // Create an offer with simulcast video stream.
1321 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSimulcastVideoOffer) { 1326 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSimulcastVideoOffer) {
1322 MediaSessionOptions opts; 1327 MediaSessionOptions opts;
1323 const int num_sim_layers = 3; 1328 const int num_sim_layers = 3;
1324 opts.AddSendVideoStream(kVideoTrack1, kMediaStream1, num_sim_layers); 1329 opts.AddSendVideoStream(kVideoTrack1, kMediaStream1, num_sim_layers);
1325 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); 1330 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
1326 1331
1327 ASSERT_TRUE(offer.get() != NULL); 1332 ASSERT_TRUE(offer.get() != NULL);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 EXPECT_NE(0U, data_streams[0].ssrcs[0]); 1423 EXPECT_NE(0U, data_streams[0].ssrcs[0]);
1419 EXPECT_EQ(kDataTrack2, data_streams[1].id); 1424 EXPECT_EQ(kDataTrack2, data_streams[1].id);
1420 ASSERT_EQ(1U, data_streams[1].ssrcs.size()); 1425 ASSERT_EQ(1U, data_streams[1].ssrcs.size());
1421 EXPECT_NE(0U, data_streams[1].ssrcs[0]); 1426 EXPECT_NE(0U, data_streams[1].ssrcs[0]);
1422 1427
1423 EXPECT_EQ(cricket::kDataMaxBandwidth, 1428 EXPECT_EQ(cricket::kDataMaxBandwidth,
1424 dcd->bandwidth()); // default bandwidth (auto) 1429 dcd->bandwidth()); // default bandwidth (auto)
1425 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on 1430 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on
1426 1431
1427 // Update the answer. Add a new video track that is not synched to the 1432 // Update the answer. Add a new video track that is not synched to the
1428 // other traacks and remove 1 audio track. 1433 // other tracks and remove 1 audio track.
1429 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2); 1434 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2);
1430 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2); 1435 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2);
1431 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2); 1436 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2);
1432 std::unique_ptr<SessionDescription> updated_answer( 1437 std::unique_ptr<SessionDescription> updated_answer(
1433 f2_.CreateAnswer(offer.get(), opts, answer.get())); 1438 f2_.CreateAnswer(offer.get(), opts, answer.get()));
1434 1439
1435 ASSERT_TRUE(updated_answer.get() != NULL); 1440 ASSERT_TRUE(updated_answer.get() != NULL);
1436 ac = updated_answer->GetContentByName("audio"); 1441 ac = updated_answer->GetContentByName("audio");
1437 vc = updated_answer->GetContentByName("video"); 1442 vc = updated_answer->GetContentByName("video");
1438 dc = updated_answer->GetContentByName("data"); 1443 dc = updated_answer->GetContentByName("data");
(...skipping 22 matching lines...) Expand all
1461 EXPECT_EQ(dcd->codecs(), updated_dcd->codecs()); 1466 EXPECT_EQ(dcd->codecs(), updated_dcd->codecs());
1462 1467
1463 const StreamParamsVec& updated_audio_streams = updated_acd->streams(); 1468 const StreamParamsVec& updated_audio_streams = updated_acd->streams();
1464 ASSERT_EQ(1U, updated_audio_streams.size()); 1469 ASSERT_EQ(1U, updated_audio_streams.size());
1465 EXPECT_TRUE(audio_streams[0] == updated_audio_streams[0]); 1470 EXPECT_TRUE(audio_streams[0] == updated_audio_streams[0]);
1466 1471
1467 const StreamParamsVec& updated_video_streams = updated_vcd->streams(); 1472 const StreamParamsVec& updated_video_streams = updated_vcd->streams();
1468 ASSERT_EQ(2U, updated_video_streams.size()); 1473 ASSERT_EQ(2U, updated_video_streams.size());
1469 EXPECT_EQ(video_streams[0], updated_video_streams[0]); 1474 EXPECT_EQ(video_streams[0], updated_video_streams[0]);
1470 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id); 1475 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id);
1471 EXPECT_NE(updated_video_streams[1].cname, updated_video_streams[0].cname); 1476 // All media streams in one PeerConnection share one CNAME.
1477 EXPECT_EQ(updated_video_streams[1].cname, updated_video_streams[0].cname);
1472 1478
1473 const StreamParamsVec& updated_data_streams = updated_dcd->streams(); 1479 const StreamParamsVec& updated_data_streams = updated_dcd->streams();
1474 ASSERT_EQ(1U, updated_data_streams.size()); 1480 ASSERT_EQ(1U, updated_data_streams.size());
1475 EXPECT_TRUE(data_streams[0] == updated_data_streams[0]); 1481 EXPECT_TRUE(data_streams[0] == updated_data_streams[0]);
1476 } 1482 }
1477 1483
1478 1484
1479 // Create an updated offer after creating an answer to the original offer and 1485 // Create an updated offer after creating an answer to the original offer and
1480 // verify that the codecs that were part of the original answer are not changed 1486 // verify that the codecs that were part of the original answer are not changed
1481 // in the updated offer. 1487 // in the updated offer.
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get()); 2378 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get());
2373 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get()); 2379 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get());
2374 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get()); 2380 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get());
2375 ASSERT_TRUE(audio_content != nullptr); 2381 ASSERT_TRUE(audio_content != nullptr);
2376 ASSERT_TRUE(video_content != nullptr); 2382 ASSERT_TRUE(video_content != nullptr);
2377 ASSERT_TRUE(data_content != nullptr); 2383 ASSERT_TRUE(data_content != nullptr);
2378 EXPECT_EQ("audio_modified", audio_content->name); 2384 EXPECT_EQ("audio_modified", audio_content->name);
2379 EXPECT_EQ("video_modified", video_content->name); 2385 EXPECT_EQ("video_modified", video_content->name);
2380 EXPECT_EQ("data_modified", data_content->name); 2386 EXPECT_EQ("data_modified", data_content->name);
2381 } 2387 }
OLDNEW
« webrtc/pc/mediasession.h ('K') | « webrtc/pc/mediasession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698