diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h index 80c3091d23..044a48039c 100644 --- a/api/peerconnectioninterface.h +++ b/api/peerconnectioninterface.h @@ -597,6 +597,14 @@ class PeerConnectionInterface : public rtc::RefCountInterface { // settings set in PeerConnectionFactory (which is deprecated). absl::optional crypto_options; + // Configure if we should include the SDP attribute extmap-allow-mixed in + // our offer. Although we currently do support this, it's not included in + // our offer by default due to a previous bug that caused the SDP parser to + // abort parsing if this attribute was present. This is fixed in Chrome 71. + // TODO(webrtc:9985): Change default to true once sufficient time has + // passed. + bool offer_extmap_allow_mixed = false; + // // Don't forget to update operator== if adding something. // diff --git a/pc/mediasession.cc b/pc/mediasession.cc index b9afca07eb..7239af86c3 100644 --- a/pc/mediasession.cc +++ b/pc/mediasession.cc @@ -1378,6 +1378,8 @@ SessionDescription* MediaSessionDescriptionFactory::CreateOffer( offer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); } + offer->set_extmap_allow_mixed(session_options.offer_extmap_allow_mixed); + return offer.release(); } diff --git a/pc/mediasession.h b/pc/mediasession.h index b1df1dbd26..5904605f10 100644 --- a/pc/mediasession.h +++ b/pc/mediasession.h @@ -94,6 +94,7 @@ struct MediaSessionOptions { bool rtcp_mux_enabled = true; bool bundle_enabled = false; bool is_unified_plan = false; + bool offer_extmap_allow_mixed = false; std::string rtcp_cname = kDefaultRtcpCname; webrtc::CryptoOptions crypto_options; // List of media description options in the same order that the media diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc index 54ef67740e..3fa5ca5ab8 100644 --- a/pc/peerconnection.cc +++ b/pc/peerconnection.cc @@ -737,6 +737,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==( bool use_media_transport; bool use_media_transport_for_data_channels; absl::optional crypto_options; + bool offer_extmap_allow_mixed; }; static_assert(sizeof(stuff_being_tested_for_equality) == sizeof(*this), "Did you add something to RTCConfiguration and forget to " @@ -788,7 +789,8 @@ bool PeerConnectionInterface::RTCConfiguration::operator==( use_media_transport == o.use_media_transport && use_media_transport_for_data_channels == o.use_media_transport_for_data_channels && - crypto_options == o.crypto_options; + crypto_options == o.crypto_options && + offer_extmap_allow_mixed == o.offer_extmap_allow_mixed; } bool PeerConnectionInterface::RTCConfiguration::operator!=( @@ -3808,6 +3810,8 @@ void PeerConnection::GetOptionsForOffer( RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::GetPooledIceCredentials, port_allocator_.get())); + session_options->offer_extmap_allow_mixed = + configuration_.offer_extmap_allow_mixed; } void PeerConnection::GetOptionsForPlanBOffer( diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc index 12d192eba3..362c8517ad 100644 --- a/pc/peerconnectioninterface_unittest.cc +++ b/pc/peerconnectioninterface_unittest.cc @@ -3944,6 +3944,21 @@ TEST_P(PeerConnectionInterfaceTest, EXPECT_FALSE(DoSetLocalDescription(std::move(offer))); } +TEST_P(PeerConnectionInterfaceTest, ExtmapAllowMixedIsConfigurable) { + RTCConfiguration config; + // Default behavior is false. + CreatePeerConnection(config); + std::unique_ptr offer; + ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); + EXPECT_FALSE(offer->description()->extmap_allow_mixed()); + // Possible to set to true. + config.offer_extmap_allow_mixed = true; + CreatePeerConnection(config); + offer.release(); + ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); + EXPECT_TRUE(offer->description()->extmap_allow_mixed()); +} + INSTANTIATE_TEST_CASE_P(PeerConnectionInterfaceTest, PeerConnectionInterfaceTest, Values(SdpSemantics::kPlanB, diff --git a/pc/sessiondescription.h b/pc/sessiondescription.h index b887b187f5..38291484cd 100644 --- a/pc/sessiondescription.h +++ b/pc/sessiondescription.h @@ -500,10 +500,11 @@ class SessionDescription { // Default to what Plan B would do. // TODO(bugs.webrtc.org/8530): Change default to kMsidSignalingMediaSection. int msid_signaling_ = kMsidSignalingSsrcAttribute; - // TODO(kron): Activate mixed one- and two-byte header extension in offer at - // session level. It's currently not included in offer by default because - // clients prior to https://bugs.webrtc.org/9712 cannot parse this correctly. - // If it's included in offer to us we will respond that we support it. + // TODO(webrtc:9985): Activate mixed one- and two-byte header extension in + // offer at session level. It's currently not included in offer by default + // because clients prior to https://bugs.webrtc.org/9712 cannot parse this + // correctly. If it's included in offer to us we will respond that we support + // it. bool extmap_allow_mixed_ = false; };