tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 9fb52632dd9c2ba20ead6294bf7e94e5d85b3f46
parent 7031becbfee6bcdaa5c7a096ebb40eda0709237a
Author: Michael Froman <mfroman@mozilla.com>
Date:   Wed,  8 Oct 2025 22:01:11 -0500

Bug 1993083 - Vendor libwebrtc from d72cc2ffde

Upstream commit: https://webrtc.googlesource.com/src/+/d72cc2ffde0749ed18a5ebcc49dcee49b8465bcb
    Replace auto with unique_ptr<SessionDescriptionInterface>

    Done using
      git grep "auto offer =" | grep -v make_unique | awk -F ':' '{print $1}' | uniq | xargs sed -i 's/auto offer =/std::unique_ptr<SessionDescriptionInterface> offer =/g'
    (and for answer), reverting the few instances where this did not
    compile.

    Also change ASSERT_TRUE for those pointers to use NotNull() expectation using
      git grep "ASSERT_TRUE(answer)" | awk -F ':' '{print $1}' | uniq | xargs sed -i 's/ASSERT_TRUE(answer)/ASSERT_THAT(answer, NotNull())/'
    (also for offers and two instances of ASSERT_NE(thing, nullptr))

    Finally move some code blocks around a bit.

    F'up from https://webrtc-review.googlesource.com/c/src/+/398220

    Bug: None
    Change-Id: Ib24744da4fb80de3fb4f9760df38db98ae4a1f29
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/398840
    Commit-Queue: Philipp Hancke <phancke@meta.com>
    Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45092}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/p2p/base/transport_description_factory_unittest.cc | 4++--
