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

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

Issue 1813763005: Updated structures and functions for setting the max bitrate limit to take rtc::Optional<int> Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Code review feedback 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
« no previous file with comments | « webrtc/pc/mediasession.h ('k') | webrtc/video/screenshare_loopback.cc » ('j') | 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 using cricket::CryptoParamsVec; 52 using cricket::CryptoParamsVec;
53 using cricket::AudioContentDescription; 53 using cricket::AudioContentDescription;
54 using cricket::VideoContentDescription; 54 using cricket::VideoContentDescription;
55 using cricket::DataContentDescription; 55 using cricket::DataContentDescription;
56 using cricket::GetFirstAudioContent; 56 using cricket::GetFirstAudioContent;
57 using cricket::GetFirstVideoContent; 57 using cricket::GetFirstVideoContent;
58 using cricket::GetFirstDataContent; 58 using cricket::GetFirstDataContent;
59 using cricket::GetFirstAudioContentDescription; 59 using cricket::GetFirstAudioContentDescription;
60 using cricket::GetFirstVideoContentDescription; 60 using cricket::GetFirstVideoContentDescription;
61 using cricket::GetFirstDataContentDescription; 61 using cricket::GetFirstDataContentDescription;
62 using cricket::kAutoBandwidth;
63 using cricket::AudioCodec; 62 using cricket::AudioCodec;
64 using cricket::VideoCodec; 63 using cricket::VideoCodec;
65 using cricket::DataCodec; 64 using cricket::DataCodec;
66 using cricket::NS_JINGLE_RTP; 65 using cricket::NS_JINGLE_RTP;
67 using cricket::MEDIA_TYPE_AUDIO; 66 using cricket::MEDIA_TYPE_AUDIO;
68 using cricket::MEDIA_TYPE_VIDEO; 67 using cricket::MEDIA_TYPE_VIDEO;
69 using cricket::MEDIA_TYPE_DATA; 68 using cricket::MEDIA_TYPE_DATA;
70 using cricket::RtpHeaderExtension; 69 using cricket::RtpHeaderExtension;
71 using cricket::SEC_DISABLED; 70 using cricket::SEC_DISABLED;
72 using cricket::SEC_ENABLED; 71 using cricket::SEC_ENABLED;
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 const ContentInfo* ac = offer->GetContentByName("audio"); 469 const ContentInfo* ac = offer->GetContentByName("audio");
471 const ContentInfo* vc = offer->GetContentByName("video"); 470 const ContentInfo* vc = offer->GetContentByName("video");
472 ASSERT_TRUE(ac != NULL); 471 ASSERT_TRUE(ac != NULL);
473 ASSERT_TRUE(vc == NULL); 472 ASSERT_TRUE(vc == NULL);
474 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type); 473 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type);
475 const AudioContentDescription* acd = 474 const AudioContentDescription* acd =
476 static_cast<const AudioContentDescription*>(ac->description); 475 static_cast<const AudioContentDescription*>(ac->description);
477 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type()); 476 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
478 EXPECT_EQ(f1_.audio_codecs(), acd->codecs()); 477 EXPECT_EQ(f1_.audio_codecs(), acd->codecs());
479 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc 478 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc
480 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto) 479 EXPECT_EQ(rtc::Optional<int>(),
480 acd->bandwidth()); // default bandwidth (auto)
481 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on 481 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
482 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32); 482 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32);
483 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol()); 483 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol());
484 } 484 }
485 485
486 // Create a typical video offer, and ensure it matches what we expect. 486 // Create a typical video offer, and ensure it matches what we expect.
487 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoOffer) { 487 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoOffer) {
488 MediaSessionOptions opts; 488 MediaSessionOptions opts;
489 opts.recv_video = true; 489 opts.recv_video = true;
490 f1_.set_secure(SEC_ENABLED); 490 f1_.set_secure(SEC_ENABLED);
491 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); 491 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
492 ASSERT_TRUE(offer.get() != NULL); 492 ASSERT_TRUE(offer.get() != NULL);
493 const ContentInfo* ac = offer->GetContentByName("audio"); 493 const ContentInfo* ac = offer->GetContentByName("audio");
494 const ContentInfo* vc = offer->GetContentByName("video"); 494 const ContentInfo* vc = offer->GetContentByName("video");
495 ASSERT_TRUE(ac != NULL); 495 ASSERT_TRUE(ac != NULL);
496 ASSERT_TRUE(vc != NULL); 496 ASSERT_TRUE(vc != NULL);
497 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type); 497 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type);
498 EXPECT_EQ(std::string(NS_JINGLE_RTP), vc->type); 498 EXPECT_EQ(std::string(NS_JINGLE_RTP), vc->type);
499 const AudioContentDescription* acd = 499 const AudioContentDescription* acd =
500 static_cast<const AudioContentDescription*>(ac->description); 500 static_cast<const AudioContentDescription*>(ac->description);
501 const VideoContentDescription* vcd = 501 const VideoContentDescription* vcd =
502 static_cast<const VideoContentDescription*>(vc->description); 502 static_cast<const VideoContentDescription*>(vc->description);
503 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type()); 503 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
504 EXPECT_EQ(f1_.audio_codecs(), acd->codecs()); 504 EXPECT_EQ(f1_.audio_codecs(), acd->codecs());
505 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc 505 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc
506 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto) 506 EXPECT_EQ(rtc::Optional<int>(),
507 acd->bandwidth()); // default bandwidth (auto)
507 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on 508 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
508 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32); 509 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32);
509 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol()); 510 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol());
510 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type()); 511 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type());
511 EXPECT_EQ(f1_.video_codecs(), vcd->codecs()); 512 EXPECT_EQ(f1_.video_codecs(), vcd->codecs());
512 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc 513 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc
513 EXPECT_EQ(kAutoBandwidth, vcd->bandwidth()); // default bandwidth (auto) 514 EXPECT_EQ(rtc::Optional<int>(),
515 vcd->bandwidth()); // default bandwidth (auto)
514 EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on 516 EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on
515 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 517 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
516 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol()); 518 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol());
517 } 519 }
518 520
519 // Test creating an offer with bundle where the Codecs have the same dynamic 521 // Test creating an offer with bundle where the Codecs have the same dynamic
520 // RTP playlod type. The test verifies that the offer don't contain the 522 // RTP playlod type. The test verifies that the offer don't contain the
521 // duplicate RTP payload types. 523 // duplicate RTP payload types.
522 TEST_F(MediaSessionDescriptionFactoryTest, TestBundleOfferWithSameCodecPlType) { 524 TEST_F(MediaSessionDescriptionFactoryTest, TestBundleOfferWithSameCodecPlType) {
523 const VideoCodec& offered_video_codec = f2_.video_codecs()[0]; 525 const VideoCodec& offered_video_codec = f2_.video_codecs()[0];
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 ASSERT_TRUE(dc != NULL); 605 ASSERT_TRUE(dc != NULL);
604 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type); 606 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type);
605 EXPECT_EQ(std::string(NS_JINGLE_RTP), dc->type); 607 EXPECT_EQ(std::string(NS_JINGLE_RTP), dc->type);
606 const AudioContentDescription* acd = 608 const AudioContentDescription* acd =
607 static_cast<const AudioContentDescription*>(ac->description); 609 static_cast<const AudioContentDescription*>(ac->description);
608 const DataContentDescription* dcd = 610 const DataContentDescription* dcd =
609 static_cast<const DataContentDescription*>(dc->description); 611 static_cast<const DataContentDescription*>(dc->description);
610 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type()); 612 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
611 EXPECT_EQ(f1_.audio_codecs(), acd->codecs()); 613 EXPECT_EQ(f1_.audio_codecs(), acd->codecs());
612 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc 614 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc
613 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto) 615 EXPECT_EQ(rtc::Optional<int>(),
616 acd->bandwidth()); // default bandwidth (auto)
614 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on 617 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
615 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32); 618 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32);
616 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol()); 619 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol());
617 EXPECT_EQ(MEDIA_TYPE_DATA, dcd->type()); 620 EXPECT_EQ(MEDIA_TYPE_DATA, dcd->type());
618 EXPECT_EQ(f1_.data_codecs(), dcd->codecs()); 621 EXPECT_EQ(f1_.data_codecs(), dcd->codecs());
619 EXPECT_NE(0U, dcd->first_ssrc()); // a random nonzero ssrc 622 EXPECT_NE(0U, dcd->first_ssrc()); // a random nonzero ssrc
623 EXPECT_TRUE(dcd->bandwidth());
620 EXPECT_EQ(cricket::kDataMaxBandwidth, 624 EXPECT_EQ(cricket::kDataMaxBandwidth,
621 dcd->bandwidth()); // default bandwidth (auto) 625 *dcd->bandwidth()); // default bandwidth (auto)
622 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on 626 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on
623 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 627 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
624 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), dcd->protocol()); 628 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), dcd->protocol());
625 } 629 }
626 630
627 // Create an SCTP data offer with bundle without error. 631 // Create an SCTP data offer with bundle without error.
628 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSctpDataOffer) { 632 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSctpDataOffer) {
629 MediaSessionOptions opts; 633 MediaSessionOptions opts;
630 opts.recv_audio = false; 634 opts.recv_audio = false;
631 opts.bundle_enabled = true; 635 opts.bundle_enabled = true;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL)); 757 f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
754 const ContentInfo* ac = answer->GetContentByName("audio"); 758 const ContentInfo* ac = answer->GetContentByName("audio");
755 const ContentInfo* vc = answer->GetContentByName("video"); 759 const ContentInfo* vc = answer->GetContentByName("video");
756 ASSERT_TRUE(ac != NULL); 760 ASSERT_TRUE(ac != NULL);
757 ASSERT_TRUE(vc == NULL); 761 ASSERT_TRUE(vc == NULL);
758 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type); 762 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type);
759 const AudioContentDescription* acd = 763 const AudioContentDescription* acd =
760 static_cast<const AudioContentDescription*>(ac->description); 764 static_cast<const AudioContentDescription*>(ac->description);
761 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type()); 765 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
762 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs()); 766 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs());
763 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc 767 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc
764 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw 768 EXPECT_EQ(rtc::Optional<int>(), acd->bandwidth()); // negotiated auto bw
765 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux 769 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
766 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_32); 770 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_32);
767 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol()); 771 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), acd->protocol());
768 } 772 }
769 773
770 // Create a typical video answer, and ensure it matches what we expect. 774 // Create a typical video answer, and ensure it matches what we expect.
771 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoAnswer) { 775 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoAnswer) {
772 MediaSessionOptions opts; 776 MediaSessionOptions opts;
773 opts.recv_video = true; 777 opts.recv_video = true;
774 f1_.set_secure(SEC_ENABLED); 778 f1_.set_secure(SEC_ENABLED);
775 f2_.set_secure(SEC_ENABLED); 779 f2_.set_secure(SEC_ENABLED);
776 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); 780 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
777 ASSERT_TRUE(offer.get() != NULL); 781 ASSERT_TRUE(offer.get() != NULL);
778 std::unique_ptr<SessionDescription> answer( 782 std::unique_ptr<SessionDescription> answer(
779 f2_.CreateAnswer(offer.get(), opts, NULL)); 783 f2_.CreateAnswer(offer.get(), opts, NULL));
780 const ContentInfo* ac = answer->GetContentByName("audio"); 784 const ContentInfo* ac = answer->GetContentByName("audio");
781 const ContentInfo* vc = answer->GetContentByName("video"); 785 const ContentInfo* vc = answer->GetContentByName("video");
782 ASSERT_TRUE(ac != NULL); 786 ASSERT_TRUE(ac != NULL);
783 ASSERT_TRUE(vc != NULL); 787 ASSERT_TRUE(vc != NULL);
784 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type); 788 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type);
785 EXPECT_EQ(std::string(NS_JINGLE_RTP), vc->type); 789 EXPECT_EQ(std::string(NS_JINGLE_RTP), vc->type);
786 const AudioContentDescription* acd = 790 const AudioContentDescription* acd =
787 static_cast<const AudioContentDescription*>(ac->description); 791 static_cast<const AudioContentDescription*>(ac->description);
788 const VideoContentDescription* vcd = 792 const VideoContentDescription* vcd =
789 static_cast<const VideoContentDescription*>(vc->description); 793 static_cast<const VideoContentDescription*>(vc->description);
790 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type()); 794 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
791 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs()); 795 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs());
792 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw 796 EXPECT_EQ(rtc::Optional<int>(), acd->bandwidth()); // negotiated auto bw
793 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc 797 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc
794 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux 798 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
795 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_32); 799 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_32);
796 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type()); 800 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type());
797 EXPECT_EQ(MAKE_VECTOR(kVideoCodecsAnswer), vcd->codecs()); 801 EXPECT_EQ(MAKE_VECTOR(kVideoCodecsAnswer), vcd->codecs());
798 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc 802 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc
799 EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux 803 EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux
800 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 804 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
801 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol()); 805 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol());
802 } 806 }
803 807
804 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateDataAnswer) { 808 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateDataAnswer) {
(...skipping 10 matching lines...) Expand all
815 ASSERT_TRUE(ac != NULL); 819 ASSERT_TRUE(ac != NULL);
816 ASSERT_TRUE(vc != NULL); 820 ASSERT_TRUE(vc != NULL);
817 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type); 821 EXPECT_EQ(std::string(NS_JINGLE_RTP), ac->type);
818 EXPECT_EQ(std::string(NS_JINGLE_RTP), vc->type); 822 EXPECT_EQ(std::string(NS_JINGLE_RTP), vc->type);
819 const AudioContentDescription* acd = 823 const AudioContentDescription* acd =
820 static_cast<const AudioContentDescription*>(ac->description); 824 static_cast<const AudioContentDescription*>(ac->description);
821 const DataContentDescription* vcd = 825 const DataContentDescription* vcd =
822 static_cast<const DataContentDescription*>(vc->description); 826 static_cast<const DataContentDescription*>(vc->description);
823 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type()); 827 EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
824 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs()); 828 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs());
825 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw 829 EXPECT_EQ(rtc::Optional<int>(), acd->bandwidth()); // negotiated auto bw
826 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc 830 EXPECT_NE(0U, acd->first_ssrc()); // a random nonzero ssrc
827 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux 831 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
828 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_32); 832 ASSERT_CRYPTO(acd, 1U, CS_AES_CM_128_HMAC_SHA1_32);
829 EXPECT_EQ(MEDIA_TYPE_DATA, vcd->type()); 833 EXPECT_EQ(MEDIA_TYPE_DATA, vcd->type());
830 EXPECT_EQ(MAKE_VECTOR(kDataCodecsAnswer), vcd->codecs()); 834 EXPECT_EQ(MAKE_VECTOR(kDataCodecsAnswer), vcd->codecs());
831 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc 835 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc
832 EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux 836 EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux
833 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 837 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
834 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol()); 838 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol());
835 } 839 }
836 840
837 // Verifies that the order of the media contents in the offer is preserved in 841 // Verifies that the order of the media contents in the offer is preserved in
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 const StreamParamsVec& audio_streams = acd->streams(); 1229 const StreamParamsVec& audio_streams = acd->streams();
1226 ASSERT_EQ(2U, audio_streams.size()); 1230 ASSERT_EQ(2U, audio_streams.size());
1227 EXPECT_EQ(audio_streams[0].cname , audio_streams[1].cname); 1231 EXPECT_EQ(audio_streams[0].cname , audio_streams[1].cname);
1228 EXPECT_EQ(kAudioTrack1, audio_streams[0].id); 1232 EXPECT_EQ(kAudioTrack1, audio_streams[0].id);
1229 ASSERT_EQ(1U, audio_streams[0].ssrcs.size()); 1233 ASSERT_EQ(1U, audio_streams[0].ssrcs.size());
1230 EXPECT_NE(0U, audio_streams[0].ssrcs[0]); 1234 EXPECT_NE(0U, audio_streams[0].ssrcs[0]);
1231 EXPECT_EQ(kAudioTrack2, audio_streams[1].id); 1235 EXPECT_EQ(kAudioTrack2, audio_streams[1].id);
1232 ASSERT_EQ(1U, audio_streams[1].ssrcs.size()); 1236 ASSERT_EQ(1U, audio_streams[1].ssrcs.size());
1233 EXPECT_NE(0U, audio_streams[1].ssrcs[0]); 1237 EXPECT_NE(0U, audio_streams[1].ssrcs[0]);
1234 1238
1235 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto) 1239 EXPECT_EQ(rtc::Optional<int>(),
1240 acd->bandwidth()); // default bandwidth (auto)
1236 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on 1241 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
1237 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32); 1242 ASSERT_CRYPTO(acd, 2U, CS_AES_CM_128_HMAC_SHA1_32);
1238 1243
1239 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type()); 1244 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type());
1240 EXPECT_EQ(f1_.video_codecs(), vcd->codecs()); 1245 EXPECT_EQ(f1_.video_codecs(), vcd->codecs());
1241 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 1246 ASSERT_CRYPTO(vcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
1242 1247
1243 const StreamParamsVec& video_streams = vcd->streams(); 1248 const StreamParamsVec& video_streams = vcd->streams();
1244 ASSERT_EQ(1U, video_streams.size()); 1249 ASSERT_EQ(1U, video_streams.size());
1245 EXPECT_EQ(video_streams[0].cname, audio_streams[0].cname); 1250 EXPECT_EQ(video_streams[0].cname, audio_streams[0].cname);
1246 EXPECT_EQ(kVideoTrack1, video_streams[0].id); 1251 EXPECT_EQ(kVideoTrack1, video_streams[0].id);
1247 EXPECT_EQ(kAutoBandwidth, vcd->bandwidth()); // default bandwidth (auto) 1252 EXPECT_EQ(rtc::Optional<int>(),
1253 vcd->bandwidth()); // default bandwidth (auto)
1248 EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on 1254 EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on
1249 1255
1250 EXPECT_EQ(MEDIA_TYPE_DATA, dcd->type()); 1256 EXPECT_EQ(MEDIA_TYPE_DATA, dcd->type());
1251 EXPECT_EQ(f1_.data_codecs(), dcd->codecs()); 1257 EXPECT_EQ(f1_.data_codecs(), dcd->codecs());
1252 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 1258 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
1253 1259
1254 const StreamParamsVec& data_streams = dcd->streams(); 1260 const StreamParamsVec& data_streams = dcd->streams();
1255 ASSERT_EQ(2U, data_streams.size()); 1261 ASSERT_EQ(2U, data_streams.size());
1256 EXPECT_EQ(data_streams[0].cname , data_streams[1].cname); 1262 EXPECT_EQ(data_streams[0].cname , data_streams[1].cname);
1257 EXPECT_EQ(kDataTrack1, data_streams[0].id); 1263 EXPECT_EQ(kDataTrack1, data_streams[0].id);
1258 ASSERT_EQ(1U, data_streams[0].ssrcs.size()); 1264 ASSERT_EQ(1U, data_streams[0].ssrcs.size());
1259 EXPECT_NE(0U, data_streams[0].ssrcs[0]); 1265 EXPECT_NE(0U, data_streams[0].ssrcs[0]);
1260 EXPECT_EQ(kDataTrack2, data_streams[1].id); 1266 EXPECT_EQ(kDataTrack2, data_streams[1].id);
1261 ASSERT_EQ(1U, data_streams[1].ssrcs.size()); 1267 ASSERT_EQ(1U, data_streams[1].ssrcs.size());
1262 EXPECT_NE(0U, data_streams[1].ssrcs[0]); 1268 EXPECT_NE(0U, data_streams[1].ssrcs[0]);
1263 1269
1270 EXPECT_TRUE(dcd->bandwidth());
1264 EXPECT_EQ(cricket::kDataMaxBandwidth, 1271 EXPECT_EQ(cricket::kDataMaxBandwidth,
1265 dcd->bandwidth()); // default bandwidth (auto) 1272 *dcd->bandwidth()); // default bandwidth (auto)
1266 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on 1273 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on
1267 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80); 1274 ASSERT_CRYPTO(dcd, 1U, CS_AES_CM_128_HMAC_SHA1_80);
1268 1275
1269 1276
1270 // Update the offer. Add a new video track that is not synched to the 1277 // Update the offer. Add a new video track that is not synched to the
1271 // other tracks and replace audio track 2 with audio track 3. 1278 // other tracks and replace audio track 2 with audio track 3.
1272 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2); 1279 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2);
1273 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2); 1280 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2);
1274 opts.AddSendStream(MEDIA_TYPE_AUDIO, kAudioTrack3, kMediaStream1); 1281 opts.AddSendStream(MEDIA_TYPE_AUDIO, kAudioTrack3, kMediaStream1);
1275 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2); 1282 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 const StreamParamsVec& audio_streams = acd->streams(); 1404 const StreamParamsVec& audio_streams = acd->streams();
1398 ASSERT_EQ(2U, audio_streams.size()); 1405 ASSERT_EQ(2U, audio_streams.size());
1399 EXPECT_TRUE(audio_streams[0].cname == audio_streams[1].cname); 1406 EXPECT_TRUE(audio_streams[0].cname == audio_streams[1].cname);
1400 EXPECT_EQ(kAudioTrack1, audio_streams[0].id); 1407 EXPECT_EQ(kAudioTrack1, audio_streams[0].id);
1401 ASSERT_EQ(1U, audio_streams[0].ssrcs.size()); 1408 ASSERT_EQ(1U, audio_streams[0].ssrcs.size());
1402 EXPECT_NE(0U, audio_streams[0].ssrcs[0]); 1409 EXPECT_NE(0U, audio_streams[0].ssrcs[0]);
1403 EXPECT_EQ(kAudioTrack2, audio_streams[1].id); 1410 EXPECT_EQ(kAudioTrack2, audio_streams[1].id);
1404 ASSERT_EQ(1U, audio_streams[1].ssrcs.size()); 1411 ASSERT_EQ(1U, audio_streams[1].ssrcs.size());
1405 EXPECT_NE(0U, audio_streams[1].ssrcs[0]); 1412 EXPECT_NE(0U, audio_streams[1].ssrcs[0]);
1406 1413
1407 EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto) 1414 EXPECT_EQ(rtc::Optional<int>(),
1415 acd->bandwidth()); // default bandwidth (auto)
1408 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on 1416 EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
1409 1417
1410 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type()); 1418 EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type());
1411 EXPECT_EQ(MAKE_VECTOR(kVideoCodecsAnswer), vcd->codecs()); 1419 EXPECT_EQ(MAKE_VECTOR(kVideoCodecsAnswer), vcd->codecs());
1412 1420
1413 const StreamParamsVec& video_streams = vcd->streams(); 1421 const StreamParamsVec& video_streams = vcd->streams();
1414 ASSERT_EQ(1U, video_streams.size()); 1422 ASSERT_EQ(1U, video_streams.size());
1415 EXPECT_EQ(video_streams[0].cname, audio_streams[0].cname); 1423 EXPECT_EQ(video_streams[0].cname, audio_streams[0].cname);
1416 EXPECT_EQ(kVideoTrack1, video_streams[0].id); 1424 EXPECT_EQ(kVideoTrack1, video_streams[0].id);
1417 EXPECT_EQ(kAutoBandwidth, vcd->bandwidth()); // default bandwidth (auto) 1425 EXPECT_EQ(rtc::Optional<int>(), vcd->bandwidth()); // default bandwidth
1418 EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on 1426 EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on
1419 1427
1420 EXPECT_EQ(MEDIA_TYPE_DATA, dcd->type()); 1428 EXPECT_EQ(MEDIA_TYPE_DATA, dcd->type());
1421 EXPECT_EQ(MAKE_VECTOR(kDataCodecsAnswer), dcd->codecs()); 1429 EXPECT_EQ(MAKE_VECTOR(kDataCodecsAnswer), dcd->codecs());
1422 1430
1423 const StreamParamsVec& data_streams = dcd->streams(); 1431 const StreamParamsVec& data_streams = dcd->streams();
1424 ASSERT_EQ(2U, data_streams.size()); 1432 ASSERT_EQ(2U, data_streams.size());
1425 EXPECT_TRUE(data_streams[0].cname == data_streams[1].cname); 1433 EXPECT_TRUE(data_streams[0].cname == data_streams[1].cname);
1426 EXPECT_EQ(kDataTrack1, data_streams[0].id); 1434 EXPECT_EQ(kDataTrack1, data_streams[0].id);
1427 ASSERT_EQ(1U, data_streams[0].ssrcs.size()); 1435 ASSERT_EQ(1U, data_streams[0].ssrcs.size());
1428 EXPECT_NE(0U, data_streams[0].ssrcs[0]); 1436 EXPECT_NE(0U, data_streams[0].ssrcs[0]);
1429 EXPECT_EQ(kDataTrack2, data_streams[1].id); 1437 EXPECT_EQ(kDataTrack2, data_streams[1].id);
1430 ASSERT_EQ(1U, data_streams[1].ssrcs.size()); 1438 ASSERT_EQ(1U, data_streams[1].ssrcs.size());
1431 EXPECT_NE(0U, data_streams[1].ssrcs[0]); 1439 EXPECT_NE(0U, data_streams[1].ssrcs[0]);
1432 1440
1441 EXPECT_TRUE(dcd->bandwidth());
1433 EXPECT_EQ(cricket::kDataMaxBandwidth, 1442 EXPECT_EQ(cricket::kDataMaxBandwidth,
1434 dcd->bandwidth()); // default bandwidth (auto) 1443 *dcd->bandwidth()); // default bandwidth (auto)
1435 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on 1444 EXPECT_TRUE(dcd->rtcp_mux()); // rtcp-mux defaults on
1436 1445
1437 // Update the answer. Add a new video track that is not synched to the 1446 // Update the answer. Add a new video track that is not synched to the
1438 // other traacks and remove 1 audio track. 1447 // other traacks and remove 1 audio track.
1439 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2); 1448 opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2);
1440 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2); 1449 opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2);
1441 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2); 1450 opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2);
1442 std::unique_ptr<SessionDescription> updated_answer( 1451 std::unique_ptr<SessionDescription> updated_answer(
1443 f2_.CreateAnswer(offer.get(), opts, answer.get())); 1452 f2_.CreateAnswer(offer.get(), opts, answer.get()));
1444 1453
1445 ASSERT_TRUE(updated_answer.get() != NULL); 1454 ASSERT_TRUE(updated_answer.get() != NULL);
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get()); 2393 const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get());
2385 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get()); 2394 const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get());
2386 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get()); 2395 const ContentInfo* data_content = GetFirstDataContent(updated_offer.get());
2387 ASSERT_TRUE(audio_content != nullptr); 2396 ASSERT_TRUE(audio_content != nullptr);
2388 ASSERT_TRUE(video_content != nullptr); 2397 ASSERT_TRUE(video_content != nullptr);
2389 ASSERT_TRUE(data_content != nullptr); 2398 ASSERT_TRUE(data_content != nullptr);
2390 EXPECT_EQ("audio_modified", audio_content->name); 2399 EXPECT_EQ("audio_modified", audio_content->name);
2391 EXPECT_EQ("video_modified", video_content->name); 2400 EXPECT_EQ("video_modified", video_content->name);
2392 EXPECT_EQ("data_modified", data_content->name); 2401 EXPECT_EQ("data_modified", data_content->name);
2393 } 2402 }
OLDNEW
« no previous file with comments | « webrtc/pc/mediasession.h ('k') | webrtc/video/screenshare_loopback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698