From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- third_party/libwebrtc/pc/media_session.cc | 52 ++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 14 deletions(-) (limited to 'third_party/libwebrtc/pc/media_session.cc') diff --git a/third_party/libwebrtc/pc/media_session.cc b/third_party/libwebrtc/pc/media_session.cc index 573e35225e..a118beebb0 100644 --- a/third_party/libwebrtc/pc/media_session.cc +++ b/third_party/libwebrtc/pc/media_session.cc @@ -728,6 +728,16 @@ void NegotiatePacketization(const Codec& local_codec, : absl::nullopt; } +#ifdef RTC_ENABLE_H265 +void NegotiateTxMode(const Codec& local_codec, + const Codec& remote_codec, + Codec* negotiated_codec) { + negotiated_codec->tx_mode = (local_codec.tx_mode == remote_codec.tx_mode) + ? local_codec.tx_mode + : absl::nullopt; +} +#endif + // Finds a codec in `codecs2` that matches `codec_to_match`, which is // a member of `codecs1`. If `codec_to_match` is an RED or RTX codec, both // the codecs themselves and their associated codecs must match. @@ -849,6 +859,13 @@ void NegotiateCodecs(const std::vector& local_codecs, webrtc::H264GenerateProfileLevelIdForAnswer(ours.params, theirs->params, &negotiated.params); } +#ifdef RTC_ENABLE_H265 + if (absl::EqualsIgnoreCase(ours.name, kH265CodecName)) { + webrtc::H265GenerateProfileTierLevelForAnswer( + ours.params, theirs->params, &negotiated.params); + NegotiateTxMode(ours, *theirs, &negotiated); + } +#endif negotiated.id = theirs->id; negotiated.name = theirs->name; negotiated_codecs->push_back(std::move(negotiated)); @@ -1864,11 +1881,13 @@ MediaSessionDescriptionFactory::CreateOfferOrError( // Be conservative and signal using both a=msid and a=ssrc lines. Unified // Plan answerers will look at a=msid and Plan B answerers will look at the // a=ssrc MSID line. - offer->set_msid_signaling(cricket::kMsidSignalingMediaSection | + offer->set_msid_signaling(cricket::kMsidSignalingSemantic | + cricket::kMsidSignalingMediaSection | cricket::kMsidSignalingSsrcAttribute); } else { // Plan B always signals MSID using a=ssrc lines. - offer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); + offer->set_msid_signaling(cricket::kMsidSignalingSemantic | + cricket::kMsidSignalingSsrcAttribute); } offer->set_extmap_allow_mixed(session_options.offer_extmap_allow_mixed); @@ -2041,7 +2060,16 @@ MediaSessionDescriptionFactory::CreateAnswerOrError( if (is_unified_plan_) { // Unified Plan needs to look at what the offer included to find the most // compatible answer. - if (offer->msid_signaling() == 0) { + int msid_signaling = offer->msid_signaling(); + if (msid_signaling == + (cricket::kMsidSignalingSemantic | cricket::kMsidSignalingMediaSection | + cricket::kMsidSignalingSsrcAttribute)) { + // If both a=msid and a=ssrc MSID signaling methods were used, we're + // probably talking to a Unified Plan endpoint so respond with just + // a=msid. + answer->set_msid_signaling(cricket::kMsidSignalingSemantic | + cricket::kMsidSignalingMediaSection); + } else if (msid_signaling == cricket::kMsidSignalingSemantic) { // We end up here in one of three cases: // 1. An empty offer. We'll reply with an empty answer so it doesn't // matter what we pick here. @@ -2050,23 +2078,19 @@ MediaSessionDescriptionFactory::CreateAnswerOrError( // 3. Media that's either sendonly or inactive from the remote endpoint. // We don't have any information to say whether the endpoint is Plan B // or Unified Plan, so be conservative and send both. - answer->set_msid_signaling(cricket::kMsidSignalingMediaSection | + answer->set_msid_signaling(cricket::kMsidSignalingSemantic | + cricket::kMsidSignalingMediaSection | cricket::kMsidSignalingSsrcAttribute); - } else if (offer->msid_signaling() == - (cricket::kMsidSignalingMediaSection | - cricket::kMsidSignalingSsrcAttribute)) { - // If both a=msid and a=ssrc MSID signaling methods were used, we're - // probably talking to a Unified Plan endpoint so respond with just - // a=msid. - answer->set_msid_signaling(cricket::kMsidSignalingMediaSection); } else { // Otherwise, it's clear which method the offerer is using so repeat that - // back to them. - answer->set_msid_signaling(offer->msid_signaling()); + // back to them. This includes the case where the msid-semantic line is + // not included. + answer->set_msid_signaling(msid_signaling); } } else { // Plan B always signals MSID using a=ssrc lines. - answer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); + answer->set_msid_signaling(cricket::kMsidSignalingSemantic | + cricket::kMsidSignalingSsrcAttribute); } return answer; -- cgit v1.2.3