Lines Matching +full:video +full:- +full:codecs

4  *  Use of this source code is governed by a BSD-style license
57 names->push_back(rtc::SrtpCryptoSuiteToName(crypto)); in GetSupportedSdesCryptoSuiteNames()
129 if (!content || !content->media_description()) { in IsMediaContentOfType()
132 return content->media_description()->type() == media_type; in IsMediaContentOfType()
154 crypto_out->tag = tag; in CreateCryptoParams()
155 crypto_out->cipher_suite = cipher; in CreateCryptoParams()
156 crypto_out->key_params = kInline; in CreateCryptoParams()
157 crypto_out->key_params += key; in CreateCryptoParams()
163 int size = static_cast<int>(cryptos_out->size()); in AddCryptoParams()
165 cryptos_out->resize(size + 1); in AddCryptoParams()
166 return CreateCryptoParams(size, cipher_suite, &cryptos_out->at(size)); in AddCryptoParams()
172 media->AddCrypto(crypto); in AddMediaCryptos()
189 if (!content || !content->media_description()) { in GetCryptos()
192 return &content->media_description()->cryptos(); in GetCryptos()
213 crypto_suites->push_back(rtc::kSrtpAes128CmSha1_32); in GetSupportedAudioSdesCryptoSuites()
215 crypto_suites->push_back(rtc::kSrtpAes128CmSha1_80); in GetSupportedAudioSdesCryptoSuites()
217 crypto_suites->push_back(rtc::kSrtpAeadAes256Gcm); in GetSupportedAudioSdesCryptoSuites()
218 crypto_suites->push_back(rtc::kSrtpAeadAes128Gcm); in GetSupportedAudioSdesCryptoSuites()
232 crypto_suites->push_back(rtc::kSrtpAes128CmSha1_80); in GetSupportedVideoSdesCryptoSuites()
234 crypto_suites->push_back(rtc::kSrtpAeadAes256Gcm); in GetSupportedVideoSdesCryptoSuites()
235 crypto_suites->push_back(rtc::kSrtpAeadAes128Gcm); in GetSupportedVideoSdesCryptoSuites()
249 crypto_suites->push_back(rtc::kSrtpAes128CmSha1_80); in GetSupportedDataSdesCryptoSuites()
251 crypto_suites->push_back(rtc::kSrtpAeadAes256Gcm); in GetSupportedDataSdesCryptoSuites()
252 crypto_suites->push_back(rtc::kSrtpAeadAes128Gcm); in GetSupportedDataSdesCryptoSuites()
263 // Support any GCM cipher (if enabled through options). For video support only
264 // 80-bit SHA1 HMAC. For audio 32-bit HMAC is tolerated (if enabled) unless
271 bool audio = offer->type() == MEDIA_TYPE_AUDIO; in SelectCrypto()
272 const CryptoParamsVec& cryptos = offer->cryptos(); in SelectCrypto()
291 for (const StreamParams& params : content->media_description()->streams()) { in GetCurrentStreamParams()
316 if (include_flexfec_stream && !field_trials.IsEnabled("WebRTC-FlexFEC-03")) { in CreateStreamParamsForNewSenderWithSsrcs()
319 << "WebRTC-FlexFEC trial is not enabled, not sending FlexFEC"; in CreateStreamParamsForNewSenderWithSsrcs()
370 if (absl::c_all_of(description->streams(), [](const StreamParams& params) { in AddSimulcastToMediaDescription()
376 RTC_DCHECK_EQ(1, description->streams().size()) in AddSimulcastToMediaDescription()
379 RTC_DCHECK(description->type() == MediaType::MEDIA_TYPE_AUDIO || in AddSimulcastToMediaDescription()
380 description->type() == MediaType::MEDIA_TYPE_VIDEO); in AddSimulcastToMediaDescription()
383 if (description->streams()[0].rids().size() <= 1) { in AddSimulcastToMediaDescription()
391 description->set_simulcast_description(simulcast); in AddSimulcastToMediaDescription()
396 // `current_params` - All currently known StreamParams of any media type.
405 if (IsSctpProtocol(content_description->protocol())) { in AddStreamParams()
410 ContainsRtxCodec(content_description->codecs()); in AddStreamParams()
413 ContainsFlexfecCodec(content_description->codecs()); in AddStreamParams()
427 // Signal RIDs and spec-compliant simulcast (if requested). in AddStreamParams()
430 content_description->AddStream(stream_param); in AddStreamParams()
434 current_streams->push_back(stream_param); in AddStreamParams()
439 param->set_stream_ids(sender.stream_ids); in AddStreamParams()
440 content_description->AddStream(*param); in AddStreamParams()
460 sdesc->GetTransportInfoByName(selected_content_name); in UpdateTransportInfoForBundle()
467 selected_transport_info->description.ice_ufrag; in UpdateTransportInfoForBundle()
469 selected_transport_info->description.ice_pwd; in UpdateTransportInfoForBundle()
471 selected_transport_info->description.connection_role; in UpdateTransportInfoForBundle()
472 for (TransportInfo& transport_info : sdesc->transport_infos()) { in UpdateTransportInfoForBundle()
491 const ContentInfo* content = sdesc->GetContentByName(content_name); in GetCryptosByName()
492 if (!content || !content->media_description()) { in GetCryptosByName()
495 *cryptos = content->media_description()->cryptos(); in GetCryptosByName()
507 target_cryptos->erase( in PruneCryptos()
508 std::remove_if(target_cryptos->begin(), target_cryptos->end(), in PruneCryptos()
518 target_cryptos->end()); in PruneCryptos()
524 ContentInfo* content = sdesc->GetContentByName(content_name); in IsRtpContent()
525 if (content && content->media_description()) { in IsRtpContent()
526 is_rtp = IsRtpProtocol(content->media_description()->protocol()); in IsRtpContent()
553 if (!sdesc->GetTransportInfoByName(content_name)->description.secure()) { in UpdateCryptoParamsForBundle()
584 ContentInfo* content = sdesc->GetContentByName(content_name); in UpdateCryptoParamsForBundle()
586 MediaContentDescription* media_desc = content->media_description(); in UpdateCryptoParamsForBundle()
590 media_desc->set_cryptos(common_cryptos); in UpdateCryptoParamsForBundle()
614 static bool ContainsRtxCodec(const std::vector<C>& codecs) { in ContainsRtxCodec() argument
615 for (const auto& codec : codecs) { in ContainsRtxCodec()
634 static bool ContainsFlexfecCodec(const std::vector<C>& codecs) { in ContainsFlexfecCodec() argument
635 for (const auto& codec : codecs) { in ContainsFlexfecCodec()
659 // according to the given options.rtcp_mux, session_options.is_muc, codecs,
674 offer->set_rtcp_mux(session_options.rtcp_mux_enabled); in CreateContentOffer()
675 if (offer->type() == cricket::MEDIA_TYPE_VIDEO) { in CreateContentOffer()
676 offer->set_rtcp_reduced_size(true); in CreateContentOffer()
692 offer->set_rtp_header_extensions(extensions); in CreateContentOffer()
700 if (offer->cryptos().empty()) { in CreateContentOffer()
707 if (secure_policy == SEC_REQUIRED && offer->cryptos().empty()) { in CreateContentOffer()
716 const std::vector<C>& codecs, in CreateMediaContentOffer() argument
725 offer->AddCodecs(codecs); in CreateMediaContentOffer()
747 codec1->Matches(*codec2, field_trials); in ReferencedCodecsMatch()
759 negotiated_codec->packetization = in NegotiatePacketization()
772 // local codecs, in case the remote offer contains duplicate codecs. in NegotiateCodecs()
783 negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second); in NegotiateCodecs()
785 // We support parsing the declarative rtx-time parameter. in NegotiateCodecs()
788 negotiated.SetParam(kCodecParamRtxTime, rtx_time_it->second); in NegotiateCodecs()
793 negotiated.SetParam(kCodecParamNotInNameValueFormat, red_it->second); in NegotiateCodecs()
802 negotiated_codecs->push_back(std::move(negotiated)); in NegotiateCodecs()
814 payload_type_preferences[codec.id] = preference--; in NegotiateCodecs()
825 // the codecs themselves and their associated codecs must match.
833 // RED/RTX codecs' associated codecs correctly. If not, that's a programming in FindMatchingCodec()
863 // Mixed reference codecs (i.e. 111/112) are not supported. in FindMatchingCodec()
867 rtc::split(red_parameters_1->second, '/'); in FindMatchingCodec()
869 rtc::split(red_parameters_2->second, '/'); in FindMatchingCodec()
948 // Normal for video/RED. in GetAssociatedCodecForRed()
978 // Adds all codecs from `reference_codecs` to `offered_codecs` that don't
986 // Add all new codecs that are not RTX/RED codecs. in MergeCodecs()
987 // The two-pass splitting of the loops means preferring payload types in MergeCodecs()
988 // of actual codecs with respect to collisions. in MergeCodecs()
994 used_pltypes->FindAndSetIdUsed(&codec); in MergeCodecs()
995 offered_codecs->push_back(codec); in MergeCodecs()
999 // Add all new RTX or RED codecs. in MergeCodecs()
1017 << "Couldn't find matching " << associated_codec->name << " codec."; in MergeCodecs()
1023 used_pltypes->FindAndSetIdUsed(&rtx_codec); in MergeCodecs()
1024 offered_codecs->push_back(rtx_codec); in MergeCodecs()
1037 << associated_codec->name << " codec."; in MergeCodecs()
1045 used_pltypes->FindAndSetIdUsed(&red_codec); in MergeCodecs()
1046 offered_codecs->push_back(red_codec); in MergeCodecs()
1051 // `codecs` is a full list of codecs with correct payload type mappings, which
1055 template <typename Codecs>
1056 static Codecs MatchCodecPreference( in MatchCodecPreference()
1058 const Codecs& codecs, in MatchCodecPreference() argument
1059 const Codecs& supported_codecs, in MatchCodecPreference()
1061 Codecs filtered_codecs; in MatchCodecPreference()
1075 [&codec_preference](const typename Codecs::value_type& codec) { in MatchCodecPreference()
1087 typename Codecs::value_type found_codec_with_correct_pt; in MatchCodecPreference()
1088 if (FindMatchingCodec(supported_codecs, codecs, *found_codec, in MatchCodecPreference()
1094 for (const auto& codec : codecs) { in MatchCodecPreference()
1098 if (apt != codec.params.end() && apt->second == id) { in MatchCodecPreference()
1110 rtc::split(fmtp->second, '/'); in MatchCodecPreference()
1155 // `offered_extensions` is for either audio or video while `regular_extensions`
1156 // and `encrypted_extensions` are used for both audio and video. There could be
1157 // overlap between audio extensions and video extensions.
1173 offered_extensions->push_back(*existing); in MergeRtpHdrExts()
1175 used_ids->FindAndSetIdUsed(&reference_extension); in MergeRtpHdrExts()
1176 encrypted_extensions->push_back(reference_extension); in MergeRtpHdrExts()
1177 offered_extensions->push_back(reference_extension); in MergeRtpHdrExts()
1185 offered_extensions->push_back(*existing); in MergeRtpHdrExts()
1187 used_ids->FindAndSetIdUsed(&reference_extension); in MergeRtpHdrExts()
1188 regular_extensions->push_back(reference_extension); in MergeRtpHdrExts()
1189 offered_extensions->push_back(reference_extension); in MergeRtpHdrExts()
1226 // Re-use the shared encrypted extension in AddEncryptedVersionsOfHdrExts()
1232 // non-encrypted one. in AddEncryptedVersionsOfHdrExts()
1235 used_ids->FindAndSetIdUsed(&new_encrypted_extension); in AddEncryptedVersionsOfHdrExts()
1236 encrypted_extensions->push_back(new_encrypted_extension); in AddEncryptedVersionsOfHdrExts()
1241 offered_extensions->insert(offered_extensions->end(), in AddEncryptedVersionsOfHdrExts()
1264 // Instruct to only return non-encrypted extensions in FindHeaderExtensionByUriDiscardUnsupported()
1306 // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 in NegotiateRtpHeaderExtensions()
1308 // http://www.webrtc.org/experiments/rtp-hdrext/transport-wide-cc-02 in NegotiateRtpHeaderExtensions()
1312 negotiated_extensions->push_back(*theirs); in NegotiateRtpHeaderExtensions()
1319 negotiated_extensions->push_back(*transport_sequence_number_v2_offer); in NegotiateRtpHeaderExtensions()
1330 negotiated_extensions->push_back(*theirs); in NegotiateRtpHeaderExtensions()
1339 negotiated_extensions->push_back(*theirs); in NegotiateRtpHeaderExtensions()
1351 negotiated_extensions->push_back(*theirs); in NegotiateRtpHeaderExtensions()
1357 audio_codecs->erase(std::remove_if(audio_codecs->begin(), audio_codecs->end(), in StripCNCodecs()
1361 audio_codecs->end()); in StripCNCodecs()
1375 NegotiateCodecs(local_codecs, offer->codecs(), &negotiated_codecs, in SetCodecsInAnswer()
1378 answer->AddCodecs(negotiated_codecs); in SetCodecsInAnswer()
1379 answer->set_protocol(offer->protocol()); in SetCodecsInAnswer()
1390 // codecs, crypto, and current_streams. If we don't currently have crypto (in
1392 // (according to crypto_suites). The codecs, rtcp_mux, and crypto are all
1407 answer->set_extmap_allow_mixed_enum(offer->extmap_allow_mixed_enum()); in CreateMediaContentAnswer()
1414 offer->rtp_header_extensions(), in CreateMediaContentAnswer()
1416 answer->set_rtp_header_extensions(negotiated_rtp_extensions); in CreateMediaContentAnswer()
1418 answer->set_rtcp_mux(session_options.rtcp_mux_enabled && offer->rtcp_mux()); in CreateMediaContentAnswer()
1419 if (answer->type() == cricket::MEDIA_TYPE_VIDEO) { in CreateMediaContentAnswer()
1420 answer->set_rtcp_reduced_size(offer->rtcp_reduced_size()); in CreateMediaContentAnswer()
1423 answer->set_remote_estimate(offer->remote_estimate()); in CreateMediaContentAnswer()
1432 answer->AddCrypto(crypto); in CreateMediaContentAnswer()
1436 if (answer->cryptos().empty() && sdes_policy == SEC_REQUIRED) { in CreateMediaContentAnswer()
1442 answer->set_direction(NegotiateRtpTransceiverDirection( in CreateMediaContentAnswer()
1443 offer->direction(), media_description_options.direction)); in CreateMediaContentAnswer()
1467 // Allow for non-DTLS RTP protocol even when using DTLS because that's what in IsMediaProtocolSupported()
1479 if (!desc->cryptos().empty()) in SetMediaProtocol()
1480 desc->set_protocol(kMediaProtocolSavpf); in SetMediaProtocol()
1482 desc->set_protocol(kMediaProtocolDtlsSavpf); in SetMediaProtocol()
1484 desc->set_protocol(kMediaProtocolAvpf); in SetMediaProtocol()
1495 current_description->GetTransportInfoByName(content_name); in GetTransportDescription()
1497 desc = &info->description; in GetTransportDescription()
1510 size_t msection_index = content - &current_description->contents()[0]; in IsDtlsActive()
1512 if (current_description->transport_infos().size() <= msection_index) { in IsDtlsActive()
1516 return current_description->transport_infos()[msection_index] in IsDtlsActive()
1577 audio_send_codecs_ = media_engine->voice().send_codecs(); in MediaSessionDescriptionFactory()
1578 audio_recv_codecs_ = media_engine->voice().recv_codecs(); in MediaSessionDescriptionFactory()
1579 video_send_codecs_ = media_engine->video().send_codecs(rtx_enabled); in MediaSessionDescriptionFactory()
1580 video_recv_codecs_ = media_engine->video().recv_codecs(rtx_enabled); in MediaSessionDescriptionFactory()
1631 extensions->erase( in RemoveUnifiedPlanExtensions()
1632 std::remove_if(extensions->begin(), extensions->end(), in RemoveUnifiedPlanExtensions()
1639 extensions->end()); in RemoveUnifiedPlanExtensions()
1656 RTC_DCHECK_LE(current_description->contents().size(), in CreateOffer()
1690 msection_index < current_description->contents().size()) { in CreateOffer()
1691 current_content = &current_description->contents()[msection_index]; in CreateOffer()
1693 RTC_DCHECK(current_content->name != media_description_options.mid || in CreateOffer()
1710 extensions_with_ids.video, in CreateOffer()
1741 for (const ContentInfo& content : offer->contents()) { in CreateOffer()
1747 // type to represent different codecs, or same IDs for different header in CreateOffer()
1753 offer->AddGroup(offer_bundle); in CreateOffer()
1773 offer->set_msid_signaling(cricket::kMsidSignalingMediaSection | in CreateOffer()
1777 offer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); in CreateOffer()
1780 offer->set_extmap_allow_mixed(session_options.offer_extmap_allow_mixed); in CreateOffer()
1795 RTC_DCHECK_EQ(offer->contents().size(), in CreateAnswer()
1810 // Get list of all possible codecs that respects existing payload type in CreateAnswer()
1826 offer->GetGroupsByName(GROUP_TYPE_BUNDLE); in CreateAnswer()
1839 answer->set_extmap_allow_mixed(offer->extmap_allow_mixed()); in CreateAnswer()
1846 const ContentInfo* offer_content = &offer->contents()[msection_index]; in CreateAnswer()
1851 RTC_DCHECK(media_description_options.mid == offer_content->name); in CreateAnswer()
1855 if (offer_bundles[i]->HasContentName(media_description_options.mid)) { in CreateAnswer()
1866 msection_index < current_description->contents().size()) { in CreateAnswer()
1867 current_content = &current_description->contents()[msection_index]; in CreateAnswer()
1913 ContentInfo& added = answer->contents().back(); in CreateAnswer()
1920 new TransportInfo(*answer->GetTransportInfoByName(added.name))); in CreateAnswer()
1932 answer->AddGroup(answer_bundle); in CreateAnswer()
1957 if (offer->msid_signaling() == 0) { in CreateAnswer()
1966 answer->set_msid_signaling(cricket::kMsidSignalingMediaSection | in CreateAnswer()
1968 } else if (offer->msid_signaling() == in CreateAnswer()
1974 answer->set_msid_signaling(cricket::kMsidSignalingMediaSection); in CreateAnswer()
1978 answer->set_msid_signaling(offer->msid_signaling()); in CreateAnswer()
1982 answer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); in CreateAnswer()
1991 // If stream is inactive - generate list as if sendrecv. in GetAudioCodecsForOffer()
2026 // If stream is inactive - generate list as if sendrecv. in GetVideoCodecsForOffer()
2067 content->media_description()->as_audio(); in MergeCodecsFromDescription()
2068 MergeCodecs<AudioCodec>(audio->codecs(), audio_codecs, used_pltypes, in MergeCodecsFromDescription()
2071 const VideoContentDescription* video = in MergeCodecsFromDescription() local
2072 content->media_description()->as_video(); in MergeCodecsFromDescription()
2073 MergeCodecs<VideoCodec>(video->codecs(), video_codecs, used_pltypes, in MergeCodecsFromDescription()
2079 // Getting codecs for an offer involves these steps:
2081 // 1. Construct payload type -> codec mappings for current description.
2082 // 2. Add any reference codecs that weren't already present
2083 // 3. For each individual media description (m= section), filter codecs based
2090 &transport_desc_factory_->trials(); in GetCodecsForOffer()
2091 // First - get all codecs from the current description if the media type in GetCodecsForOffer()
2098 // Add our codecs that are not in the current description. in GetCodecsForOffer()
2105 // Getting codecs for an answer involves these steps:
2107 // 1. Construct payload type -> codec mappings for current description.
2108 // 2. Add any codecs from the offer that weren't already present.
2109 // 3. Add any remaining codecs that weren't already present.
2110 // 4. For each individual media description (m= section), filter codecs based
2118 &transport_desc_factory_->trials(); in GetCodecsForAnswer()
2119 // First - get all codecs from the current description if the media type in GetCodecsForAnswer()
2126 // Second - filter out codecs that we don't support at all and should ignore. in GetCodecsForAnswer()
2132 content.media_description()->as_audio(); in GetCodecsForAnswer()
2133 for (const AudioCodec& offered_audio_codec : audio->codecs()) { in GetCodecsForAnswer()
2135 audio->codecs(), filtered_offered_audio_codecs, in GetCodecsForAnswer()
2137 FindMatchingCodec<AudioCodec>(audio->codecs(), all_audio_codecs_, in GetCodecsForAnswer()
2144 const VideoContentDescription* video = in GetCodecsForAnswer() local
2145 content.media_description()->as_video(); in GetCodecsForAnswer()
2146 for (const VideoCodec& offered_video_codec : video->codecs()) { in GetCodecsForAnswer()
2148 video->codecs(), filtered_offered_video_codecs, in GetCodecsForAnswer()
2150 FindMatchingCodec<VideoCodec>(video->codecs(), all_video_codecs_, in GetCodecsForAnswer()
2159 // Add codecs that are not in the current description but were in in GetCodecsForAnswer()
2177 // receiver supports an RTP stream where one- and two-byte RTP header in GetOfferedRtpHeaderExtensionsWithIds()
2179 // WebRTC to signal that two-byte RTP header extensions are supported. in GetOfferedRtpHeaderExtensionsWithIds()
2187 // First - get all extensions from the current description if the media type in GetOfferedRtpHeaderExtensionsWithIds()
2194 content->media_description()->as_audio(); in GetOfferedRtpHeaderExtensionsWithIds()
2195 MergeRtpHdrExts(audio->rtp_header_extensions(), &offered_extensions.audio, in GetOfferedRtpHeaderExtensionsWithIds()
2199 const VideoContentDescription* video = in GetOfferedRtpHeaderExtensionsWithIds() local
2200 content->media_description()->as_video(); in GetOfferedRtpHeaderExtensionsWithIds()
2201 MergeRtpHdrExts(video->rtp_header_extensions(), &offered_extensions.video, in GetOfferedRtpHeaderExtensionsWithIds()
2220 MergeRtpHdrExts(filtered_extensions, &offered_extensions.video, in GetOfferedRtpHeaderExtensionsWithIds()
2230 AddEncryptedVersionsOfHdrExts(&offered_extensions.video, in GetOfferedRtpHeaderExtensionsWithIds()
2247 transport_desc_factory_->CreateOffer(transport_options, current_tdesc, in AddTransportOffer()
2253 offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc)); in AddTransportOffer()
2271 return transport_desc_factory_->CreateAnswer(offer_tdesc, transport_options, in CreateTransportAnswer()
2280 answer_desc->AddTransportInfo(TransportInfo(content_name, transport_desc)); in AddTransportAnswer()
2284 // `audio_codecs` = set of all possible codecs that can be used, with correct
2287 // `supported_audio_codecs` = set of codecs that are supported for the direction
2290 // acd->codecs() = set of previously negotiated codecs for this m= section
2293 // from acd->codecs() and then supported_codecs, to ensure that re-offers don't
2294 // change existing codec priority, and that new codecs are added with the right
2307 &transport_desc_factory_->trials(); in AddAudioContentForOffer()
2308 // Filter audio_codecs (which includes all codecs, with correctly remapped in AddAudioContentForOffer()
2316 // Add the codecs from the current transceiver's codec preferences. in AddAudioContentForOffer()
2317 // They override any existing codecs from previous negotiations. in AddAudioContentForOffer()
2322 // Add the codecs from current content if it exists and is not rejected nor in AddAudioContentForOffer()
2324 if (current_content && !current_content->rejected && in AddAudioContentForOffer()
2325 current_content->name == media_description_options.mid) { in AddAudioContentForOffer()
2328 current_content->media_description()->as_audio(); in AddAudioContentForOffer()
2329 for (const AudioCodec& codec : acd->codecs()) { in AddAudioContentForOffer()
2330 if (FindMatchingCodec<AudioCodec>(acd->codecs(), audio_codecs, codec, in AddAudioContentForOffer()
2336 // Add other supported audio codecs. in AddAudioContentForOffer()
2351 // If application doesn't want CN codecs in offer. in AddAudioContentForOffer()
2367 transport_desc_factory_->trials())) { in AddAudioContentForOffer()
2371 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); in AddAudioContentForOffer()
2374 audio->set_direction(media_description_options.direction); in AddAudioContentForOffer()
2376 desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp, in AddAudioContentForOffer()
2400 &transport_desc_factory_->trials(); in AddVideoContentForOffer()
2401 // Filter video_codecs (which includes all codecs, with correctly remapped in AddVideoContentForOffer()
2409 // Add the codecs from the current transceiver's codec preferences. in AddVideoContentForOffer()
2410 // They override any existing codecs from previous negotiations. in AddVideoContentForOffer()
2415 // Add the codecs from current content if it exists and is not rejected nor in AddVideoContentForOffer()
2417 if (current_content && !current_content->rejected && in AddVideoContentForOffer()
2418 current_content->name == media_description_options.mid) { in AddVideoContentForOffer()
2421 current_content->media_description()->as_video(); in AddVideoContentForOffer()
2422 for (const VideoCodec& codec : vcd->codecs()) { in AddVideoContentForOffer()
2423 if (FindMatchingCodec<VideoCodec>(vcd->codecs(), video_codecs, codec, in AddVideoContentForOffer()
2429 // Add other supported video codecs. in AddVideoContentForOffer()
2471 auto video = std::make_unique<VideoContentDescription>(); in AddVideoContentForOffer() local
2478 video_rtp_extensions, ssrc_generator(), current_streams, video.get(), in AddVideoContentForOffer()
2479 transport_desc_factory_->trials())) { in AddVideoContentForOffer()
2483 video->set_bandwidth(kAutoBandwidth); in AddVideoContentForOffer()
2485 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); in AddVideoContentForOffer()
2486 SetMediaProtocol(secure_transport, video.get()); in AddVideoContentForOffer()
2488 video->set_direction(media_description_options.direction); in AddVideoContentForOffer()
2490 desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp, in AddVideoContentForOffer()
2491 media_description_options.stopped, std::move(video)); in AddVideoContentForOffer()
2511 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); in AddDataContentForOffer()
2518 // get SDES crypto suites for RTP-based data channels. in AddDataContentForOffer()
2524 data->set_protocol(secure_transport ? kMediaProtocolUdpDtlsSctp in AddDataContentForOffer()
2526 data->set_use_sctpmap(session_options.use_obsolete_sctp_sdp); in AddDataContentForOffer()
2527 data->set_max_message_size(kSctpSendBufferSize); in AddDataContentForOffer()
2536 desc->AddContent(media_description_options.mid, MediaProtocolType::kSctp, in AddDataContentForOffer()
2556 current_content->media_description()->as_unsupported(); in AddUnsupportedContentForOffer()
2558 current_unsupported_description->media_type()); in AddUnsupportedContentForOffer()
2559 unsupported->set_protocol(current_content->media_description()->protocol()); in AddUnsupportedContentForOffer()
2560 desc->AddContent(media_description_options.mid, MediaProtocolType::kOther, in AddUnsupportedContentForOffer()
2571 // `audio_codecs` = set of all possible codecs that can be used, with correct
2574 // `supported_audio_codecs` = set of codecs that are supported for the direction
2577 // acd->codecs() = set of previously negotiated codecs for this m= section
2580 // from acd->codecs() and then supported_codecs, to ensure that re-offers don't
2581 // change existing codec priority, and that new codecs are added with the right
2597 &transport_desc_factory_->trials(); in AddAudioContentForAnswer()
2600 offer_content->media_description()->as_audio(); in AddAudioContentForAnswer()
2610 // Pick codecs based on the requested communications direction in the offer in AddAudioContentForAnswer()
2614 auto offer_rtd = offer_audio_description->direction(); in AddAudioContentForAnswer()
2626 // Add the codecs from current content if it exists and is not rejected nor in AddAudioContentForAnswer()
2628 if (current_content && !current_content->rejected && in AddAudioContentForAnswer()
2629 current_content->name == media_description_options.mid) { in AddAudioContentForAnswer()
2632 current_content->media_description()->as_audio(); in AddAudioContentForAnswer()
2633 for (const AudioCodec& codec : acd->codecs()) { in AddAudioContentForAnswer()
2634 if (FindMatchingCodec<AudioCodec>(acd->codecs(), audio_codecs, codec, in AddAudioContentForAnswer()
2640 // Add other supported audio codecs. in AddAudioContentForAnswer()
2654 // If application doesn't want CN codecs in answer. in AddAudioContentForAnswer()
2658 // Determine if we have media codecs in common. in AddAudioContentForAnswer()
2665 bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) && in AddAudioContentForAnswer()
2670 audio_transport->secure() ? cricket::SEC_DISABLED : secure(); in AddAudioContentForAnswer()
2674 transport_desc_factory_->trials())) { in AddAudioContentForAnswer()
2686 bool secure = bundle_transport ? bundle_transport->description.secure() in AddAudioContentForAnswer()
2687 : audio_transport->secure(); in AddAudioContentForAnswer()
2689 offer_content->rejected || !has_common_media_codecs || in AddAudioContentForAnswer()
2691 audio_answer->protocol(), secure); in AddAudioContentForAnswer()
2702 answer->AddContent(media_description_options.mid, offer_content->type, in AddAudioContentForAnswer()
2723 &transport_desc_factory_->trials(); in AddVideoContentForAnswer()
2726 offer_content->media_description()->as_video(); in AddVideoContentForAnswer()
2736 // Pick codecs based on the requested communications direction in the offer in AddVideoContentForAnswer()
2740 auto offer_rtd = offer_video_description->direction(); in AddVideoContentForAnswer()
2752 // Add the codecs from current content if it exists and is not rejected nor in AddVideoContentForAnswer()
2754 if (current_content && !current_content->rejected && in AddVideoContentForAnswer()
2755 current_content->name == media_description_options.mid) { in AddVideoContentForAnswer()
2758 current_content->media_description()->as_video(); in AddVideoContentForAnswer()
2759 for (const VideoCodec& codec : vcd->codecs()) { in AddVideoContentForAnswer()
2760 if (FindMatchingCodec<VideoCodec>(vcd->codecs(), video_codecs, codec, in AddVideoContentForAnswer()
2767 // Add other supported video codecs. in AddVideoContentForAnswer()
2785 // Determine if we have media codecs in common. in AddVideoContentForAnswer()
2801 bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) && in AddVideoContentForAnswer()
2806 video_transport->secure() ? cricket::SEC_DISABLED : secure(); in AddVideoContentForAnswer()
2810 transport_desc_factory_->trials())) { in AddVideoContentForAnswer()
2821 bool secure = bundle_transport ? bundle_transport->description.secure() in AddVideoContentForAnswer()
2822 : video_transport->secure(); in AddVideoContentForAnswer()
2824 offer_content->rejected || !has_common_media_codecs || in AddVideoContentForAnswer()
2826 video_answer->protocol(), secure); in AddVideoContentForAnswer()
2833 video_answer->set_bandwidth(kAutoBandwidth); in AddVideoContentForAnswer()
2835 RTC_LOG(LS_INFO) << "Video m= section '" << media_description_options.mid in AddVideoContentForAnswer()
2838 answer->AddContent(media_description_options.mid, offer_content->type, in AddVideoContentForAnswer()
2864 data_transport->secure() ? cricket::SEC_DISABLED : secure(); in AddDataContentForAnswer()
2865 bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) && in AddDataContentForAnswer()
2869 if (offer_content->media_description()->as_sctp()) { in AddDataContentForAnswer()
2873 offer_content->media_description()->as_sctp(); in AddDataContentForAnswer()
2875 data_answer->as_sctp()->set_protocol(offer_data_description->protocol()); in AddDataContentForAnswer()
2878 // 0 is treated specially - it means "I can accept any size". Since in AddDataContentForAnswer()
2881 if (offer_data_description->max_message_size() == 0) { in AddDataContentForAnswer()
2882 data_answer->as_sctp()->set_max_message_size(kSctpSendBufferSize); in AddDataContentForAnswer()
2884 data_answer->as_sctp()->set_max_message_size(std::min( in AddDataContentForAnswer()
2885 offer_data_description->max_message_size(), kSctpSendBufferSize)); in AddDataContentForAnswer()
2895 bool offer_uses_sctpmap = offer_data_description->use_sctpmap(); in AddDataContentForAnswer()
2896 data_answer->as_sctp()->set_use_sctpmap(offer_uses_sctpmap); in AddDataContentForAnswer()
2898 RTC_DCHECK_NOTREACHED() << "Non-SCTP data content found"; in AddDataContentForAnswer()
2901 bool secure = bundle_transport ? bundle_transport->description.secure() in AddDataContentForAnswer()
2902 : data_transport->secure(); in AddDataContentForAnswer()
2905 offer_content->rejected || in AddDataContentForAnswer()
2907 data_answer->protocol(), secure); in AddDataContentForAnswer()
2913 answer->AddContent(media_description_options.mid, offer_content->type, in AddDataContentForAnswer()
2939 offer_content->media_description()->as_unsupported(); in AddUnsupportedContentForAnswer()
2942 offer_unsupported_description->media_type()); in AddUnsupportedContentForAnswer()
2943 unsupported_answer->set_protocol(offer_unsupported_description->protocol()); in AddUnsupportedContentForAnswer()
2949 answer->AddContent(media_description_options.mid, offer_content->type, in AddUnsupportedContentForAnswer()
2956 &transport_desc_factory_->trials(); in ComputeAudioCodecsIntersectionAndUnion()
2959 // Compute the audio codecs union. in ComputeAudioCodecsIntersectionAndUnion()
2986 &transport_desc_factory_->trials(); in ComputeVideoCodecsIntersectionAndUnion()
3003 return (content && (content->type == MediaProtocolType::kRtp || in IsMediaContent()
3004 content->type == MediaProtocolType::kSctp)); in IsMediaContent()
3051 return GetFirstMediaContent(sdesc->contents(), media_type); in GetFirstMediaContent()
3070 return (content ? content->media_description() : nullptr); in GetFirstMediaContentDescription()
3076 return desc ? desc->as_audio() : nullptr; in GetFirstAudioContentDescription()
3082 return desc ? desc->as_video() : nullptr; in GetFirstVideoContentDescription()
3088 return desc ? desc->as_sctp() : nullptr; in GetFirstSctpDataContentDescription()
3092 // Non-const versions of the above functions.
3123 return GetFirstMediaContent(&sdesc->contents(), media_type); in GetFirstMediaContent()
3142 return (content ? content->media_description() : nullptr); in GetFirstMediaContentDescription()
3148 return desc ? desc->as_audio() : nullptr; in GetFirstAudioContentDescription()
3154 return desc ? desc->as_video() : nullptr; in GetFirstVideoContentDescription()
3160 return desc ? desc->as_sctp() : nullptr; in GetFirstSctpDataContentDescription()