Mthird_party/libwebrtc/pc/congestion_control_integrationtest.cc | 5++++-
Mthird_party/libwebrtc/pc/data_channel_integrationtest.cc | 5+++--
Mthird_party/libwebrtc/pc/media_session_unittest.cc | 73+++++++++++++++++++++++++++++++++++++++++--------------------------------
Mthird_party/libwebrtc/pc/peer_connection_bundle_unittest.cc | 47+++++++++++++++++++++++++++++------------------
Mthird_party/libwebrtc/pc/peer_connection_crypto_unittest.cc | 42+++++++++++++++++++++++++-----------------
Mthird_party/libwebrtc/pc/peer_connection_data_channel_unittest.cc | 24++++++++++++++----------
Mthird_party/libwebrtc/pc/peer_connection_field_trial_tests.cc | 7++++---
Mthird_party/libwebrtc/pc/peer_connection_header_extension_unittest.cc | 63++++++++++++++++++++++++++++++++++++++-------------------------
Mthird_party/libwebrtc/pc/peer_connection_histogram_unittest.cc | 5+++--
Mthird_party/libwebrtc/pc/peer_connection_ice_unittest.cc | 63++++++++++++++++++++++++++++++++++++---------------------------
Mthird_party/libwebrtc/pc/peer_connection_integrationtest.cc | 13++++++++-----
Mthird_party/libwebrtc/pc/peer_connection_interface_unittest.cc | 35++++++++++++++++++-----------------
Mthird_party/libwebrtc/pc/peer_connection_jsep_unittest.cc | 90++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mthird_party/libwebrtc/pc/peer_connection_media_unittest.cc | 140++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Mthird_party/libwebrtc/pc/peer_connection_rtp_unittest.cc | 26++++++++++++++++----------
Mthird_party/libwebrtc/pc/peer_connection_signaling_unittest.cc | 78++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Mthird_party/libwebrtc/pc/peer_connection_simulcast_unittest.cc | 58+++++++++++++++++++++++++++++++++-------------------------
Mthird_party/libwebrtc/pc/peer_connection_wrapper.cc | 10++++++----
Mthird_party/libwebrtc/pc/sdp_munging_detector_unittest.cc | 112+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mthird_party/libwebrtc/pc/sdp_offer_answer_unittest.cc | 85+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mthird_party/libwebrtc/pc/test/integration_test_helpers.h | 4++--
Mthird_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc | 4++--
Mthird_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc | 2+-
Mthird_party/libwebrtc/test/peer_scenario/signaling_route.cc | 3++-
26 files changed, 581 insertions(+), 421 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-09T02:59:57.874297+00:00. +libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-09T03:01:02.231323+00:00. # base of lastest vendoring -50aa2d768e +d72cc2ffde diff --git a/third_party/libwebrtc/p2p/base/transport_description_factory_unittest.cc b/third_party/libwebrtc/p2p/base/transport_description_factory_unittest.cc @@ -144,12 +144,12 @@ class TransportDescriptionFactoryTest : public ::testing::Test { // The initial offer / answer exchange. std::unique_ptr<TransportDescription> offer = f1_.CreateOffer(options, nullptr, &ice_credentials_); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_THAT(offer->transport_options, Not(Contains("renomination"))); std::unique_ptr<TransportDescription> answer = f2_.CreateAnswer( offer.get(), options, true, nullptr, &ice_credentials_); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); EXPECT_THAT(answer->transport_options, Not(Contains("renomination"))); options.enable_ice_renomination = true; diff --git a/third_party/libwebrtc/pc/congestion_control_integrationtest.cc b/third_party/libwebrtc/pc/congestion_control_integrationtest.cc @@ -11,9 +11,11 @@ // This file contains tests that verify that congestion control options // are correctly negotiated in the SDP offer/answer. +#include <memory> #include <string> #include "absl/strings/str_cat.h" +#include "api/jsep.h" #include "api/peer_connection_interface.h" #include "api/test/rtc_error_matchers.h" #include "pc/test/integration_test_helpers.h" @@ -40,7 +42,8 @@ TEST_F(PeerConnectionCongestionControlTest, OfferContainsCcfbIfEnabled) { SetFieldTrials("WebRTC-RFC8888CongestionControlFeedback/Enabled/"); ASSERT_TRUE(CreatePeerConnectionWrappers()); caller()->AddAudioVideoTracks(); - auto offer = caller()->CreateOfferAndWait(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller()->CreateOfferAndWait(); std::string offer_str = absl::StrCat(*offer); EXPECT_THAT(offer_str, HasSubstr("a=rtcp-fb:* ack ccfb\r\n")); } diff --git a/third_party/libwebrtc/pc/data_channel_integrationtest.cc b/third_party/libwebrtc/pc/data_channel_integrationtest.cc @@ -63,6 +63,7 @@ namespace { using ::testing::Eq; using ::testing::IsTrue; using ::testing::Ne; +using ::testing::NotNull; using ::testing::ValuesIn; // All tests in this file require SCTP support. @@ -1420,7 +1421,7 @@ TEST_P(DataChannelIntegrationTest, ChangingSctpPortIsNotAllowed) { answer.reset(desc.release()); }); caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); // Currently SRD succeeds. EXPECT_TRUE(caller()->SetRemoteDescription(std::move(answer))); @@ -1471,7 +1472,7 @@ TEST_P(DataChannelIntegrationTest, ChangingSctpPortIsAllowedWithDtlsRestart) { answer.reset(desc.release()); }); caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); EXPECT_TRUE(caller()->SetRemoteDescription(std::move(answer))); // Check the state of the SCTP transport. diff --git a/third_party/libwebrtc/pc/media_session_unittest.cc b/third_party/libwebrtc/pc/media_session_unittest.cc @@ -77,6 +77,7 @@ using ::testing::Field; using ::testing::Gt; using ::testing::IsEmpty; using ::testing::Not; +using ::testing::NotNull; using ::testing::Pointwise; using ::testing::SizeIs; using ::testing::UnorderedElementsAreArray; @@ -2017,7 +2018,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtpTransceiverDirection::kStopped), RtpHeaderExtensionCapability("uri3", 7, RtpTransceiverDirection::kSendOnly)}; - auto offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> offer = + f1_.CreateOfferOrError(opts, nullptr).MoveValue(); EXPECT_THAT( offer->contents(), ElementsAre( @@ -2050,7 +2052,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtpTransceiverDirection::kSendRecv), RtpHeaderExtensionCapability("uri3", 7, RtpTransceiverDirection::kSendOnly)}; - auto offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> offer = + f1_.CreateOfferOrError(opts, nullptr).MoveValue(); EXPECT_THAT( offer->contents(), ElementsAre( @@ -2085,7 +2088,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtpTransceiverDirection::kSendRecv), RtpHeaderExtensionCapability("uri3", 7, RtpTransceiverDirection::kStopped)}; - auto offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> offer = + f1_.CreateOfferOrError(opts, nullptr).MoveValue(); EXPECT_THAT( offer->contents(), ElementsAre( @@ -2115,7 +2119,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, AnswersUnstoppedExtensions) { RtpTransceiverDirection::kRecvOnly), RtpHeaderExtensionCapability("uri4", 1, RtpTransceiverDirection::kSendRecv)}; - auto offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> offer = + f1_.CreateOfferOrError(opts, nullptr).MoveValue(); opts.media_description_options.back().header_extensions = { RtpHeaderExtensionCapability("uri1", 4, RtpTransceiverDirection::kSendOnly), @@ -2125,7 +2130,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, AnswersUnstoppedExtensions) { RtpTransceiverDirection::kStopped), RtpHeaderExtensionCapability("uri4", 1, RtpTransceiverDirection::kSendRecv)}; - auto answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> answer = + f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); EXPECT_THAT( answer->contents(), ElementsAre(Property( @@ -2144,7 +2150,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, opts.media_description_options.back().header_extensions = { RtpHeaderExtensionCapability("uri1", 1, RtpTransceiverDirection::kSendRecv)}; - auto offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> offer = + f1_.CreateOfferOrError(opts, nullptr).MoveValue(); opts.media_description_options.back().header_extensions = { RtpHeaderExtensionCapability("uri1", 2, RtpTransceiverDirection::kSendRecv), @@ -2176,7 +2183,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtpTransceiverDirection::kSendRecv), RtpHeaderExtensionCapability("uri2", 2, RtpTransceiverDirection::kSendRecv)}; - auto offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> offer = + f1_.CreateOfferOrError(opts, nullptr).MoveValue(); // Check that a subsequent offer after setting "uri2" to stopped no longer // contains the extension. @@ -3157,7 +3165,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, &opts); std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - auto answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); + std::unique_ptr<SessionDescription> answer = + f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); // Recycle the media section by changing its mid. opts.media_description_options[0].mid = "v1"; @@ -3584,7 +3593,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) { std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); const VideoContentDescription* vcd = GetFirstVideoContentDescription(offer.get()); @@ -3993,7 +4002,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferDtlsSavpfCreateAnswer) { std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), CreateAudioMediaSession(), nullptr) .MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); const ContentInfo* answer_content = answer->GetContentByName(kAudioMid); ASSERT_TRUE(answer_content); @@ -4128,7 +4137,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, &opts); std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(4u, offer->contents().size()); EXPECT_FALSE(offer->contents()[0].rejected); @@ -4191,7 +4200,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); @@ -4237,7 +4246,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, &offer_opts); std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(offer_opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); EXPECT_FALSE(offer->contents()[0].rejected); EXPECT_TRUE(offer->contents()[1].rejected); @@ -4257,7 +4266,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, &offer_opts); std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(offer_opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); EXPECT_FALSE(offer->contents()[0].rejected); EXPECT_TRUE(offer->contents()[1].rejected); @@ -4291,7 +4300,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, &offer_opts); std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(offer_opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); ASSERT_FALSE(offer->contents()[0].rejected); ASSERT_FALSE(offer->contents()[1].rejected); @@ -4331,7 +4340,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); EXPECT_EQ(kVideoMid, offer->contents()[0].mid()); EXPECT_EQ(kAudioMid, offer->contents()[1].mid()); @@ -4351,7 +4360,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); const MediaContentDescription* vcd1 = offer->contents()[0].media_description(); @@ -4367,7 +4376,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, // Create answer and negotiate the codecs. std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); ASSERT_EQ(2u, answer->contents().size()); vcd1 = answer->contents()[0].media_description(); vcd2 = answer->contents()[1].media_description(); @@ -4399,7 +4408,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, H265TxModeIsEqualRetainIt) { // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(1u, offer->contents().size()); const MediaContentDescription* vcd1 = offer->contents()[0].media_description(); @@ -4409,7 +4418,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, H265TxModeIsEqualRetainIt) { // Create answer and negotiate the codecs. std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); ASSERT_EQ(1u, answer->contents().size()); vcd1 = answer->contents()[0].media_description(); ASSERT_EQ(1u, vcd1->codecs().size()); @@ -4437,7 +4446,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, H265TxModeIsDifferentDropCodecs) { // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(1u, offer->contents().size()); const VideoContentDescription* vcd1 = offer->contents()[0].media_description()->as_video(); @@ -4447,7 +4456,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, H265TxModeIsDifferentDropCodecs) { // Create answer and negotiate the codecs. std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); ASSERT_EQ(1u, answer->contents().size()); vcd1 = answer->contents()[0].media_description()->as_video(); ASSERT_EQ(1u, vcd1->codecs().size()); @@ -4476,7 +4485,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsEqual) { // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(1u, offer->contents().size()); const MediaContentDescription* vcd1 = offer->contents()[0].media_description(); @@ -4486,7 +4495,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsEqual) { // Create answer and negotiate the codecs. std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); ASSERT_EQ(1u, answer->contents().size()); vcd1 = answer->contents()[0].media_description(); ASSERT_EQ(1u, vcd1->codecs().size()); @@ -4514,7 +4523,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsDifferent) { // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(1u, offer->contents().size()); const VideoContentDescription* vcd1 = offer->contents()[0].media_description()->as_video(); @@ -4524,7 +4533,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsDifferent) { // Create answer and negotiate the codecs. std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); ASSERT_EQ(1u, answer->contents().size()); vcd1 = answer->contents()[0].media_description()->as_video(); ASSERT_EQ(1u, vcd1->codecs().size()); @@ -4545,7 +4554,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); MediaContentDescription* vcd1 = offer->contents()[0].media_description(); const MediaContentDescription* vcd2 = @@ -4581,7 +4590,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, // Create an offer with two video sections using same codecs. std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); ASSERT_EQ(2u, offer->contents().size()); MediaContentDescription* vcd1 = offer->contents()[0].media_description(); const MediaContentDescription* vcd2 = @@ -4643,7 +4652,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, CreateAnswerWithLocalCodecParams) { std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); auto offer_acd = offer->contents()[0].media_description(); auto offer_vcd = offer->contents()[1].media_description(); std::string value; @@ -4654,7 +4663,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, CreateAnswerWithLocalCodecParams) { std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); auto answer_acd = answer->contents()[0].media_description(); auto answer_vcd = answer->contents()[1].media_description(); // Use the parameters from the local codecs. @@ -4696,11 +4705,11 @@ TEST_F(MediaSessionDescriptionFactoryTest, std::unique_ptr<SessionDescription> offer = f1_.CreateOfferOrError(opts, nullptr).MoveValue(); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); std::unique_ptr<SessionDescription> answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue(); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); // Answer should have one negotiated codec with packetization-mode=1 using the // offered payload type. diff --git a/third_party/libwebrtc/pc/peer_connection_bundle_unittest.cc b/third_party/libwebrtc/pc/peer_connection_bundle_unittest.cc @@ -320,7 +320,8 @@ TEST_P(PeerConnectionBundleTest, ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); RTCOfferAnswerOptions options_no_bundle; options_no_bundle.use_rtp_mux = false; - auto answer = callee->CreateAnswer(options_no_bundle); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options_no_bundle); SdpContentsForEach(RemoveRtcpMux(), answer->description()); ASSERT_TRUE( callee->SetLocalDescription(CloneSessionDescription(answer.get()))); @@ -612,7 +613,8 @@ TEST_P(PeerConnectionBundleTest, FailToSetDescriptionWithBundleAndNoRtcpMux) { RTCOfferAnswerOptions options; options.use_rtp_mux = true; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); SdpContentsForEach(RemoveRtcpMux(), offer->description()); std::string error; @@ -699,7 +701,7 @@ TEST_P(PeerConnectionBundleTest, BundleOnFirstMidInAnswer) { auto* old_video_transport = caller->video_rtp_transport(); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto* old_bundle_group = answer->description()->GetGroupByName(GROUP_TYPE_BUNDLE); std::string first_mid = old_bundle_group->content_names()[0]; @@ -725,7 +727,8 @@ TEST_P(PeerConnectionBundleTest, ApplyDescriptionWithSameSsrcsBundledFails) { RTCOfferAnswerOptions options; options.use_rtp_mux = true; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); // Modify the remote SDP to make two m= sections have the same SSRC. @@ -744,7 +747,8 @@ TEST_P(PeerConnectionBundleTest, ApplyDescriptionWithSameSsrcsBundledFails) { EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer))); // When BUNDLE is enabled, applying the description is expected to fail // because the demuxing criteria can not be satisfied. - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); EXPECT_FALSE(callee->SetLocalDescription(std::move(answer))); } @@ -756,7 +760,8 @@ TEST_P(PeerConnectionBundleTest, RTCOfferAnswerOptions options; options.use_rtp_mux = false; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); // Modify the remote SDP to make two m= sections have the same SSRC. @@ -774,7 +779,8 @@ TEST_P(PeerConnectionBundleTest, EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer))); // Without BUNDLE, demuxing is done per-transport. - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); EXPECT_TRUE(callee->SetLocalDescription(std::move(answer))); } @@ -787,7 +793,8 @@ TEST_P(PeerConnectionBundleTest, RejectDescriptionChangingBundleTag) { RTCOfferAnswerOptions options; options.use_rtp_mux = true; - auto offer = caller->CreateOfferAndSetAsLocal(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(options); // Create a new bundle-group with different bundled_mid. auto* old_bundle_group = @@ -799,7 +806,8 @@ TEST_P(PeerConnectionBundleTest, RejectDescriptionChangingBundleTag) { auto re_offer = CloneSessionDescription(offer.get()); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); // Reject the first MID. answer->description()->contents()[0].rejected = true; // Remove the first MID from the bundle group. @@ -826,7 +834,8 @@ TEST_P(PeerConnectionBundleTest, RemovingContentAndRejectBundleGroup) { auto caller = CreatePeerConnectionWithAudioVideo(config); caller->CreateDataChannel("dc"); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto re_offer = CloneSessionDescription(offer.get()); // Removing the second MID from the BUNDLE group. @@ -854,7 +863,7 @@ TEST_P(PeerConnectionBundleTest, AddContentToBundleGroupInAnswerNotSupported) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); const auto first_mid = offer->description()->contents()[0].mid(); const auto second_mid = offer->description()->contents()[1].mid(); @@ -866,7 +875,7 @@ TEST_P(PeerConnectionBundleTest, AddContentToBundleGroupInAnswerNotSupported) { caller->SetLocalDescription(CloneSessionDescription(offer.get()))); EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); bundle_group.AddContentName(second_mid); answer->description()->RemoveGroupByName(GROUP_TYPE_BUNDLE); answer->description()->AddGroup(bundle_group); @@ -881,7 +890,7 @@ TEST_P(PeerConnectionBundleTest, RejectBundleGroupWithNonExistingMid) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto invalid_bundle_group = *offer->description()->GetGroupByName(GROUP_TYPE_BUNDLE); invalid_bundle_group.AddContentName("non-existing-MID"); @@ -904,7 +913,7 @@ TEST_P(PeerConnectionBundleTest, RemoveContentFromBundleGroup) { caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal())); EXPECT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); const auto second_mid = answer->description()->contents()[1].mid(); auto invalid_bundle_group = @@ -960,7 +969,8 @@ TEST_F(PeerConnectionBundleTestUnifiedPlan, MultipleBundleGroups) { caller->AddVideoTrack("3_audio"); auto callee = CreatePeerConnection(); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); // Modify the GROUP to have two BUNDLEs. We know that the MIDs will be 0,1,2,4 // because our implementation has predictable MIDs. offer->description()->RemoveGroupByName(GROUP_TYPE_BUNDLE); @@ -976,7 +986,7 @@ TEST_F(PeerConnectionBundleTestUnifiedPlan, MultipleBundleGroups) { EXPECT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); EXPECT_TRUE( callee->SetLocalDescription(CloneSessionDescription(answer.get()))); EXPECT_TRUE(caller->SetRemoteDescription(std::move(answer))); @@ -1015,11 +1025,12 @@ TEST_F(PeerConnectionBundleTestUnifiedPlan, AddNonBundledSection) { auto callee = CreatePeerConnection(config); // Establish an existing BUNDLE group. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); EXPECT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); EXPECT_TRUE( callee->SetLocalDescription(CloneSessionDescription(answer.get()))); EXPECT_TRUE(caller->SetRemoteDescription(std::move(answer))); diff --git a/third_party/libwebrtc/pc/peer_connection_crypto_unittest.cc b/third_party/libwebrtc/pc/peer_connection_crypto_unittest.cc @@ -65,8 +65,10 @@ namespace webrtc { using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions; + using ::testing::Combine; using ::testing::HasSubstr; +using ::testing::NotNull; using ::testing::Values; constexpr int kGenerateCertTimeout = 1000; @@ -191,8 +193,8 @@ TEST_P(PeerConnectionCryptoTest, CorrectCryptoInOfferWhenDtlsEnabled) { RTCConfiguration config; auto caller = CreatePeerConnectionWithAudioVideo(config); - auto offer = caller->CreateOffer(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); + ASSERT_THAT(offer, NotNull()); ASSERT_FALSE(offer->description()->contents().empty()); EXPECT_TRUE(SdpContentsAll(HaveDtlsFingerprint(), offer->description())); @@ -205,8 +207,8 @@ TEST_P(PeerConnectionCryptoTest, CorrectCryptoInAnswerWhenDtlsEnabled) { auto callee = CreatePeerConnectionWithAudioVideo(config); callee->SetRemoteDescription(caller->CreateOffer()); - auto answer = callee->CreateAnswer(); - ASSERT_TRUE(answer); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); + ASSERT_THAT(answer, NotNull()); ASSERT_FALSE(answer->description()->contents().empty()); EXPECT_TRUE(SdpContentsAll(HaveDtlsFingerprint(), answer->description())); @@ -222,12 +224,14 @@ TEST_P(PeerConnectionCryptoTest, ExchangeOfferAnswerWhenDtlsOn) { auto caller = CreatePeerConnectionWithAudioVideo(config); auto callee = CreatePeerConnectionWithAudioVideo(config); - auto offer = caller->CreateOfferAndSetAsLocal(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); + ASSERT_THAT(offer, NotNull()); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswerAndSetAsLocal(); - ASSERT_TRUE(answer); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); + ASSERT_THAT(answer, NotNull()); ASSERT_TRUE(caller->SetRemoteDescription(std::move(answer))); } TEST_P(PeerConnectionCryptoTest, @@ -235,7 +239,7 @@ TEST_P(PeerConnectionCryptoTest, RTCConfiguration config; auto caller = CreatePeerConnectionWithAudioVideo(config); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); SdpContentsForEach(RemoveDtlsFingerprint(), offer->description()); EXPECT_FALSE(caller->SetLocalDescription(std::move(offer))); @@ -246,7 +250,7 @@ TEST_P(PeerConnectionCryptoTest, auto caller = CreatePeerConnectionWithAudioVideo(config); auto callee = CreatePeerConnectionWithAudioVideo(config); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); SdpContentsForEach(RemoveDtlsFingerprint(), offer->description()); EXPECT_FALSE(callee->SetRemoteDescription(std::move(offer))); @@ -258,7 +262,7 @@ TEST_P(PeerConnectionCryptoTest, auto callee = CreatePeerConnectionWithAudioVideo(config); callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); SdpContentsForEach(RemoveDtlsFingerprint(), answer->description()); } TEST_P(PeerConnectionCryptoTest, @@ -268,7 +272,8 @@ TEST_P(PeerConnectionCryptoTest, auto callee = CreatePeerConnectionWithAudioVideo(config); callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); SdpContentsForEach(RemoveDtlsFingerprint(), answer->description()); EXPECT_FALSE(caller->SetRemoteDescription(std::move(answer))); @@ -288,12 +293,14 @@ TEST_P(PeerConnectionCryptoTest, FakeRTCCertificateGenerator::GenerateCertificate()); auto callee = CreatePeerConnectionWithAudioVideo(callee_config); - auto offer = caller->CreateOfferAndSetAsLocal(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); + ASSERT_THAT(offer, NotNull()); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswerAndSetAsLocal(); - ASSERT_TRUE(answer); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); + ASSERT_THAT(answer, NotNull()); ASSERT_TRUE(caller->SetRemoteDescription(std::move(answer))); } @@ -431,7 +438,8 @@ TEST_P(PeerConnectionCryptoTest, CreateAnswerWithDifferentSslRoles) { // First, negotiate different SSL roles for audio and video. ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(options_no_bundle); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options_no_bundle); AudioConnectionRole(answer->description()) = CONNECTIONROLE_ACTIVE; VideoConnectionRole(answer->description()) = CONNECTIONROLE_PASSIVE; diff --git a/third_party/libwebrtc/pc/peer_connection_data_channel_unittest.cc b/third_party/libwebrtc/pc/peer_connection_data_channel_unittest.cc @@ -41,13 +41,15 @@ namespace webrtc { -using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; -using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions; using ::testing::HasSubstr; using ::testing::IsEmpty; using ::testing::Not; +using ::testing::NotNull; using ::testing::Values; +using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; +using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions; + namespace { PeerConnectionFactoryDependencies CreatePeerConnectionFactoryDependencies() { @@ -206,7 +208,7 @@ TEST_P(PeerConnectionDataChannelTest, SctpContentAndTransportNameSetCorrectly) { caller->AddVideoTrack("v"); caller->pc()->CreateDataChannelOrError("dc", nullptr); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); const auto& offer_contents = offer->description()->contents(); ASSERT_EQ(MediaType::AUDIO, offer_contents[0].media_description()->type()); auto audio_mid = offer_contents[0].mid(); @@ -238,7 +240,7 @@ TEST_P(PeerConnectionDataChannelTest, SctpContentAndTransportNameSetCorrectly) { TEST_P(PeerConnectionDataChannelTest, CreateOfferWithNoDataChannelsGivesNoDataSection) { auto caller = CreatePeerConnection(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); EXPECT_THAT(offer->description()->contents(), IsEmpty()); } @@ -249,8 +251,8 @@ TEST_P(PeerConnectionDataChannelTest, ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); - ASSERT_TRUE(answer); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); + ASSERT_THAT(answer, NotNull()); auto* data_content = GetFirstDataContent(answer->description()); ASSERT_TRUE(data_content); EXPECT_FALSE(data_content->rejected); @@ -265,11 +267,11 @@ TEST_P(PeerConnectionDataChannelTest, SctpPortPropagatedFromSdpToTransport) { auto caller = CreatePeerConnectionWithDataChannel(); auto callee = CreatePeerConnectionWithDataChannel(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ChangeSctpPortOnDescription(offer->description(), kNewSendPort); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); ChangeSctpPortOnDescription(answer->description(), kNewRecvPort); std::string sdp; answer->ToString(&sdp); @@ -284,7 +286,8 @@ TEST_P(PeerConnectionDataChannelTest, SctpPortPropagatedFromSdpToTransport) { TEST_P(PeerConnectionDataChannelTest, ModernSdpSyntaxByDefault) { PeerConnectionInterface::RTCOfferAnswerOptions options; auto caller = CreatePeerConnectionWithDataChannel(); - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_FALSE( GetFirstSctpDataContentDescription(offer->description())->use_sctpmap()); std::string sdp; @@ -298,7 +301,8 @@ TEST_P(PeerConnectionDataChannelTest, ObsoleteSdpSyntaxIfSet) { PeerConnectionInterface::RTCOfferAnswerOptions options; options.use_obsolete_sctp_sdp = true; auto caller = CreatePeerConnectionWithDataChannel(); - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_TRUE( GetFirstSctpDataContentDescription(offer->description())->use_sctpmap()); std::string sdp; diff --git a/third_party/libwebrtc/pc/peer_connection_field_trial_tests.cc b/third_party/libwebrtc/pc/peer_connection_field_trial_tests.cc @@ -19,6 +19,7 @@ #include "absl/strings/string_view.h" #include "api/enable_media_with_defaults.h" #include "api/environment/environment_factory.h" +#include "api/jsep.h" #include "api/media_types.h" #include "api/peer_connection_interface.h" #include "api/rtp_parameters.h" @@ -104,7 +105,7 @@ TEST_F(PeerConnectionFieldTrialTest, EnableDependencyDescriptorAdvertised) { WrapperPtr caller = CreatePeerConnection(); caller->AddTransceiver(MediaType::VIDEO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents1 = offer->description()->contents(); ASSERT_EQ(1u, contents1.size()); @@ -137,7 +138,7 @@ TEST_F(PeerConnectionFieldTrialTest, MAYBE_InjectDependencyDescriptor) { WrapperPtr callee = CreatePeerConnection(); caller->AddTransceiver(MediaType::VIDEO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ContentInfos& contents1 = offer->description()->contents(); ASSERT_EQ(1u, contents1.size()); @@ -180,7 +181,7 @@ TEST_F(PeerConnectionFieldTrialTest, MAYBE_InjectDependencyDescriptor) { caller->SetLocalDescription(offer->Clone()); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); ContentInfos& contents2 = answer->description()->contents(); ASSERT_EQ(1u, contents2.size()); diff --git a/third_party/libwebrtc/pc/peer_connection_header_extension_unittest.cc b/third_party/libwebrtc/pc/peer_connection_header_extension_unittest.cc @@ -198,8 +198,9 @@ TEST_P(PeerConnectionHeaderExtensionTest, AnswersUnstoppedModifiedExtensions) { CreatePeerConnection(media_type, semantics); auto transceiver1 = pc1->AddTransceiver(media_type); - auto offer = pc1->CreateOfferAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + pc1->CreateOfferAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc2->SetRemoteDescription(std::move(offer)); ASSERT_EQ(pc2->pc()->GetTransceivers().size(), 1u); @@ -209,8 +210,9 @@ TEST_P(PeerConnectionHeaderExtensionTest, AnswersUnstoppedModifiedExtensions) { modified_extensions[3].direction = RtpTransceiverDirection::kStopped; transceiver2->SetHeaderExtensionsToNegotiate(modified_extensions); - auto answer = pc2->CreateAnswerAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + pc2->CreateAnswerAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); EXPECT_THAT(answer->description() ->contents()[0] .media_description() @@ -231,15 +233,17 @@ TEST_P(PeerConnectionHeaderExtensionTest, NegotiatedExtensionsAreAccessible) { auto modified_extensions = transceiver1->GetHeaderExtensionsToNegotiate(); modified_extensions[3].direction = RtpTransceiverDirection::kStopped; transceiver1->SetHeaderExtensionsToNegotiate(modified_extensions); - auto offer = pc1->CreateOfferAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + pc1->CreateOfferAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); std::unique_ptr<PeerConnectionWrapper> pc2 = CreatePeerConnection(media_type, semantics); auto transceiver2 = pc2->AddTransceiver(media_type); pc2->SetRemoteDescription(std::move(offer)); - auto answer = pc2->CreateAnswerAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + pc2->CreateAnswerAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc1->SetRemoteDescription(std::move(answer)); // PC1 has exts 2-4 unstopped and PC2 has exts 1-3 unstopped -> ext 2, 3 @@ -297,11 +301,13 @@ TEST_P(PeerConnectionHeaderExtensionTest, RemovalAfterRenegotiation) { CreatePeerConnection(media_type, semantics); auto transceiver1 = pc1->AddTransceiver(media_type); - auto offer = pc1->CreateOfferAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + pc1->CreateOfferAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc2->SetRemoteDescription(std::move(offer)); - auto answer = pc2->CreateAnswerAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + pc2->CreateAnswerAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc1->SetRemoteDescription(std::move(answer)); auto modified_extensions = transceiver1->GetHeaderExtensionsToNegotiate(); @@ -329,11 +335,13 @@ TEST_P(PeerConnectionHeaderExtensionTest, CreatePeerConnection(media_type, semantics); auto transceiver1 = pc1->AddTransceiver(media_type); - auto offer = pc1->CreateOfferAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + pc1->CreateOfferAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc2->SetRemoteDescription(std::move(offer)); - auto answer = pc2->CreateAnswerAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + pc2->CreateAnswerAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); std::string sdp; ASSERT_TRUE(answer->ToString(&sdp)); // We support uri1 but it is stopped by default. Let the remote reactivate it. @@ -386,7 +394,8 @@ TEST_P(PeerConnectionHeaderExtensionTest, "a=mid:audio\r\n" "a=setup:actpass\r\n" "a=extmap:1 urn:bogus\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); pc->SetRemoteDescription(std::move(offer)); pc->CreateAnswerAndSetAsLocal( PeerConnectionInterface::RTCOfferAnswerOptions()); @@ -440,9 +449,10 @@ TEST_P(PeerConnectionHeaderExtensionTest, "a=mid:audio\r\n" "a=setup:actpass\r\n" "a=extmap:1 uri1\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); pc->SetRemoteDescription(std::move(offer)); - auto answer = + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(PeerConnectionInterface::RTCOfferAnswerOptions()); std::string modified_sdp; ASSERT_TRUE(answer->ToString(&modified_sdp)); @@ -473,7 +483,7 @@ TEST_P(PeerConnectionHeaderExtensionTest, CreatePeerConnection(media_type, semantics); pc->AddTransceiver(media_type); - auto offer = + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(PeerConnectionInterface::RTCOfferAnswerOptions()); std::string modified_sdp; ASSERT_TRUE(offer->ToString(&modified_sdp)); @@ -527,7 +537,8 @@ TEST_P(PeerConnectionHeaderExtensionTest, EnablingExtensionsAfterRemoteOffer) { "a=mid:audio\r\n" "a=setup:actpass\r\n" "a=extmap:5 uri1\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); pc->SetRemoteDescription(std::move(offer)); ASSERT_GT(pc->pc()->GetTransceivers().size(), 0u); @@ -570,11 +581,13 @@ TEST_P(PeerConnectionHeaderExtensionTest, SenderParametersReflectNegotiation) { EXPECT_THAT(sender_parameters.header_extensions, IsEmpty()); } - auto offer = pc1->CreateOfferAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + pc1->CreateOfferAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc2->SetRemoteDescription(std::move(offer)); - auto answer = pc2->CreateAnswerAndSetAsLocal( - PeerConnectionInterface::RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + pc2->CreateAnswerAndSetAsLocal( + PeerConnectionInterface::RTCOfferAnswerOptions()); pc1->SetRemoteDescription(std::move(answer)); { auto sender_parameters = pc1->pc()->GetSenders()[0]->GetParameters(); diff --git a/third_party/libwebrtc/pc/peer_connection_histogram_unittest.cc b/third_party/libwebrtc/pc/peer_connection_histogram_unittest.cc @@ -189,7 +189,8 @@ class PeerConnectionWrapperForUsageHistogramTest } bool GenerateOfferAndCollectCandidates() { - auto offer = CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateOffer(RTCOfferAnswerOptions()); if (!offer) { return false; } @@ -698,7 +699,7 @@ TEST_F(PeerConnectionUsageHistogramTest, ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); // By default, the Answer created does not contain ICE candidates. - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); callee->SetLocalDescription(CloneSessionDescription(answer.get())); caller->SetRemoteDescription(std::move(answer)); EXPECT_THAT( diff --git a/third_party/libwebrtc/pc/peer_connection_ice_unittest.cc b/third_party/libwebrtc/pc/peer_connection_ice_unittest.cc @@ -87,6 +87,7 @@ using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions; using ::testing::Combine; using ::testing::ElementsAre; +using ::testing::NotNull; using ::testing::Pair; using ::testing::SizeIs; using ::testing::Values; @@ -367,7 +368,7 @@ TEST_P(PeerConnectionIceTest, OfferContainsGatheredCandidates) { {.timeout = TimeDelta::Millis(kIceCandidatesTimeout)}), IsRtcOk()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); EXPECT_LT(0u, caller->observer()->GetCandidatesByMline(0).size()); EXPECT_EQ(caller->observer()->GetCandidatesByMline(0).size(), offer->candidates(0)->count()); @@ -407,7 +408,8 @@ TEST_P(PeerConnectionIceTest, auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); Candidate candidate = CreateLocalUdpCandidate(kCallerAddress); AddCandidateToFirstTransport(&candidate, offer.get()); @@ -421,7 +423,7 @@ TEST_P(PeerConnectionIceTest, TEST_P(PeerConnectionIceTest, SetLocalDescriptionFailsIfNoIceCredentials) { auto caller = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RemoveIceUfragPwd(offer.get()); EXPECT_FALSE(caller->SetLocalDescription(std::move(offer))); @@ -431,7 +433,8 @@ TEST_P(PeerConnectionIceTest, SetRemoteDescriptionFailsIfNoIceCredentials) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); RemoveIceUfragPwd(offer.get()); EXPECT_FALSE(callee->SetRemoteDescription(std::move(offer))); @@ -474,7 +477,8 @@ TEST_P(PeerConnectionIceTest, auto callee = CreatePeerConnectionWithAudioVideo(); caller->network()->AddInterface(kCallerAddress); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); Candidate candidate = CreateLocalUdpCandidate(kCallerAddress); AddCandidateToFirstTransport(&candidate, offer.get()); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); @@ -489,8 +493,8 @@ TEST_P(PeerConnectionIceTest, CannotAddCandidateWhenRemoteDescriptionNotSet) { const SocketAddress kCalleeAddress("1.1.1.1", 1111); auto caller = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); + ASSERT_THAT(offer, NotNull()); ASSERT_THAT(offer->description()->contents(), SizeIs(2)); std::string mid = offer->description()->contents()[0].mid(); Candidate candidate = CreateLocalUdpCandidate(kCalleeAddress); @@ -551,7 +555,8 @@ TEST_P(PeerConnectionIceTest, DISABLED_ErrorOnInvalidRemoteIceCandidateAdded) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); // Add a candidate to the remote description with a candidate that has an // invalid address (port number == 2). - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); Candidate bad_candidate = CreateLocalUdpCandidate(SocketAddress("2.2.2.2", 2)); RTC_LOG(LS_INFO) << "Bad candidate: " << bad_candidate.ToString(); @@ -639,7 +644,7 @@ TEST_P(PeerConnectionIceTest, ASSERT_TRUE(callee->AddIceCandidate(&candidate1)); // Add the second candidate via a reoffer. - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); Candidate candidate2 = CreateLocalUdpCandidate(kCallerAddress2); AddCandidateToFirstTransport(&candidate2, offer.get()); @@ -659,7 +664,7 @@ TEST_P(PeerConnectionIceTest, VerifyUfragPwdLength) { // Because local munging is forbidden by spec, we have to disable the // check for it. pc->GetInternalPeerConnection()->DisableSdpMungingChecksForTesting(); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); SetIceUfragPwd(offer.get(), std::string(ufrag_len, 'x'), std::string(pwd_len, 'x')); bool result = pc->SetLocalDescription(std::move(offer)); @@ -670,7 +675,7 @@ TEST_P(PeerConnectionIceTest, VerifyUfragPwdLength) { auto set_remote_description_with_ufrag_pwd_length = [this](int ufrag_len, int pwd_len) { auto pc = CreatePeerConnectionWithAudioVideo(); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); SetIceUfragPwd(offer.get(), std::string(ufrag_len, 'x'), std::string(pwd_len, 'x')); bool result = pc->SetRemoteDescription(std::move(offer)); @@ -853,8 +858,8 @@ TEST_P(PeerConnectionIceTest, auto candidate = CreateLocalUdpCandidate(SocketAddress("1.1.1.1", 1111)); auto caller = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); + ASSERT_THAT(offer, NotNull()); ASSERT_THAT(offer->description()->contents(), SizeIs(2)); std::string mid = offer->description()->contents()[0].mid(); std::unique_ptr<IceCandidate> jsep_candidate = @@ -1011,7 +1016,8 @@ TEST_P(PeerConnectionIceTest, IceRestartOfferClearsExistingCandidate) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); Candidate candidate = CreateLocalUdpCandidate(kCallerAddress); AddCandidateToFirstTransport(&candidate, offer.get()); @@ -1032,7 +1038,8 @@ TEST_P(PeerConnectionIceTest, auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); Candidate old_candidate = CreateLocalUdpCandidate(kFirstCallerAddress); AddCandidateToFirstTransport(&old_candidate, offer.get()); @@ -1065,7 +1072,7 @@ TEST_P(PeerConnectionIceTest, LaterAnswerHasSameIceCredentialsIfNoIceRestart) { // Re-offer. ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto* answer_transport_desc = GetFirstTransportDescription(answer.get()); auto* local_transport_desc = GetFirstTransportDescription(callee->pc()->local_description()); @@ -1329,7 +1336,7 @@ TEST_P(PeerConnectionIceUfragPwdAnswerTest, TestIncludedInAnswer) { ASSERT_TRUE( caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal())); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto* offer_transport_desc = GetFirstTransportDescription(offer.get()); if (offer_new_ufrag_) { offer_transport_desc->ice_ufrag += "+new"; @@ -1340,7 +1347,7 @@ TEST_P(PeerConnectionIceUfragPwdAnswerTest, TestIncludedInAnswer) { ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto* answer_transport_desc = GetFirstTransportDescription(answer.get()); auto* local_transport_desc = GetFirstTransportDescription(callee->pc()->local_description()); @@ -1374,7 +1381,8 @@ TEST_P(PeerConnectionIceTest, RTCOfferAnswerOptions disable_bundle_options; disable_bundle_options.use_rtp_mux = false; - auto offer = caller->CreateOffer(disable_bundle_options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(disable_bundle_options); // Signal ICE restart on the first media section. auto* offer_transport_desc = GetFirstTransportDescription(offer.get()); @@ -1383,7 +1391,8 @@ TEST_P(PeerConnectionIceTest, ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(disable_bundle_options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(disable_bundle_options); const auto& answer_transports = answer->description()->transport_infos(); const auto& local_transports = callee->pc()->local_description()->description()->transport_infos(); @@ -1407,13 +1416,13 @@ TEST_P(PeerConnectionIceTest, auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); SetIceMode(offer.get(), IceMode::ICEMODE_LITE); ASSERT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); SetIceMode(answer.get(), IceMode::ICEMODE_FULL); ASSERT_TRUE( callee->SetLocalDescription(CloneSessionDescription(answer.get()))); @@ -1431,13 +1440,13 @@ TEST_P(PeerConnectionIceTest, auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); SetIceMode(offer.get(), IceMode::ICEMODE_LITE); ASSERT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); SetIceMode(answer.get(), IceMode::ICEMODE_LITE); ASSERT_TRUE( callee->SetLocalDescription(CloneSessionDescription(answer.get()))); @@ -1549,7 +1558,7 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateOffer) { config.ice_candidate_pool_size = 1; auto pc = CreatePeerConnectionWithAudioVideo(config); ASSERT_NE(pc->GetInternalPeerConnection()->port_allocator(), nullptr); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto credentials = pc->GetInternalPeerConnection() ->port_allocator() ->GetPooledIceCredentials(); @@ -1569,9 +1578,9 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateAnswer) { config.ice_candidate_pool_size = 1; auto pc = CreatePeerConnectionWithAudioVideo(config); ASSERT_NE(pc->GetInternalPeerConnection()->port_allocator(), nullptr); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); ASSERT_TRUE(pc->SetRemoteDescription(std::move(offer))); - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); auto credentials = pc->GetInternalPeerConnection() ->port_allocator() diff --git a/third_party/libwebrtc/pc/peer_connection_integrationtest.cc b/third_party/libwebrtc/pc/peer_connection_integrationtest.cc @@ -4876,7 +4876,8 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan, WaitUntil([&] { return SignalingStateStable(); }, ::testing::IsTrue()), IsRtcOk()); caller()->SetGeneratedSdpMunger(nullptr); - auto offer = caller()->CreateOfferAndWait(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller()->CreateOfferAndWait(); ASSERT_NE(nullptr, offer); // The offer should be acceptable. EXPECT_TRUE(caller()->SetLocalDescriptionAndSendSdpMessage(std::move(offer))); @@ -4955,8 +4956,9 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan, ASSERT_EQ(transceivers.size(), 1u); transceivers[0]->SetCodecPreferences(codecs); - auto offer = caller()->CreateOfferAndWait(); - ASSERT_NE(offer, nullptr); + std::unique_ptr<SessionDescriptionInterface> offer = + caller()->CreateOfferAndWait(); + ASSERT_THAT(offer, NotNull()); // The offer should be acceptable. EXPECT_TRUE(caller()->SetLocalDescriptionAndSendSdpMessage(std::move(offer))); @@ -5027,7 +5029,7 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan, // associated RTX codec. std::unique_ptr<SessionDescriptionInterface> answer = caller()->CreateAnswerForTest(); - ASSERT_NE(answer, nullptr); + ASSERT_THAT(answer, NotNull()); RTC_LOG(LS_ERROR) << "Answer is " << *answer; ASSERT_THAT(answer->description()->contents().size(), Eq(1)); auto codecs = @@ -5054,7 +5056,8 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan, ASSERT_TRUE(CreatePeerConnectionWrappers()); // Add first video track. caller()->AddVideoTrack(); - auto offer = caller()->CreateOfferAndWait(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller()->CreateOfferAndWait(); EXPECT_EQ(offer->description()->contents().size(), 1U); // Observe that packetization is NOT raw. for (const auto& content : offer->description()->contents()) { diff --git a/third_party/libwebrtc/pc/peer_connection_interface_unittest.cc b/third_party/libwebrtc/pc/peer_connection_interface_unittest.cc @@ -98,6 +98,15 @@ namespace webrtc { namespace { +using ::testing::Eq; +using ::testing::Exactly; +using ::testing::NotNull; +using ::testing::SizeIs; +using ::testing::Values; + +using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; +using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions; + const char kStreamId1[] = "local_stream_1"; const char kStreamId2[] = "local_stream_2"; const char kStreamId3[] = "local_stream_3"; @@ -429,14 +438,6 @@ class RtcEventLogOutputNull final : public RtcEventLogOutput { bool Write(const absl::string_view /*output*/) override { return true; } }; -using ::testing::Eq; -using ::testing::Exactly; -using ::testing::SizeIs; -using ::testing::Values; - -using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; -using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions; - // Gets the first ssrc of given content type from the ContentInfo. bool GetFirstSsrc(const ContentInfo* content_info, int* ssrc) { if (!content_info || !ssrc) { @@ -1032,7 +1033,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test { void CreateAnswerAsRemoteDescription(const std::string& sdp) { std::unique_ptr<SessionDescriptionInterface> answer( CreateSessionDescription(SdpType::kAnswer, sdp)); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); EXPECT_TRUE(DoSetRemoteDescription(std::move(answer))); EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); } @@ -1045,7 +1046,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test { EXPECT_EQ(PeerConnectionInterface::kHaveRemotePrAnswer, observer_.state_); std::unique_ptr<SessionDescriptionInterface> answer( CreateSessionDescription(SdpType::kAnswer, sdp)); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); EXPECT_TRUE(DoSetRemoteDescription(std::move(answer))); EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); } @@ -2073,7 +2074,7 @@ TEST_P(PeerConnectionInterfaceTest, DISABLED_TestRejectSctpDataChannelInAnswer) EXPECT_TRUE(pc_->local_description()->ToString(&sdp)); std::unique_ptr<SessionDescriptionInterface> answer( CreateSessionDescription(SdpType::kAnswer, sdp)); - ASSERT_TRUE(answer); + ASSERT_THAT(answer, NotNull()); ContentInfo* data_info = GetFirstDataContent(answer->description()); data_info->rejected = true; @@ -3485,7 +3486,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithAudioVideoOptions) { std::unique_ptr<SessionDescriptionInterface> offer; CreatePeerConnection(); offer = CreateOfferWithOptions(rtc_options); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_NE(nullptr, GetFirstAudioContent(offer->description())); EXPECT_NE(nullptr, GetFirstVideoContent(offer->description())); } @@ -3500,7 +3501,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithAudioOnlyOptions) { std::unique_ptr<SessionDescriptionInterface> offer; CreatePeerConnection(); offer = CreateOfferWithOptions(rtc_options); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_NE(nullptr, GetFirstAudioContent(offer->description())); EXPECT_EQ(nullptr, GetFirstVideoContent(offer->description())); } @@ -3515,7 +3516,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithVideoOnlyOptions) { std::unique_ptr<SessionDescriptionInterface> offer; CreatePeerConnection(); offer = CreateOfferWithOptions(rtc_options); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_EQ(nullptr, GetFirstAudioContent(offer->description())); EXPECT_NE(nullptr, GetFirstVideoContent(offer->description())); } @@ -3528,7 +3529,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithDefaultOfferAnswerOptions) { std::unique_ptr<SessionDescriptionInterface> offer; CreatePeerConnection(); offer = CreateOfferWithOptions(rtc_options); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_EQ(nullptr, GetFirstAudioContent(offer->description())); EXPECT_EQ(nullptr, GetFirstVideoContent(offer->description())); } @@ -3583,14 +3584,14 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithRtpMux) { rtc_options.use_rtp_mux = true; offer = CreateOfferWithOptions(rtc_options); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_NE(nullptr, GetFirstAudioContent(offer->description())); EXPECT_NE(nullptr, GetFirstVideoContent(offer->description())); EXPECT_TRUE(offer->description()->HasGroup(GROUP_TYPE_BUNDLE)); rtc_options.use_rtp_mux = false; offer = CreateOfferWithOptions(rtc_options); - ASSERT_TRUE(offer); + ASSERT_THAT(offer, NotNull()); EXPECT_NE(nullptr, GetFirstAudioContent(offer->description())); EXPECT_NE(nullptr, GetFirstVideoContent(offer->description())); EXPECT_FALSE(offer->description()->HasGroup(GROUP_TYPE_BUNDLE)); diff --git a/third_party/libwebrtc/pc/peer_connection_jsep_unittest.cc b/third_party/libwebrtc/pc/peer_connection_jsep_unittest.cc @@ -120,7 +120,7 @@ class PeerConnectionJsepTest : public ::testing::Test { TEST_F(PeerConnectionJsepTest, EmptyInitialOffer) { auto caller = CreatePeerConnection(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ASSERT_EQ(0u, offer->description()->contents().size()); } @@ -130,7 +130,7 @@ TEST_F(PeerConnectionJsepTest, AudioOnlyInitialOffer) { auto caller = CreatePeerConnection(); caller->AddTransceiver(MediaType::AUDIO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); EXPECT_EQ(MediaType::AUDIO, contents[0].media_description()->type()); @@ -142,7 +142,7 @@ TEST_F(PeerConnectionJsepTest, VideoOnlyInitialOffer) { auto caller = CreatePeerConnection(); caller->AddTransceiver(MediaType::VIDEO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); EXPECT_EQ(MediaType::VIDEO, contents[0].media_description()->type()); @@ -154,7 +154,7 @@ TEST_F(PeerConnectionJsepTest, DataOnlyInitialOffer) { auto caller = CreatePeerConnection(); caller->CreateDataChannel("dc"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); EXPECT_EQ(MediaType::DATA, contents[0].media_description()->type()); @@ -168,7 +168,7 @@ TEST_F(PeerConnectionJsepTest, MultipleDataChannelsCreateOnlyOneDataSection) { caller->CreateDataChannel("second"); caller->CreateDataChannel("third"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ASSERT_EQ(1u, offer->description()->contents().size()); } @@ -183,7 +183,7 @@ TEST_F(PeerConnectionJsepTest, MediaSectionsInInitialOfferOrderedCorrectly) { init.direction = RtpTransceiverDirection::kSendOnly; caller->AddTransceiver(MediaType::VIDEO, init); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(3u, contents.size()); @@ -212,7 +212,7 @@ TEST_F(PeerConnectionJsepTest, MediaSectionsInInitialOfferHaveDifferentMids) { caller->AddTransceiver(MediaType::AUDIO); caller->AddTransceiver(MediaType::AUDIO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(2u, contents.size()); EXPECT_NE(contents[0].mid(), contents[1].mid()); @@ -224,7 +224,7 @@ TEST_F(PeerConnectionJsepTest, auto transceiver = caller->AddTransceiver(MediaType::AUDIO); transceiver->StopInternal(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); EXPECT_EQ(0u, offer->description()->contents().size()); } @@ -245,7 +245,7 @@ TEST_F(PeerConnectionJsepTest, SetLocalOfferSetsTransceiverMid) { auto audio_transceiver = caller->AddTransceiver(MediaType::AUDIO); auto video_transceiver = caller->AddTransceiver(MediaType::VIDEO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto audio_mid = offer->description()->contents()[0].mid(); auto video_mid = offer->description()->contents()[1].mid(); @@ -416,13 +416,13 @@ TEST_F(PeerConnectionJsepTest, CreateAnswerHasSameMidsAsOffer) { caller->CreateDataChannel("dc"); auto callee = CreatePeerConnection(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); const auto* offer_data = GetFirstDataContent(offer->description()); ASSERT_TRUE( caller->SetLocalDescription(CloneSessionDescription(offer.get()))); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto contents = answer->description()->contents(); ASSERT_EQ(4u, contents.size()); EXPECT_EQ(MediaType::VIDEO, contents[0].media_description()->type()); @@ -446,7 +446,7 @@ TEST_F(PeerConnectionJsepTest, CreateAnswerRejectsStoppedTransceiver) { callee->pc()->GetTransceivers()[0]->StopInternal(); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto contents = answer->description()->contents(); ASSERT_EQ(1u, contents.size()); EXPECT_TRUE(contents[0].rejected); @@ -465,7 +465,7 @@ TEST_F(PeerConnectionJsepTest, CreateAnswerNegotiatesDirection) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto contents = answer->description()->contents(); ASSERT_EQ(1u, contents.size()); EXPECT_EQ(RtpTransceiverDirection::kRecvOnly, @@ -671,7 +671,7 @@ TEST_F(PeerConnectionJsepTest, // correctly. caller->AddAudioTrack("audio2"); callee->AddAudioTrack("audio2"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto offer_contents = offer->description()->contents(); auto second_mid = offer_contents[0].mid(); ASSERT_EQ(1u, offer_contents.size()); @@ -690,7 +690,7 @@ TEST_F(PeerConnectionJsepTest, EXPECT_EQ(second_mid, callee->pc()->GetTransceivers()[0]->mid()); // The new answer should also recycle the m section correctly. - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(1u, answer_contents.size()); EXPECT_FALSE(answer_contents[0].rejected); @@ -722,7 +722,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferRecyclesWhenOfferingTwice) { // Create a new offer that recycles the media section and set it as a local // description. - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto offer_contents = offer->description()->contents(); ASSERT_EQ(1u, offer_contents.size()); EXPECT_FALSE(offer_contents[0].rejected); @@ -788,7 +788,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) { // The offer should reuse the previous media section but allocate a new MID // and change the media type. - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto offer_contents = offer->description()->contents(); ASSERT_EQ(1u, offer_contents.size()); EXPECT_FALSE(offer_contents[0].rejected); @@ -812,7 +812,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) { EXPECT_EQ(second_type_, callee_transceivers[0]->media_type()); // The answer should have only one media section for the new transceiver. - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(1u, answer_contents.size()); EXPECT_FALSE(answer_contents[0].rejected); @@ -851,7 +851,7 @@ TEST_P(RecycleMediaSectionTest, CurrentRemoteOnlyRejected) { // The offer should reuse the previous media section but allocate a new MID // and change the media type. auto caller_second_transceiver = caller->AddTransceiver(second_type_); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); const auto& offer_contents = offer->description()->contents(); ASSERT_EQ(1u, offer_contents.size()); EXPECT_FALSE(offer_contents[0].rejected); @@ -875,7 +875,7 @@ TEST_P(RecycleMediaSectionTest, CurrentRemoteOnlyRejected) { EXPECT_EQ(second_type_, callee_transceivers[0]->media_type()); // The answer should have only one media section for the new transceiver. - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(1u, answer_contents.size()); EXPECT_FALSE(answer_contents[0].rejected); @@ -914,7 +914,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalOnlyRejected) { // The offer should reuse the previous media section but allocate a new MID // and change the media type. auto callee_second_transceiver = callee->AddTransceiver(second_type_); - auto offer = callee->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = callee->CreateOffer(); const auto& offer_contents = offer->description()->contents(); ASSERT_EQ(1u, offer_contents.size()); EXPECT_FALSE(offer_contents[0].rejected); @@ -938,7 +938,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalOnlyRejected) { EXPECT_EQ(second_type_, caller_transceivers[0]->media_type()); // The answer should have only one media section for the new transceiver. - auto answer = caller->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = caller->CreateAnswer(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(1u, answer_contents.size()); EXPECT_FALSE(answer_contents[0].rejected); @@ -1130,7 +1130,7 @@ TEST_F(PeerConnectionJsepTest, DataChannelDoesNotRecycleMediaSection) { caller->CreateDataChannel("dc"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto offer_contents = offer->description()->contents(); ASSERT_EQ(2u, offer_contents.size()); EXPECT_EQ(MediaType::AUDIO, offer_contents[0].media_description()->type()); @@ -1140,7 +1140,7 @@ TEST_F(PeerConnectionJsepTest, DataChannelDoesNotRecycleMediaSection) { caller->SetLocalDescription(CloneSessionDescription(offer.get()))); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(2u, answer_contents.size()); EXPECT_EQ(MediaType::AUDIO, answer_contents[0].media_description()->type()); @@ -1159,7 +1159,7 @@ TEST_F(PeerConnectionJsepTest, AudioTrackAddedAfterDataSectionInReoffer) { caller->AddAudioTrack("a"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(2u, contents.size()); EXPECT_EQ(MediaType::DATA, contents[0].media_description()->type()); @@ -1197,7 +1197,7 @@ TEST_F(PeerConnectionJsepTest, OfferAnswerWithChangedMids) { caller->AddAudioTrack("b"); auto callee = CreatePeerConnection(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RenameSection(0, kFirstMid, offer.get()); RenameSection(1, kSecondMid, offer.get()); @@ -1212,7 +1212,7 @@ TEST_F(PeerConnectionJsepTest, OfferAnswerWithChangedMids) { EXPECT_EQ(kFirstMid, callee_transceivers[0]->mid()); EXPECT_EQ(kSecondMid, callee_transceivers[1]->mid()); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto answer_contents = answer->description()->contents(); EXPECT_EQ(kFirstMid, answer_contents[0].mid()); EXPECT_EQ(kSecondMid, answer_contents[1].mid()); @@ -1240,7 +1240,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferGeneratesUniqueMidIfAlreadyTaken) { caller->AddAudioTrack("a"); auto callee = CreatePeerConnection(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RenameSection(0, default_second_mid, offer.get()); ASSERT_TRUE( @@ -1273,7 +1273,7 @@ TEST_F(PeerConnectionJsepTest, caller->AddAudioTrack("a"); auto callee = CreatePeerConnection(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RenameSection(0, default_data_mid, offer.get()); ASSERT_TRUE( @@ -1319,7 +1319,7 @@ TEST_F(PeerConnectionJsepTest, AddingTrackWithAddTrackSpecifiesTrackId) { auto caller = CreatePeerConnection(); caller->AddAudioTrack(kTrackId); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); auto streams = contents[0].media_description()->streams(); @@ -1337,7 +1337,7 @@ TEST_F(PeerConnectionJsepTest, auto transceiver = caller->AddTransceiver(MediaType::AUDIO); transceiver->sender()->SetTrack(caller->CreateAudioTrack(kTrackId).get()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); auto streams = contents[0].media_description()->streams(); @@ -1358,7 +1358,7 @@ TEST_F(PeerConnectionJsepTest, NoMsidInOfferIfTransceiverDirectionHasNoSend) { init_inactive.direction = RtpTransceiverDirection::kInactive; ASSERT_TRUE(caller->AddTransceiver(MediaType::VIDEO, init_inactive)); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto contents = offer->description()->contents(); ASSERT_EQ(2u, contents.size()); // MSID is specified in the first stream, so no streams means no MSID. @@ -1386,7 +1386,7 @@ TEST_F(PeerConnectionJsepTest, NoMsidInAnswerIfNoRespondingTracks) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto contents = answer->description()->contents(); ASSERT_EQ(2u, contents.size()); // MSID is specified in the first stream, so no streams means no MSID. @@ -1682,7 +1682,7 @@ TEST_F(PeerConnectionJsepTest, LegacyNoMidAudioOnlyOffer) { auto callee = CreatePeerConnection(); callee->AddAudioTrack("audio"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ClearMids(offer.get()); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); @@ -1696,7 +1696,7 @@ TEST_F(PeerConnectionJsepTest, LegacyNoMidAudioVideoOffer) { callee->AddAudioTrack("audio"); callee->AddVideoTrack("video"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ClearMids(offer.get()); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); @@ -1710,7 +1710,7 @@ TEST_F(PeerConnectionJsepTest, LegacyNoMidAudioOnlyAnswer) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); ClearMids(answer.get()); EXPECT_TRUE(caller->SetRemoteDescription(std::move(answer))); @@ -1725,7 +1725,7 @@ TEST_F(PeerConnectionJsepTest, LegacyNoMidAudioVideoAnswer) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); ClearMids(answer.get()); ASSERT_TRUE(caller->SetRemoteDescription(std::move(answer))); @@ -1740,7 +1740,7 @@ TEST_F(PeerConnectionJsepTest, LegacyNoMidTwoRemoteOffers) { auto callee = CreatePeerConnection(); callee->AddAudioTrack("audio"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ClearMids(offer.get()); ASSERT_TRUE( @@ -1754,7 +1754,7 @@ TEST_F(PeerConnectionJsepTest, SetLocalDescriptionFailsMissingMid) { auto caller = CreatePeerConnection(); caller->AddAudioTrack("audio"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); ClearMids(offer.get()); std::string error; @@ -1963,7 +1963,7 @@ TEST_F(PeerConnectionJsepTest, RollbackRestoresMid) { caller->AddTransceiver(MediaType::AUDIO); auto callee = CreatePeerConnection(); callee->AddAudioTrack("a"); - auto offer = callee->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = callee->CreateOffer(); EXPECT_TRUE(callee->SetRemoteDescription(caller->CreateOffer())); EXPECT_EQ(callee->pc()->GetTransceivers().size(), 1u); EXPECT_NE(callee->pc()->GetTransceivers()[0]->mid(), std::nullopt); @@ -2014,7 +2014,7 @@ TEST_F(PeerConnectionJsepTest, RollbackDoesNotAffectSendEncodings) { EXPECT_TRUE(params.encodings[0].active); params.encodings[0].active = false; caller->pc()->GetTransceivers()[0]->sender()->SetParameters(params); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); std::string offer_string; EXPECT_TRUE(offer.get()->ToString(&offer_string)); std::string simulcast_line = @@ -2037,7 +2037,7 @@ TEST_F(PeerConnectionJsepTest, RollbackDoesNotAffectSendEncodings) { TEST_F(PeerConnectionJsepTest, RollbackRestoresMidAndRemovesTransceiver) { auto callee = CreatePeerConnection(); callee->AddVideoTrack("a"); - auto offer = callee->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = callee->CreateOffer(); auto caller = CreatePeerConnection(); caller->AddAudioTrack("b"); caller->AddVideoTrack("c"); @@ -2136,7 +2136,7 @@ TEST_F(PeerConnectionJsepTest, RollbackHasToDestroyTransport) { pc->AddAudioTrack("a"); pc->AddVideoTrack("b"); EXPECT_TRUE(pc->CreateOfferAndSetAsLocal()); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); EXPECT_EQ(pc->pc()->GetTransceivers().size(), 2u); auto audio_transport = pc->pc()->GetTransceivers()[0]->sender()->dtls_transport(); @@ -2381,7 +2381,7 @@ TEST_F(PeerConnectionJsepTest, BundleOnlySectionDoesNotNeedRtcpMux) { auto callee = CreatePeerConnection(); caller->AddTransceiver(MediaType::AUDIO); caller->AddTransceiver(MediaType::VIDEO); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); // Remove rtcp-mux and set bundle-only on the second content. offer->description()->contents()[1].media_description()->set_rtcp_mux(false); offer->description()->contents()[1].bundle_only = true; @@ -2398,7 +2398,7 @@ TEST_F(PeerConnectionJsepTest, OfferRollbackRemoveReoffer) { caller->SetRemoteDescription(caller->CreateRollback()); RTCError error = caller->pc()->RemoveTrackOrError(sender); EXPECT_THAT(error, IsRtcOk()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); caller->SetLocalDescription(std::move(offer)); } diff --git a/third_party/libwebrtc/pc/peer_connection_media_unittest.cc b/third_party/libwebrtc/pc/peer_connection_media_unittest.cc @@ -387,7 +387,8 @@ TEST_F(PeerConnectionMediaTestPlanB, SimulcastOffer) { auto caller_video_track = caller->AddVideoTrack("v"); RTCOfferAnswerOptions options; options.num_simulcast_layers = 3; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); auto* description = GetFirstMediaContent(offer->description(), MediaType::VIDEO) ->media_description(); @@ -408,13 +409,14 @@ TEST_F(PeerConnectionMediaTestPlanB, SimulcastOffer) { TEST_F(PeerConnectionMediaTestPlanB, SimulcastAnswer) { auto caller = CreatePeerConnection(); caller->AddVideoTrack("v0"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto callee = CreatePeerConnection(); auto callee_video_track = callee->AddVideoTrack("v1"); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); RTCOfferAnswerOptions options; options.num_simulcast_layers = 3; - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); auto* description = GetFirstMediaContent(answer->description(), MediaType::VIDEO) ->media_description(); @@ -551,7 +553,7 @@ TEST_P(PeerConnectionMediaTest, auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnection(); ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); const auto* audio_content = GetFirstAudioContent(answer->description()); ASSERT_TRUE(audio_content); @@ -574,7 +576,8 @@ TEST_P(PeerConnectionMediaTest, RawPacketizationNotSetInOffer) { caller_fake_engine->SetVideoCodecs(fake_codecs); auto caller = CreatePeerConnectionWithVideo(std::move(caller_fake_engine)); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto* offer_description = GetFirstVideoContentDescription(offer->description()); for (const auto& codec : offer_description->codecs()) { @@ -600,7 +603,8 @@ TEST_P(PeerConnectionMediaTest, RawPacketizationSetInOfferAndAnswer) { options.raw_packetization_for_video = true; auto caller = CreatePeerConnectionWithVideo(std::move(caller_fake_engine)); - auto offer = caller->CreateOfferAndSetAsLocal(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(options); auto* offer_description = GetFirstVideoContentDescription(offer->description()); for (const auto& codec : offer_description->codecs()) { @@ -611,7 +615,8 @@ TEST_P(PeerConnectionMediaTest, RawPacketizationSetInOfferAndAnswer) { auto callee = CreatePeerConnectionWithVideo(std::move(callee_fake_engine)); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswerAndSetAsLocal(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(options); auto* answer_description = GetFirstVideoContentDescription(answer->description()); for (const auto& codec : answer_description->codecs()) { @@ -644,11 +649,13 @@ TEST_P(PeerConnectionMediaTest, callee_options.raw_packetization_for_video = true; auto caller = CreatePeerConnectionWithVideo(std::move(caller_fake_engine)); - auto offer = caller->CreateOfferAndSetAsLocal(caller_options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(caller_options); auto callee = CreatePeerConnectionWithVideo(std::move(callee_fake_engine)); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswerAndSetAsLocal(callee_options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(callee_options); auto* answer_description = GetFirstVideoContentDescription(answer->description()); @@ -688,7 +695,8 @@ TEST_P(PeerConnectionMediaOfferDirectionTest, VerifyDirection) { RTCOfferAnswerOptions options; options.offer_to_receive_audio = offer_to_receive_; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); auto* content = GetFirstMediaContent(offer->description(), MediaType::AUDIO); if (expected_direction_ == RtpTransceiverDirection::kInactive) { @@ -744,7 +752,7 @@ TEST_P(PeerConnectionMediaAnswerDirectionTest, VerifyDirection) { caller->AddAudioTrack("a"); // Create the offer with an audio section and set its direction. - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); GetFirstAudioContentDescription(offer->description()) ->set_direction(offer_direction_); @@ -757,7 +765,8 @@ TEST_P(PeerConnectionMediaAnswerDirectionTest, VerifyDirection) { // Create the answer according to the test parameters. RTCOfferAnswerOptions options; options.offer_to_receive_audio = offer_to_receive_; - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); // The expected direction in the answer is the intersection of each side's // capability to send/recv media. @@ -794,7 +803,7 @@ TEST_P(PeerConnectionMediaAnswerDirectionTest, VerifyRejected) { caller->AddAudioTrack("a"); // Create the offer with an audio section and set its direction. - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); GetFirstAudioContentDescription(offer->description()) ->set_direction(offer_direction_); @@ -807,7 +816,8 @@ TEST_P(PeerConnectionMediaAnswerDirectionTest, VerifyRejected) { // Create the answer according to the test parameters. RTCOfferAnswerOptions options; options.offer_to_receive_audio = offer_to_receive_; - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); // The media section is rejected if and only if offer_to_receive is explicitly // set to 0 and there is no media to send. @@ -834,7 +844,8 @@ TEST_P(PeerConnectionMediaTest, OfferHasDifferentDirectionForAudioVideo) { RTCOfferAnswerOptions options; options.offer_to_receive_audio = 1; options.offer_to_receive_video = 0; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_EQ(RtpTransceiverDirection::kRecvOnly, GetMediaContentDirection(offer.get(), MediaType::AUDIO)); @@ -858,7 +869,8 @@ TEST_P(PeerConnectionMediaTest, AnswerHasDifferentDirectionsForAudioVideo) { RTCOfferAnswerOptions options; options.offer_to_receive_audio = 1; options.offer_to_receive_video = 0; - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); EXPECT_EQ(RtpTransceiverDirection::kRecvOnly, GetMediaContentDirection(answer.get(), MediaType::AUDIO)); @@ -919,7 +931,8 @@ TEST_P(PeerConnectionMediaTest, RTCOfferAnswerOptions options; options.voice_activity_detection = false; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_FALSE(HasAnyComfortNoiseCodecs(offer->description())); } @@ -932,7 +945,8 @@ TEST_P(PeerConnectionMediaTest, RTCOfferAnswerOptions options; options.voice_activity_detection = true; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_TRUE(HasAnyComfortNoiseCodecs(offer->description())); } @@ -950,7 +964,8 @@ TEST_P(PeerConnectionMediaTest, RTCOfferAnswerOptions options; options.voice_activity_detection = true; - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); EXPECT_FALSE(HasAnyComfortNoiseCodecs(answer->description())); } @@ -971,7 +986,8 @@ TEST_P(PeerConnectionMediaTest, RTCOfferAnswerOptions options; options.voice_activity_detection = false; - auto answer = callee->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(options); EXPECT_FALSE(HasAnyComfortNoiseCodecs(answer->description())); } @@ -1004,7 +1020,7 @@ TEST_P(PeerConnectionMediaInvalidMediaTest, FailToSetRemoteAnswer) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); mutator_(answer->description()); std::string error; @@ -1018,7 +1034,7 @@ TEST_P(PeerConnectionMediaInvalidMediaTest, FailToSetLocalAnswer) { ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); mutator_(answer->description()); std::string error; @@ -1151,12 +1167,12 @@ TEST_P(PeerConnectionMediaTest, AnswerHasSameMidsAsOffer) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RenameContent(offer->description(), MediaType::AUDIO, kAudioMid); RenameContent(offer->description(), MediaType::VIDEO, kVideoMid); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); EXPECT_EQ(kAudioMid, GetFirstAudioContent(answer->description())->mid()); EXPECT_EQ(kVideoMid, GetFirstVideoContent(answer->description())->mid()); } @@ -1170,7 +1186,7 @@ TEST_P(PeerConnectionMediaTest, ReOfferHasSameMidsAsFirstOffer) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RenameContent(offer->description(), MediaType::AUDIO, kAudioMid); RenameContent(offer->description(), MediaType::VIDEO, kVideoMid); ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); @@ -1187,7 +1203,7 @@ TEST_P(PeerConnectionMediaTest, SetRemoteDescriptionFailsWithDuplicateMids) { auto caller = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo(); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); RenameContent(offer->description(), MediaType::AUDIO, "same"); RenameContent(offer->description(), MediaType::VIDEO, "same"); @@ -1221,9 +1237,11 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeReassigned) { auto callee = CreatePeerConnectionWithAudio(std::move(callee_fake_engine)); // Offer from the caller establishes 100 as the "foo" payload type. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto answer_description = GetFirstAudioContentDescription(answer->description()); ASSERT_EQ(1u, answer_description->codecs().size()); @@ -1267,9 +1285,11 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpMatchNoFmtp) { // Offer from the caller establishes 100 as the "foo" payload type. // Red (without fmtp) is negotiated. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto answer_description = GetFirstAudioContentDescription(answer->description()); ASSERT_EQ(2u, answer_description->codecs().size()); @@ -1313,9 +1333,11 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpNoMatchFmtp) { // Offer from the caller establishes 100 as the "foo" payload type. // It should not negotiate RED. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto answer_description = GetFirstAudioContentDescription(answer->description()); ASSERT_EQ(1u, answer_description->codecs().size()); @@ -1365,9 +1387,11 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeMustMatchBaseCodecs) { // Offer from the caller establishes 100 as the "foo" payload type. // It should not negotiate RED since RED is associated with foo, not bar. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto answer_description = GetFirstAudioContentDescription(answer->description()); ASSERT_EQ(1u, answer_description->codecs().size()); @@ -1401,9 +1425,11 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadMixed) { auto callee = CreatePeerConnectionWithAudio(std::move(callee_fake_engine)); // Offer from the caller establishes 100 as the "foo" payload type. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto answer_description = GetFirstAudioContentDescription(answer->description()); // RED is not negotiated. @@ -1436,9 +1462,11 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadDifferentRedundancy) { auto callee = CreatePeerConnectionWithAudio(std::move(callee_fake_engine)); // Offer from the caller establishes 100 as the "foo" payload type. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto answer_description = GetFirstAudioContentDescription(answer->description()); // RED is negotiated. @@ -1571,7 +1599,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, SetCodecPreferencesAllAudioCodecs) { // Normal case, set all capabilities as preferences EXPECT_TRUE(audio_transceiver->SetCodecPreferences(sender_audio_codecs).ok()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); EXPECT_TRUE(CompareCodecs(sender_audio_codecs, codecs)); @@ -1589,7 +1617,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, // Normal case, reset codec preferences EXPECT_TRUE(audio_transceiver->SetCodecPreferences(empty_codecs).ok()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); EXPECT_TRUE(CompareCodecs(sender_audio_codecs, codecs)); @@ -1649,7 +1677,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, SetCodecPreferencesAllVideoCodecs) { // Normal case, setting preferences to normal capabilities EXPECT_TRUE(video_transceiver->SetCodecPreferences(sender_video_codecs).ok()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); EXPECT_TRUE(CompareCodecs(sender_video_codecs, codecs)); @@ -1668,7 +1696,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, // Normal case, resetting preferences with empty list of codecs EXPECT_TRUE(video_transceiver->SetCodecPreferences(empty_codecs).ok()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); EXPECT_TRUE(CompareCodecs(sender_video_codecs, codecs)); @@ -1692,7 +1720,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, duplicate_codec.push_back(duplicate_codec.front()); EXPECT_TRUE(video_transceiver->SetCodecPreferences(duplicate_codec).ok()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); EXPECT_TRUE(CompareCodecs(single_codec, codecs)); @@ -1731,7 +1759,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, SetCodecPreferencesVideoWithRtx) { EXPECT_EQ(video_codecs_vpx_rtx.size(), 3u); // VP8, VP9, RTX EXPECT_TRUE( video_transceiver->SetCodecPreferences(video_codecs_vpx_rtx).ok()); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); @@ -1774,7 +1802,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, EXPECT_EQ(video_codecs_vpx.size(), 2u); // VP8, VP9 EXPECT_TRUE(send_transceiver->SetCodecPreferences(video_codecs_vpx).ok()); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); @@ -1795,7 +1824,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, EXPECT_EQ(video_codecs_vp8_rtx.size(), 2u); // VP8, RTX recv_transceiver->SetCodecPreferences(video_codecs_vp8_rtx); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto recv_codecs = answer->description()->contents()[0].media_description()->codecs(); @@ -1840,7 +1870,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, auto video_codecs_vpx_reverse = video_codecs_vpx; absl::c_reverse(video_codecs_vpx_reverse); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto codecs = offer->description()->contents()[0].media_description()->codecs(); EXPECT_EQ(codecs.size(), 2u); // VP9, VP8 @@ -1851,7 +1882,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, auto recv_transceiver = callee->pc()->GetTransceivers().front(); recv_transceiver->SetCodecPreferences(video_codecs_vpx_reverse); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); auto recv_codecs = answer->description()->contents()[0].media_description()->codecs(); @@ -1866,7 +1898,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, auto caller = CreatePeerConnectionWithAudio(std::move(fake_engine)); RTCOfferAnswerOptions options; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_TRUE(HasAnyComfortNoiseCodecs(offer->description())); auto transceiver = caller->pc()->GetTransceivers().front(); @@ -1913,7 +1946,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, EXPECT_TRUE(video_transceiver->SetCodecPreferences(capabilities.codecs).ok()); RTCOfferAnswerOptions options; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); EXPECT_FALSE(HasPayloadTypeConflict(offer->description())); // Sanity check that we got the primary codec and RTX. EXPECT_EQ( @@ -1958,7 +1992,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, caller->pc_factory()->GetRtpSenderCapabilities(MediaType::VIDEO); EXPECT_TRUE(video_transceiver->SetCodecPreferences(capabilities.codecs).ok()); - auto answer = caller->CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = + caller->CreateAnswer(options); EXPECT_FALSE(HasPayloadTypeConflict(answer->description())); // Sanity check that we got the primary codec and RTX. @@ -2077,7 +2112,8 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, SetCodecPreferencesVideoNoRtx) { EXPECT_TRUE(video_transceiver->SetCodecPreferences(capabilities.codecs).ok()); RTCOfferAnswerOptions options; - auto offer = caller->CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(options); const auto& content = offer->description()->contents()[0]; auto& codecs = content.media_description()->codecs(); ASSERT_EQ(codecs.size(), 2u); diff --git a/third_party/libwebrtc/pc/peer_connection_rtp_unittest.cc b/third_party/libwebrtc/pc/peer_connection_rtp_unittest.cc @@ -181,13 +181,14 @@ class PeerConnectionRtpTestUnifiedPlan : public PeerConnectionRtpBaseTest { PeerConnectionWrapper* caller, PeerConnectionWrapper* callee, size_t mid_to_stop) { - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); caller->SetLocalDescription(CloneSessionDescription(offer.get())); callee->SetRemoteDescription(std::move(offer)); EXPECT_LT(mid_to_stop, callee->pc()->GetTransceivers().size()); // Must use StopInternal in order to do instant reject. callee->pc()->GetTransceivers()[mid_to_stop]->StopInternal(); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(); EXPECT_TRUE(answer); bool set_local_answer = callee->SetLocalDescription(CloneSessionDescription(answer.get())); @@ -321,7 +322,8 @@ TEST_F(PeerConnectionRtpTestPlanB, EXPECT_EQ(callee->observer()->add_track_events_.size(), 1u); // Change the stream ID of the sender in the session description. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto* audio_desc = GetFirstAudioContentDescription(offer->description()); ASSERT_EQ(audio_desc->mutable_streams().size(), 1u); audio_desc->mutable_streams()[0].set_stream_ids({kStreamId2}); @@ -772,7 +774,8 @@ TEST_F(PeerConnectionRtpTestUnifiedPlan, UnsignaledSsrcCreatesReceiverStreams) { caller->AddTrack(caller->CreateAudioTrack("audio_track1"), {kStreamId1, kStreamId2}); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); // Munge the offer to take out everything but the stream_ids. auto contents = offer->description()->contents(); ASSERT_TRUE(!contents.empty()); @@ -819,7 +822,7 @@ TEST_F(PeerConnectionRtpTestUnifiedPlan, TracksDoNotEndWhenSsrcChanges) { // Do a follow-up offer/answer exchange where the SSRCs are modified. ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); auto& contents = answer->description()->contents(); ASSERT_TRUE(!contents.empty()); for (size_t i = 0; i < contents.size(); ++i) { @@ -863,7 +866,8 @@ TEST_F(PeerConnectionRtpTestUnifiedPlan, EXPECT_EQ(callee->observer()->add_track_events_.size(), 1u); // Change the stream id of the sender in the session description. - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); ASSERT_EQ(contents[0].media_description()->mutable_streams().size(), 1u); @@ -895,7 +899,8 @@ TEST_F(PeerConnectionRtpTestPlanB, caller->AddAudioTrack("audio_track1", {kStreamId1}); caller->AddAudioTrack("audio_track2", {kStreamId2}); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); auto mutable_streams = GetFirstAudioContentDescription(offer->description())->mutable_streams(); ASSERT_EQ(mutable_streams.size(), 2u); @@ -936,7 +941,8 @@ TEST_P(PeerConnectionRtpTest, scoped_refptr<MockSetSessionDescriptionObserver> observer = make_ref_counted<MockSetSessionDescriptionObserver>(); - auto offer = caller->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); callee->pc()->SetRemoteDescription(observer.get(), offer.release()); callee = nullptr; Thread::Current()->ProcessMessages(0); @@ -1912,7 +1918,7 @@ TEST_F(PeerConnectionMsidSignalingTest, PureUnifiedPlanToUs) { auto callee = CreatePeerConnectionWithUnifiedPlan(); callee->AddAudioTrack("callee_audio"); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); // Simulate a pure Unified Plan offerer by setting the MSID signaling to media // section only. offer->description()->set_msid_signaling(kMsidSignalingSemantic | @@ -1923,7 +1929,7 @@ TEST_F(PeerConnectionMsidSignalingTest, PureUnifiedPlanToUs) { ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer))); // Answer should have only a=msid to match the offer. - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); EXPECT_EQ(kMsidSignalingSemantic | kMsidSignalingMediaSection, answer->description()->msid_signaling()); } diff --git a/third_party/libwebrtc/pc/peer_connection_signaling_unittest.cc b/third_party/libwebrtc/pc/peer_connection_signaling_unittest.cc @@ -289,7 +289,8 @@ class PeerConnectionSignalingStateTest case SignalingState::kHaveLocalPrAnswer: { auto caller = CreatePeerConnectionWithAudioVideo(GetConfig()); wrapper->SetRemoteDescription(caller->CreateOffer()); - auto answer = wrapper->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = + wrapper->CreateAnswer(); wrapper->SetLocalDescription( CloneSessionDescriptionAsType(answer.get(), SdpType::kPrAnswer)); break; @@ -302,7 +303,8 @@ class PeerConnectionSignalingStateTest case SignalingState::kHaveRemotePrAnswer: { auto callee = CreatePeerConnectionWithAudioVideo(GetConfig()); callee->SetRemoteDescription(wrapper->CreateOfferAndSetAsLocal()); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(); wrapper->SetRemoteDescription( CloneSessionDescriptionAsType(answer.get(), SdpType::kPrAnswer)); break; @@ -365,7 +367,7 @@ TEST_P(PeerConnectionSignalingStateTest, SetLocalOffer) { } else { auto wrapper_for_offer = CreatePeerConnectionInState(SignalingState::kHaveLocalOffer); - auto offer = + std::unique_ptr<SessionDescriptionInterface> offer = CloneSessionDescription(wrapper_for_offer->pc()->local_description()); std::string error; @@ -398,7 +400,8 @@ TEST_P(PeerConnectionSignalingStateTest, SetLocalPrAnswer) { TEST_P(PeerConnectionSignalingStateTest, SetLocalAnswer) { auto wrapper_for_answer = CreatePeerConnectionInState(SignalingState::kHaveRemoteOffer); - auto answer = wrapper_for_answer->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = + wrapper_for_answer->CreateAnswer(); auto wrapper = CreatePeerConnectionUnderTest(); if (wrapper->signaling_state() == SignalingState::kHaveLocalPrAnswer || @@ -416,7 +419,7 @@ TEST_P(PeerConnectionSignalingStateTest, SetLocalAnswer) { TEST_P(PeerConnectionSignalingStateTest, SetRemoteOffer) { auto wrapper_for_offer = CreatePeerConnectionInState(SignalingState::kHaveRemoteOffer); - auto offer = + std::unique_ptr<SessionDescriptionInterface> offer = CloneSessionDescription(wrapper_for_offer->pc()->remote_description()); auto wrapper = CreatePeerConnectionUnderTest(); @@ -455,7 +458,8 @@ TEST_P(PeerConnectionSignalingStateTest, SetRemotePrAnswer) { TEST_P(PeerConnectionSignalingStateTest, SetRemoteAnswer) { auto wrapper_for_answer = CreatePeerConnectionInState(SignalingState::kHaveRemoteOffer); - auto answer = wrapper_for_answer->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = + wrapper_for_answer->CreateAnswer(); auto wrapper = CreatePeerConnectionUnderTest(); if (wrapper->signaling_state() == SignalingState::kHaveLocalOffer || @@ -674,7 +678,8 @@ TEST_P(PeerConnectionSignalingTest, CloseAfterImplicitCreateOfferAndShutdown) { TEST_P(PeerConnectionSignalingTest, SetLocalDescriptionNewObserverIsInvokedImmediately) { auto caller = CreatePeerConnection(); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); auto observer = make_ref_counted<FakeSetLocalDescriptionObserver>(); caller->pc()->SetLocalDescription(std::move(offer), observer); @@ -686,7 +691,8 @@ TEST_P(PeerConnectionSignalingTest, TEST_P(PeerConnectionSignalingTest, SetLocalDescriptionOldObserverIsInvokedInAPostedMessage) { auto caller = CreatePeerConnection(); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); auto observer = MockSetSessionDescriptionObserver::Create(); caller->pc()->SetLocalDescription(observer.get(), offer.release()); @@ -708,7 +714,8 @@ TEST_P(PeerConnectionSignalingTest, SetRemoteDescriptionExecutesImmediately) { auto callee = CreatePeerConnection(); // This offer will cause receivers to be created. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); // By not waiting for the observer's callback we can verify that the operation // executed immediately. @@ -722,7 +729,8 @@ TEST_P(PeerConnectionSignalingTest, CreateOfferBlocksSetRemoteDescription) { auto callee = CreatePeerConnection(); // This offer will cause receivers to be created. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); EXPECT_EQ(0u, callee->pc()->GetReceivers().size()); auto offer_observer = @@ -919,7 +927,7 @@ TEST_P(PeerConnectionSignalingTest, UnsupportedContentType) { EXPECT_TRUE(caller->SetRemoteDescription(std::move(remote_description))); // Assert we respond back with something meaningful. - auto answer = caller->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = caller->CreateAnswer(); ASSERT_EQ(answer->description()->contents().size(), 1u); EXPECT_NE(answer->description() ->contents()[0] @@ -943,7 +951,7 @@ TEST_P(PeerConnectionSignalingTest, UnsupportedContentType) { EXPECT_TRUE(caller->SetLocalDescription(std::move(answer))); // Assert we keep this in susequent offers. - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); EXPECT_EQ(offer->description() ->contents()[0] .media_description() @@ -999,7 +1007,7 @@ TEST_P(PeerConnectionSignalingTest, ReceiveFlexFec) { EXPECT_TRUE(caller->SetRemoteDescription(std::move(remote_description))); - auto answer = caller->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = caller->CreateAnswer(); ASSERT_EQ(answer->description()->contents().size(), 1u); ASSERT_NE(answer->description()->contents()[0].media_description(), nullptr); auto codecs = @@ -1050,7 +1058,7 @@ TEST_P(PeerConnectionSignalingTest, ReceiveFlexFecReoffer) { EXPECT_TRUE(caller->SetRemoteDescription(std::move(remote_description))); - auto answer = caller->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = caller->CreateAnswer(); ASSERT_EQ(answer->description()->contents().size(), 1u); ASSERT_NE(answer->description()->contents()[0].media_description(), nullptr); auto codecs = @@ -1062,7 +1070,8 @@ TEST_P(PeerConnectionSignalingTest, ReceiveFlexFecReoffer) { EXPECT_TRUE(caller->SetLocalDescription(std::move(answer))); // This generates a collision for AV1 which needs to be remapped. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); auto offer_codecs = offer->description()->contents()[0].media_description()->codecs(); auto flexfec_it = std::find_if( @@ -1135,7 +1144,8 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, auto caller = CreatePeerConnectionWithAudioVideo(); // This offer will cause transceiver mids to get assigned. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); // By not waiting for the observer's callback we can verify that the operation // executed immediately. The old observer is invoked in a posted message, so @@ -1152,7 +1162,8 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, auto caller = CreatePeerConnectionWithAudioVideo(); // This offer will cause transceiver mids to get assigned. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); // Verify that mids were assigned without waiting for the observer. (However, // the new observer should also be invoked synchronously - as is ensured by @@ -1168,7 +1179,8 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, auto caller = CreatePeerConnectionWithAudioVideo(); // This offer will cause transceiver mids to get assigned. - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); auto offer_observer = make_ref_counted<ExecuteFunctionOnCreateSessionDescriptionObserver>( @@ -1197,12 +1209,14 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, EXPECT_FALSE(HasDtlsTransport(caller)); EXPECT_FALSE(HasDtlsTransport(callee)); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); caller->SetLocalDescription(CloneSessionDescription(offer.get())); EXPECT_TRUE(HasDtlsTransport(caller)); callee->SetRemoteDescription(std::move(offer)); EXPECT_FALSE(HasDtlsTransport(callee)); - auto answer = callee->CreateAnswer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(RTCOfferAnswerOptions()); callee->SetLocalDescription(CloneSessionDescription(answer.get())); EXPECT_TRUE(HasDtlsTransport(callee)); caller->SetRemoteDescription(std::move(answer)); @@ -1217,11 +1231,13 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, DtlsTransportsMergeWhenBundled) { EXPECT_FALSE(HasDtlsTransport(caller)); EXPECT_FALSE(HasDtlsTransport(callee)); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); caller->SetLocalDescription(CloneSessionDescription(offer.get())); EXPECT_EQ(2, NumberOfDtlsTransports(caller)); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(RTCOfferAnswerOptions()); callee->SetLocalDescription(CloneSessionDescription(answer.get())); caller->SetRemoteDescription(std::move(answer)); EXPECT_EQ(1, NumberOfDtlsTransports(caller)); @@ -1238,11 +1254,13 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, EXPECT_FALSE(HasDtlsTransport(callee)); RTCOfferAnswerOptions unbundle_options; unbundle_options.use_rtp_mux = false; - auto offer = caller->CreateOffer(unbundle_options); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(unbundle_options); caller->SetLocalDescription(CloneSessionDescription(offer.get())); EXPECT_EQ(2, NumberOfDtlsTransports(caller)); callee->SetRemoteDescription(std::move(offer)); - auto answer = callee->CreateAnswer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(RTCOfferAnswerOptions()); callee->SetLocalDescription(CloneSessionDescription(answer.get())); EXPECT_EQ(2, NumberOfDtlsTransports(callee)); caller->SetRemoteDescription(std::move(answer)); @@ -1294,7 +1312,8 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, SuppressNegotiationNeededWhenSignalingStateIsNotStable) { auto caller = CreatePeerConnection(); auto callee = CreatePeerConnection(); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); EXPECT_FALSE(caller->observer()->has_negotiation_needed_event()); auto transceiver = @@ -1351,7 +1370,8 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, RtxReofferApt) { EXPECT_TRUE(callee->SetRemoteDescription(std::move(remote_description))); - auto answer = callee->CreateAnswer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswer(RTCOfferAnswerOptions()); EXPECT_TRUE( callee->SetLocalDescription(CloneSessionDescription(answer.get()))); @@ -1377,13 +1397,15 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, LoopbackSdpIsPossible) { auto transceiver = caller->AddTransceiver(MediaType::AUDIO, RtpTransceiverInit()); - auto offer = caller->CreateOffer(RTCOfferAnswerOptions()); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOffer(RTCOfferAnswerOptions()); std::string offer_sdp; ASSERT_TRUE(offer->ToString(&offer_sdp)); std::string answer_sdp = absl::StrReplaceAll(offer_sdp, {{"a=setup:actpass", "a=setup:active"}}); EXPECT_TRUE(caller->SetLocalDescription(std::move(offer))); - auto answer = CreateSessionDescription(SdpType::kAnswer, answer_sdp); + std::unique_ptr<SessionDescriptionInterface> answer = + CreateSessionDescription(SdpType::kAnswer, answer_sdp); EXPECT_TRUE(caller->SetRemoteDescription(std::move(answer))); } diff --git a/third_party/libwebrtc/pc/peer_connection_simulcast_unittest.cc b/third_party/libwebrtc/pc/peer_connection_simulcast_unittest.cc @@ -53,6 +53,8 @@ #include "test/gmock.h" #include "test/gtest.h" +namespace webrtc { + using ::testing::Contains; using ::testing::Each; using ::testing::ElementsAre; @@ -62,19 +64,12 @@ using ::testing::Field; using ::testing::IsEmpty; using ::testing::Le; using ::testing::Ne; +using ::testing::NotNull; using ::testing::Pair; using ::testing::Property; using ::testing::SizeIs; using ::testing::StartsWith; -using webrtc::MediaContentDescription; -using ::webrtc::RidDescription; -using ::webrtc::SimulcastDescription; -using ::webrtc::SimulcastLayer; -using ::webrtc::StreamParams; - -namespace webrtc { - class PeerConnectionSimulcastTests : public ::testing::Test { public: PeerConnectionSimulcastTests() @@ -120,12 +115,14 @@ class PeerConnectionSimulcastTests : public ::testing::Test { void ExchangeOfferAnswer(PeerConnectionWrapper* local, PeerConnectionWrapper* remote, const std::vector<SimulcastLayer>& answer_layers) { - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); // Remove simulcast as the second peer connection won't support it. RemoveSimulcast(offer.get()); std::string err; EXPECT_TRUE(remote->SetRemoteDescription(std::move(offer), &err)) << err; - auto answer = remote->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + remote->CreateAnswerAndSetAsLocal(); // Setup the answer to look like a server response. auto mcd_answer = answer->description()->contents()[0].media_description(); auto& receive_layers = mcd_answer->simulcast_description().receive_layers(); @@ -230,8 +227,9 @@ TEST_F(PeerConnectionSimulcastTests, ChecksForIllegalRidValues) { TEST_F(PeerConnectionSimulcastTests, SingleRidIsRemovedFromSessionDescription) { auto pc = CreatePeerConnectionWrapper(); auto transceiver = AddTransceiver(pc.get(), CreateLayers({"1"}, true)); - auto offer = pc->CreateOfferAndSetAsLocal(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = + pc->CreateOfferAndSetAsLocal(); + ASSERT_THAT(offer, NotNull()); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); EXPECT_THAT(contents[0].media_description()->streams(), @@ -257,8 +255,8 @@ TEST_F(PeerConnectionSimulcastTests, SimulcastAppearsInSessionDescription) { std::vector<std::string> rids({"f", "h", "q"}); auto layers = CreateLayers(rids, true); auto transceiver = AddTransceiver(pc.get(), layers); - auto offer = pc->CreateOffer(); - ASSERT_TRUE(offer); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); + ASSERT_THAT(offer, NotNull()); auto contents = offer->description()->contents(); ASSERT_EQ(1u, contents.size()); auto content = contents[0]; @@ -287,7 +285,8 @@ TEST_F(PeerConnectionSimulcastTests, SimulcastLayersAreSetInSender) { auto remote = CreatePeerConnectionWrapper(); auto layers = CreateLayers({"f", "h", "q"}, true); auto transceiver = AddTransceiver(local.get(), layers); - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); { SCOPED_TRACE("after create offer"); ValidateTransceiverParameters(transceiver, layers); @@ -296,7 +295,8 @@ TEST_F(PeerConnectionSimulcastTests, SimulcastLayersAreSetInSender) { auto simulcast = RemoveSimulcast(offer.get()); std::string error; EXPECT_TRUE(remote->SetRemoteDescription(std::move(offer), &error)) << error; - auto answer = remote->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + remote->CreateAnswerAndSetAsLocal(); // Setup an answer that mimics a server accepting simulcast. auto mcd_answer = answer->description()->contents()[0].media_description(); @@ -321,7 +321,8 @@ TEST_F(PeerConnectionSimulcastTests, PausedSimulcastLayersAreDisabledInSender) { auto server_layers = CreateLayers({"f", "h", "q"}, {true, false, false}); RTC_DCHECK_EQ(layers.size(), server_layers.size()); auto transceiver = AddTransceiver(local.get(), layers); - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); { SCOPED_TRACE("after create offer"); ValidateTransceiverParameters(transceiver, layers); @@ -331,7 +332,8 @@ TEST_F(PeerConnectionSimulcastTests, PausedSimulcastLayersAreDisabledInSender) { RemoveSimulcast(offer.get()); std::string error; EXPECT_TRUE(remote->SetRemoteDescription(std::move(offer), &error)) << error; - auto answer = remote->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + remote->CreateAnswerAndSetAsLocal(); // Setup an answer that mimics a server accepting simulcast. auto mcd_answer = answer->description()->contents()[0].media_description(); @@ -369,7 +371,8 @@ TEST_F(PeerConnectionSimulcastTests, RejectedSimulcastLayersAreDeactivated) { auto layers = CreateLayers({"1", "2", "3"}, true); auto expected_layers = CreateLayers({"2", "3"}, true); auto transceiver = AddTransceiver(local.get(), layers); - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); { SCOPED_TRACE("after create offer"); ValidateTransceiverParameters(transceiver, layers); @@ -378,7 +381,8 @@ TEST_F(PeerConnectionSimulcastTests, RejectedSimulcastLayersAreDeactivated) { auto removed_simulcast = RemoveSimulcast(offer.get()); std::string error; EXPECT_TRUE(remote->SetRemoteDescription(std::move(offer), &error)) << error; - auto answer = remote->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + remote->CreateAnswerAndSetAsLocal(); auto mcd_answer = answer->description()->contents()[0].media_description(); // Setup the answer to look like a server response. // Remove one of the layers to reject it in the answer. @@ -403,7 +407,8 @@ TEST_F(PeerConnectionSimulcastTests, ServerSendsOfferToReceiveSimulcast) { auto remote = CreatePeerConnectionWrapper(); auto layers = CreateLayers({"f", "h", "q"}, true); AddTransceiver(local.get(), layers); - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); // Remove simulcast as a sender and set it up as a receiver. RemoveSimulcast(offer.get()); AddRequestToReceiveSimulcast(layers, offer.get()); @@ -422,7 +427,8 @@ TEST_F(PeerConnectionSimulcastTests, TransceiverIsNotRecycledWithSimulcast) { auto remote = CreatePeerConnectionWrapper(); auto layers = CreateLayers({"f", "h", "q"}, true); AddTransceiver(local.get(), layers); - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); // Remove simulcast as a sender and set it up as a receiver. RemoveSimulcast(offer.get()); AddRequestToReceiveSimulcast(layers, offer.get()); @@ -483,12 +489,14 @@ TEST_F(PeerConnectionSimulcastTests, NegotiationDoesNotHaveRidExtensionFails) { auto layers = CreateLayers({"1", "2", "3"}, true); auto expected_layers = CreateLayers({"1"}, true); auto transceiver = AddTransceiver(local.get(), layers); - auto offer = local->CreateOfferAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> offer = + local->CreateOfferAndSetAsLocal(); // Remove simulcast as the second peer connection won't support it. RemoveSimulcast(offer.get()); std::string err; EXPECT_TRUE(remote->SetRemoteDescription(std::move(offer), &err)) << err; - auto answer = remote->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + remote->CreateAnswerAndSetAsLocal(); // Setup the answer to look like a server response. // Drop the RID header extension. auto mcd_answer = answer->description()->contents()[0].media_description(); @@ -535,7 +543,7 @@ TEST_F(PeerConnectionSimulcastTests, SimulcastSldModificationRejected) { auto remote = CreatePeerConnectionWrapper(); auto layers = CreateLayers({"1", "2", "3"}, true); AddTransceiver(local.get(), layers); - auto offer = local->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = local->CreateOffer(); std::string as_string; EXPECT_TRUE(offer->ToString(&as_string)); auto simulcast_marker = "a=rid:3 send\r\na=simulcast:send 1;2;3\r\n"; diff --git a/third_party/libwebrtc/pc/peer_connection_wrapper.cc b/third_party/libwebrtc/pc/peer_connection_wrapper.cc @@ -108,7 +108,7 @@ PeerConnectionWrapper::CreateOfferAndSetAsLocal() { std::unique_ptr<SessionDescriptionInterface> PeerConnectionWrapper::CreateOfferAndSetAsLocal( const PeerConnectionInterface::RTCOfferAnswerOptions& options) { - auto offer = CreateOffer(options); + std::unique_ptr<SessionDescriptionInterface> offer = CreateOffer(options); if (!offer) { return nullptr; } @@ -140,7 +140,7 @@ PeerConnectionWrapper::CreateAnswerAndSetAsLocal() { std::unique_ptr<SessionDescriptionInterface> PeerConnectionWrapper::CreateAnswerAndSetAsLocal( const PeerConnectionInterface::RTCOfferAnswerOptions& options) { - auto answer = CreateAnswer(options); + std::unique_ptr<SessionDescriptionInterface> answer = CreateAnswer(options); if (!answer) { return nullptr; } @@ -244,7 +244,8 @@ bool PeerConnectionWrapper::ExchangeOfferAnswerWith( RTC_LOG(LS_ERROR) << "Cannot exchange offer/answer with ourself!"; return false; } - auto offer = CreateOffer(offer_options); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateOffer(offer_options); EXPECT_TRUE(offer); if (!offer) { return false; @@ -260,7 +261,8 @@ bool PeerConnectionWrapper::ExchangeOfferAnswerWith( if (!set_remote_offer) { return false; } - auto answer = answerer->CreateAnswer(answer_options); + std::unique_ptr<SessionDescriptionInterface> answer = + answerer->CreateAnswer(answer_options); EXPECT_TRUE(answer); if (!answer) { return false; diff --git a/third_party/libwebrtc/pc/sdp_munging_detector_unittest.cc b/third_party/libwebrtc/pc/sdp_munging_detector_unittest.cc @@ -272,7 +272,7 @@ TEST_F(SdpMungingTest, AllowListAcceptsUnmunged) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangle/Enabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); RTCError error; EXPECT_TRUE(pc->SetLocalDescription(std::move(offer), &error)); } @@ -281,7 +281,7 @@ TEST_F(SdpMungingTest, DenyListAcceptsUnmunged) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangleAllowForTesting/Enabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); RTCError error; EXPECT_TRUE(pc->SetLocalDescription(std::move(offer), &error)); } @@ -292,7 +292,7 @@ TEST_F(SdpMungingTest, DenyListThrows) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangleAllowForTesting/Enabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -318,7 +318,7 @@ TEST_F(SdpMungingTest, DenyListExceptionDoesNotThrow) { CreatePeerConnection("WebRTC-NoSdpMangleAllowForTesting/Enabled,68/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -352,7 +352,8 @@ TEST_F(SdpMungingTest, InitialSetLocalDescriptionWithoutCreateOffer) { "a=setup:actpass\r\n" "a=ice-ufrag:ETEn\r\n" "a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); RTCError error; EXPECT_TRUE(pc->SetLocalDescription(std::move(offer), &error)); EXPECT_THAT( @@ -381,11 +382,13 @@ TEST_F(SdpMungingTest, InitialSetLocalDescriptionWithoutCreateAnswer) { "a=sendrecv\r\n" "a=mid:0\r\n" "a=rtpmap:111 opus/48000/2\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer))); RTCError error; - auto answer = CreateSessionDescription(SdpType::kAnswer, sdp); + std::unique_ptr<SessionDescriptionInterface> answer = + CreateSessionDescription(SdpType::kAnswer, sdp); answer->description()->transport_infos()[0].description.connection_role = CONNECTIONROLE_ACTIVE; EXPECT_TRUE(pc->SetLocalDescription(std::move(answer), &error)); @@ -398,7 +401,7 @@ TEST_F(SdpMungingTest, IceUfrag) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangleUfrag/Enabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_ufrag = @@ -421,7 +424,7 @@ TEST_F(SdpMungingTest, IceUfragCheckDisabledByFieldTrial) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangleUfrag/Disabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_ufrag = @@ -445,7 +448,7 @@ TEST_F(SdpMungingTest, IceUfragWithCheckDisabledForTesting) { pc->GetInternalPeerConnection()->DisableSdpMungingChecksForTesting(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_ufrag = @@ -461,7 +464,7 @@ TEST_F(SdpMungingTest, IcePwdCheckDisabledByFieldTrial) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangleUfrag/Disabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_pwd = "amungedicepwdthisshouldberejected"; @@ -482,7 +485,7 @@ TEST_F(SdpMungingTest, IcePwd) { auto pc = CreatePeerConnection("WebRTC-NoSdpMangleUfrag/Enabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_pwd = "amungedicepwdthisshouldberejected"; @@ -509,7 +512,7 @@ TEST_F(SdpMungingTest, IceUfragRestrictedAddresses) { "127.0.0.1:12345|127.0.0.*:23456|*:34567/"); auto callee = CreatePeerConnection(); caller->AddAudioTrack("audio_track", {}); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_ufrag = "amungediceufrag"; @@ -517,7 +520,7 @@ TEST_F(SdpMungingTest, IceUfragRestrictedAddresses) { EXPECT_TRUE(caller->SetLocalDescription(offer->Clone())); EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer))); - auto answer = callee->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = callee->CreateAnswer(); EXPECT_TRUE(callee->SetLocalDescription(answer->Clone())); EXPECT_TRUE(caller->SetRemoteDescription(std::move(answer))); @@ -577,7 +580,7 @@ TEST_F(SdpMungingTest, IceUfragSdpRejectedAndRestrictedAddresses) { "WebRTC-NoSdpMangleUfrag/Enabled/"); auto callee = CreatePeerConnection(); caller->AddAudioTrack("audio_track", {}); - auto offer = caller->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = caller->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_ufrag = "amungediceufrag"; @@ -598,7 +601,7 @@ TEST_F(SdpMungingTest, IceMode) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.ice_mode = ICEMODE_LITE; @@ -613,7 +616,7 @@ TEST_F(SdpMungingTest, IceOptions) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.transport_options.push_back( @@ -629,7 +632,7 @@ TEST_F(SdpMungingTest, IceOptionsRenomination) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); ASSERT_THAT(transport_infos[0].description.transport_options, @@ -665,7 +668,7 @@ TEST_F(SdpMungingTest, DtlsRole) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& transport_infos = offer->description()->transport_infos(); ASSERT_EQ(transport_infos.size(), 1u); transport_infos[0].description.connection_role = CONNECTIONROLE_PASSIVE; @@ -680,7 +683,7 @@ TEST_F(SdpMungingTest, RemoveContentDefault) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto name = contents[0].mid(); @@ -709,7 +712,7 @@ TEST_F(SdpMungingTest, RemoveContentKillswitch) { CreatePeerConnection("WebRTC-NoSdpMangleNumberOfContents/Disabled/"); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto name = contents[0].mid(); @@ -737,7 +740,7 @@ TEST_F(SdpMungingTest, TransceiverDirection) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); @@ -760,7 +763,7 @@ TEST_F(SdpMungingTest, Mid) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); std::string name(contents[0].mid()); @@ -787,7 +790,7 @@ TEST_F(SdpMungingTest, LegacySimulcast) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -819,7 +822,7 @@ TEST_F(SdpMungingTest, H264SpsPpsIdrInKeyFrame) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -845,7 +848,7 @@ TEST_F(SdpMungingTest, OpusStereo) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -868,7 +871,7 @@ TEST_F(SdpMungingTest, OpusFec) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -892,7 +895,7 @@ TEST_F(SdpMungingTest, OpusDtx) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -915,7 +918,7 @@ TEST_F(SdpMungingTest, OpusCbr) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -938,7 +941,7 @@ TEST_F(SdpMungingTest, AudioCodecsRemoved) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -957,7 +960,7 @@ TEST_F(SdpMungingTest, AudioCodecsAdded) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -978,7 +981,7 @@ TEST_F(SdpMungingTest, VideoCodecsRemoved) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -997,7 +1000,7 @@ TEST_F(SdpMungingTest, VideoCodecsAdded) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1018,7 +1021,7 @@ TEST_F(SdpMungingTest, VideoCodecsAddedWithRawPacketization) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1041,7 +1044,7 @@ TEST_F(SdpMungingTest, VideoCodecsModifiedWithRawPacketization) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1062,7 +1065,7 @@ TEST_F(SdpMungingTest, MultiOpus) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1087,7 +1090,7 @@ TEST_F(SdpMungingTest, L16) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1110,7 +1113,7 @@ TEST_F(SdpMungingTest, AudioSsrc) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1129,7 +1132,7 @@ TEST_F(SdpMungingTest, HeaderExtensionAdded) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1149,7 +1152,7 @@ TEST_F(SdpMungingTest, HeaderExtensionRemoved) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1167,7 +1170,7 @@ TEST_F(SdpMungingTest, HeaderExtensionModified) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1188,7 +1191,7 @@ TEST_F(SdpMungingTest, PayloadTypeChanged) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1209,7 +1212,7 @@ TEST_F(SdpMungingTest, AudioCodecsReordered) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1230,7 +1233,7 @@ TEST_F(SdpMungingTest, VideoCodecsReordered) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1251,7 +1254,7 @@ TEST_F(SdpMungingTest, AudioCodecsFmtp) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1272,7 +1275,7 @@ TEST_F(SdpMungingTest, VideoCodecsFmtp) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1293,7 +1296,7 @@ TEST_F(SdpMungingTest, AudioCodecsRtcpFb) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1314,7 +1317,7 @@ TEST_F(SdpMungingTest, AudioCodecsRtcpFbNack) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1335,7 +1338,7 @@ TEST_F(SdpMungingTest, AudioCodecsRtcpFbRrtr) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1374,10 +1377,11 @@ TEST_F(SdpMungingTest, RtcpMux) { "a=sendrecv\r\n" "a=mid:0\r\n" "a=rtpmap:111 opus/48000/2\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer))); - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); auto& contents = answer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1397,7 +1401,7 @@ TEST_F(SdpMungingTest, VideoCodecsRtcpFb) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1418,7 +1422,7 @@ TEST_F(SdpMungingTest, AudioCodecsRtcpReducedSize) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); @@ -1437,7 +1441,7 @@ TEST_F(SdpMungingTest, VideoCodecsRtcpReducedSize) { auto pc = CreatePeerConnection(); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& contents = offer->description()->contents(); ASSERT_EQ(contents.size(), 1u); auto* media_description = contents[0].media_description(); diff --git a/third_party/libwebrtc/pc/sdp_offer_answer_unittest.cc b/third_party/libwebrtc/pc/sdp_offer_answer_unittest.cc @@ -67,8 +67,10 @@ namespace webrtc { using ::testing::ElementsAre; using ::testing::Eq; using ::testing::IsTrue; +using ::testing::NotNull; using ::testing::Pair; using ::testing::SizeIs; + using RTCConfiguration = PeerConnectionInterface::RTCConfiguration; namespace { @@ -536,11 +538,12 @@ TEST_F(SdpOfferAnswerTest, RejectedDataChannelsDoNotGetReoffered) { "a=max-message-size:262144\r\n" "a=mid:" + mid + "\r\n"; - auto answer = CreateSessionDescription(SdpType::kAnswer, sdp); + std::unique_ptr<SessionDescriptionInterface> answer = + CreateSessionDescription(SdpType::kAnswer, sdp); ASSERT_TRUE(pc->SetRemoteDescription(std::move(answer))); // The subsequent offer should not recycle the m-line since the existing data // channel is closed. - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); const auto& offer_contents = offer->description()->contents(); ASSERT_EQ(offer_contents.size(), 1u); EXPECT_EQ(offer_contents[0].mid(), mid); @@ -571,7 +574,8 @@ TEST_F(SdpOfferAnswerTest, RejectedDataChannelsDoGetReofferedWhenActive) { "a=max-message-size:262144\r\n" "a=mid:" + mid + "\r\n"; - auto answer = CreateSessionDescription(SdpType::kAnswer, sdp); + std::unique_ptr<SessionDescriptionInterface> answer = + CreateSessionDescription(SdpType::kAnswer, sdp); ASSERT_TRUE(pc->SetRemoteDescription(std::move(answer))); // The subsequent offer should recycle the m-line when there is a new data @@ -580,7 +584,7 @@ TEST_F(SdpOfferAnswerTest, RejectedDataChannelsDoGetReofferedWhenActive) { EXPECT_TRUE(pc->pc()->ShouldFireNegotiationNeededEvent( pc->observer()->latest_negotiation_needed_event())); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); const auto& offer_contents = offer->description()->contents(); ASSERT_EQ(offer_contents.size(), 1u); EXPECT_EQ(offer_contents[0].mid(), mid); @@ -632,7 +636,8 @@ TEST_F(SdpOfferAnswerTest, SimulcastAnswerWithNoRidsIsRejected) { std::string extensions = "a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid\r\n" "a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\n"; - auto answer = CreateSessionDescription(SdpType::kAnswer, sdp); + std::unique_ptr<SessionDescriptionInterface> answer = + CreateSessionDescription(SdpType::kAnswer, sdp); EXPECT_FALSE(pc->SetRemoteDescription(std::move(answer))); auto answer_with_extensions = @@ -668,7 +673,7 @@ TEST_F(SdpOfferAnswerTest, SimulcastOfferWithMixedCodec) { init.send_encodings.push_back(rid2); auto transceiver = pc->AddTransceiver(MediaType::VIDEO, init); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& offer_contents = offer->description()->contents(); auto send_codecs = offer_contents[0].media_description()->codecs(); // Verify that the serialized SDP includes pt=. @@ -730,7 +735,8 @@ TEST_F(SdpOfferAnswerTest, SimulcastAnswerWithPayloadType) { "a=rid:2 recv pt=97\r\n" "a=simulcast:recv 1;2\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer))); auto transceiver = pc->pc()->GetTransceivers()[0]; @@ -739,7 +745,7 @@ TEST_F(SdpOfferAnswerTest, SimulcastAnswerWithPayloadType) { .ok()); // Check the generated SDP. - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); answer->ToString(&sdp); EXPECT_THAT(sdp, testing::HasSubstr("a=rid:1 send pt=96\r\n")); EXPECT_THAT(sdp, testing::HasSubstr("a=rid:2 send pt=97\r\n")); @@ -773,7 +779,8 @@ TEST_F(SdpOfferAnswerTest, ExpectAllSsrcsSpecifiedInSsrcGroupFid) { "a=fmtp:97 apt=96\r\n" "a=ssrc-group:FID 1 2\r\n" "a=ssrc:1 cname:test\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); RTCError error; pc->SetRemoteDescription(std::move(offer), &error); EXPECT_FALSE(error.ok()); @@ -806,7 +813,8 @@ TEST_F(SdpOfferAnswerTest, ExpectAllSsrcsSpecifiedInSsrcGroupFecFr) { "a=fmtp:98 repair-window=10000000\r\n" "a=ssrc-group:FEC-FR 1 2\r\n" "a=ssrc:1 cname:test\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); RTCError error; pc->SetRemoteDescription(std::move(offer), &error); EXPECT_FALSE(error.ok()); @@ -841,7 +849,8 @@ TEST_F(SdpOfferAnswerTest, ExpectTwoSsrcsInSsrcGroupFid) { "a=ssrc:1 cname:test\r\n" "a=ssrc:2 cname:test\r\n" "a=ssrc:3 cname:test\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); RTCError error; pc->SetRemoteDescription(std::move(offer), &error); EXPECT_FALSE(error.ok()); @@ -876,7 +885,8 @@ TEST_F(SdpOfferAnswerTest, ExpectTwoSsrcsInSsrcGroupFecFr) { "a=ssrc:1 cname:test\r\n" "a=ssrc:2 cname:test\r\n" "a=ssrc:3 cname:test\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); RTCError error; pc->SetRemoteDescription(std::move(offer), &error); EXPECT_FALSE(error.ok()); @@ -912,7 +922,8 @@ TEST_F(SdpOfferAnswerTest, ExpectAtMostFourSsrcsInSsrcGroupSIM) { "a=ssrc:2 cname:test\r\n" "a=ssrc:3 cname:test\r\n" "a=ssrc:4 cname:test\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); RTCError error; pc->SetRemoteDescription(std::move(offer), &error); EXPECT_FALSE(error.ok()); @@ -923,7 +934,7 @@ TEST_F(SdpOfferAnswerTest, DuplicateSsrcsDisallowedInLocalDescription) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& offer_contents = offer->description()->contents(); ASSERT_EQ(offer_contents.size(), 2u); uint32_t second_ssrc = offer_contents[1].media_description()->first_ssrc(); @@ -942,7 +953,7 @@ TEST_F(SdpOfferAnswerTest, pc->AddAudioTrack("audio_track", {}); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& offer_contents = offer->description()->contents(); ASSERT_EQ(offer_contents.size(), 2u); uint32_t audio_ssrc = offer_contents[0].media_description()->first_ssrc(); @@ -983,7 +994,7 @@ TEST_F(SdpOfferAnswerTest, pc->AddAudioTrack("audio_track", {}); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& offer_contents = offer->description()->contents(); ASSERT_EQ(offer_contents.size(), 2u); uint32_t audio_ssrc = offer_contents[0].media_description()->first_ssrc(); @@ -1023,7 +1034,7 @@ TEST_F(SdpOfferAnswerTest, AllowOnlyOneSsrcGroupPerSemanticAndPrimarySsrc) { pc->AddAudioTrack("audio_track", {}); pc->AddVideoTrack("video_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); auto& offer_contents = offer->description()->contents(); ASSERT_EQ(offer_contents.size(), 2u); uint32_t audio_ssrc = offer_contents[0].media_description()->first_ssrc(); @@ -1083,7 +1094,8 @@ TEST_F(SdpOfferAnswerTest, OfferWithRtxAndNoMsidIsNotRejected) { "a=ssrc-group:FID 1 2\r\n" "a=ssrc:1 cname:test\r\n" "a=ssrc:2 cname:test\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer))); } @@ -1125,7 +1137,7 @@ TEST_F(SdpOfferAnswerTest, SdpMungingWithInvalidPayloadTypeIsRejected) { auto pc = CreatePeerConnection(); pc->AddAudioTrack("audio_track", {}); - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); ASSERT_EQ(offer->description()->contents().size(), 1u); auto* audio = offer->description()->contents()[0].media_description(); ASSERT_GT(audio->codecs().size(), 0u); @@ -1164,11 +1176,12 @@ TEST_F(SdpOfferAnswerTest, MsidSignalingInSubsequentOfferAnswer) { "a=rtcp-mux\r\n" "a=rtpmap:111 opus/48000/2\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer))); // Check the generated SDP. - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); answer->ToString(&sdp); EXPECT_NE(std::string::npos, sdp.find("a=msid:- audio_track\r\n")); @@ -1214,14 +1227,15 @@ TEST_F(SdpOfferAnswerTest, MsidSignalingUnknownRespondsWithMsidAndKeepsSsrc) { "a=mid:0\r\n" "a=rtpmap:111 opus/48000/2\r\n"; - auto offer = CreateSessionDescription(SdpType::kOffer, sdp); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp); EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer))); auto first_transceiver = pc->pc()->GetTransceivers()[0]; EXPECT_TRUE(first_transceiver ->SetDirectionWithError(RtpTransceiverDirection::kSendOnly) .ok()); // Check the generated *serialized* SDP. - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); const auto& answer_contents = answer->description()->contents(); ASSERT_EQ(answer_contents.size(), 1u); auto answer_streams = answer_contents[0].media_description()->streams(); @@ -1325,7 +1339,7 @@ TEST_P(SdpOfferAnswerWithPayloadTypeTest, EXPECT_TRUE( pc->SetRemoteDescription(CreateSessionDescription(SdpType::kOffer, sdp))); // The answer should accept the PT for VP9. - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); { const auto* mid_0 = answer->description()->GetContentDescriptionByName("0"); ASSERT_TRUE(mid_0); @@ -1340,7 +1354,7 @@ TEST_P(SdpOfferAnswerWithPayloadTypeTest, EXPECT_TRUE(pc->SetLocalDescription(std::move(answer))); // The follow-up offer should continue to use the same PT for VP9. - auto offer = pc->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer(); { const auto* mid_0 = offer->description()->GetContentDescriptionByName("0"); ASSERT_TRUE(mid_0); @@ -1414,13 +1428,13 @@ TEST_P(SdpOfferAnswerShuffleMediaTypes, CreateSessionDescription(SdpType::kAnswer, rejected_answer_sdp); EXPECT_TRUE(pc1->SetRemoteDescription(std::move(rejected_answer))); - auto offer = + std::unique_ptr<SessionDescriptionInterface> offer = pc2->CreateOfferAndSetAsLocal(); // This will generate a mid=0 too ASSERT_EQ(offer->description()->contents().size(), 1u); auto mid2 = offer->description()->contents()[0].mid(); EXPECT_EQ(mid1, mid2); // Check that the mids collided. EXPECT_TRUE(pc1->SetRemoteDescription(std::move(offer))); - auto answer = pc1->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc1->CreateAnswer(); EXPECT_FALSE(pc1->SetLocalDescription(std::move(answer))); } @@ -1455,7 +1469,7 @@ TEST_P(SdpOfferAnswerShuffleMediaTypes, CreateSessionDescription(SdpType::kAnswer, rejected_answer_sdp); EXPECT_TRUE(pc1->SetRemoteDescription(std::move(rejected_answer))); - auto offer = + std::unique_ptr<SessionDescriptionInterface> offer = pc2->CreateOfferAndSetAsLocal(); // This will generate a mid=0 too ASSERT_EQ(offer->description()->contents().size(), 1u); auto mid2 = offer->description()->contents()[0].mid(); @@ -1500,7 +1514,7 @@ TEST_F(SdpOfferAnswerTest, OfferWithNoCompatibleCodecsIsRejectedInAnswer) { pc->SetRemoteDescription(std::move(desc), &error); EXPECT_TRUE(error.ok()); - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(answer_contents.size(), 2u); EXPECT_EQ(answer_contents[0].rejected, true); @@ -1530,7 +1544,7 @@ TEST_F(SdpOfferAnswerTest, OfferWithRejectedMlineWithoutFingerprintIsAccepted) { pc->SetRemoteDescription(std::move(desc), &error); EXPECT_TRUE(error.ok()); - auto answer = pc->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = pc->CreateAnswer(); EXPECT_TRUE(pc->SetLocalDescription(std::move(answer))); } @@ -1567,7 +1581,8 @@ TEST_F(SdpOfferAnswerTest, MidBackfillAnswer) { pc->pc()->remote_description()->description()->contents(); ASSERT_EQ(offer_contents.size(), 1u); EXPECT_EQ(offer_contents[0].mid(), "0"); - auto answer = pc->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + pc->CreateAnswerAndSetAsLocal(); auto answer_contents = answer->description()->contents(); ASSERT_EQ(answer_contents.size(), 1u); EXPECT_EQ(answer_contents[0].mid(), offer_contents[0].mid()); @@ -1635,15 +1650,17 @@ TEST_F(SdpOfferAnswerTest, ReducedSizeNotNegotiated) { auto audio_transceiver = caller->AddTransceiver(MediaType::AUDIO); auto video_transceiver = caller->AddTransceiver(MediaType::VIDEO); - auto offer = caller->CreateOfferAndSetAsLocal(); - ASSERT_NE(offer, nullptr); + std::unique_ptr<SessionDescriptionInterface> offer = + caller->CreateOfferAndSetAsLocal(); + ASSERT_THAT(offer, NotNull()); std::string sdp; offer->ToString(&sdp); // Remove rtcp-rsize attribute. auto modified_offer = CreateSessionDescription( SdpType::kOffer, absl::StrReplaceAll(sdp, {{"a=rtcp-rsize\r\n", ""}})); EXPECT_TRUE(callee->SetRemoteDescription(std::move(modified_offer))); - auto answer = callee->CreateAnswerAndSetAsLocal(); + std::unique_ptr<SessionDescriptionInterface> answer = + callee->CreateAnswerAndSetAsLocal(); EXPECT_TRUE(caller->SetRemoteDescription(std::move(answer))); auto receivers = callee->pc()->GetReceivers(); diff --git a/third_party/libwebrtc/pc/test/integration_test_helpers.h b/third_party/libwebrtc/pc/test/integration_test_helpers.h @@ -253,7 +253,7 @@ class PeerConnectionIntegrationWrapper : public PeerConnectionObserver, // will set the whole offer/answer exchange in motion. Just need to wait for // the signaling state to reach "stable". void CreateAndSetAndSignalOffer() { - auto offer = CreateOfferAndWait(); + std::unique_ptr<SessionDescriptionInterface> offer = CreateOfferAndWait(); ASSERT_NE(nullptr, offer); EXPECT_TRUE(SetLocalDescriptionAndSendSdpMessage(std::move(offer))); } @@ -859,7 +859,7 @@ class PeerConnectionIntegrationWrapper : public PeerConnectionObserver, if (remote_offer_handler_) { remote_offer_handler_(); } - auto answer = CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = CreateAnswer(); ASSERT_NE(nullptr, answer); EXPECT_TRUE(SetLocalDescriptionAndSendSdpMessage(std::move(answer))); } diff --git a/third_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc b/third_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc @@ -643,7 +643,7 @@ void PeerConnectionE2EQualityTest::ExchangeOfferAnswer( SignalingInterceptor* signaling_interceptor) { std::string log_output; - auto offer = alice_->CreateOffer(); + std::unique_ptr<SessionDescriptionInterface> offer = alice_->CreateOffer(); RTC_CHECK(offer); offer->ToString(&log_output); RTC_LOG(LS_INFO) << "Original offer: " << log_output; @@ -660,7 +660,7 @@ void PeerConnectionE2EQualityTest::ExchangeOfferAnswer( bool set_remote_offer = bob_->SetRemoteDescription(std::move(patch_result.remote_sdp)); RTC_CHECK(set_remote_offer); - auto answer = bob_->CreateAnswer(); + std::unique_ptr<SessionDescriptionInterface> answer = bob_->CreateAnswer(); RTC_CHECK(answer); answer->ToString(&log_output); RTC_LOG(LS_INFO) << "Original answer: " << log_output; diff --git a/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc b/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc @@ -460,7 +460,7 @@ void PeerScenarioClient::SetSdpAnswer( CreateSessionDescription(SdpType::kAnswer, remote_answer), make_ref_counted<LambdaSetRemoteDescriptionObserver>( [remote_answer, done_handler](RTCError) { - auto answer = + std::unique_ptr<SessionDescriptionInterface> answer = CreateSessionDescription(SdpType::kAnswer, remote_answer); done_handler(*answer); })); diff --git a/third_party/libwebrtc/test/peer_scenario/signaling_route.cc b/third_party/libwebrtc/test/peer_scenario/signaling_route.cc @@ -69,7 +69,8 @@ void StartSdpNegotiation( std::function<void(const SessionDescriptionInterface&)> exchange_finished) { caller->CreateAndSetSdp(munge_offer, [=](std::string sdp_offer) { if (modify_offer) { - auto offer = CreateSessionDescription(SdpType::kOffer, sdp_offer); + std::unique_ptr<SessionDescriptionInterface> offer = + CreateSessionDescription(SdpType::kOffer, sdp_offer); modify_offer(offer.get()); RTC_CHECK(offer->ToString(&sdp_offer)); }