Move static functions in media_session into anonymous namespace
and clean up methods that are now detected as unused.
BUG=None
Change-Id: If5dac3d43d4df6c7c108504c202c2383fe4a3f27
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321580
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40823}
diff --git a/pc/media_session.cc b/pc/media_session.cc
index ca4c757..2a8a22b 100644
--- a/pc/media_session.cc
+++ b/pc/media_session.cc
@@ -115,15 +115,17 @@
namespace cricket {
-static bool IsRtxCodec(const Codec& codec) {
+namespace {
+
+bool IsRtxCodec(const Codec& codec) {
return absl::EqualsIgnoreCase(codec.name, kRtxCodecName);
}
-static bool IsRtxCodec(const webrtc::RtpCodecCapability& capability) {
+bool IsRtxCodec(const webrtc::RtpCodecCapability& capability) {
return absl::EqualsIgnoreCase(capability.name, kRtxCodecName);
}
-static bool ContainsRtxCodec(const std::vector<Codec>& codecs) {
+bool ContainsRtxCodec(const std::vector<Codec>& codecs) {
for (const auto& codec : codecs) {
if (IsRtxCodec(codec)) {
return true;
@@ -132,19 +134,19 @@
return false;
}
-static bool IsRedCodec(const Codec& codec) {
+bool IsRedCodec(const Codec& codec) {
return absl::EqualsIgnoreCase(codec.name, kRedCodecName);
}
-static bool IsRedCodec(const webrtc::RtpCodecCapability& capability) {
+bool IsRedCodec(const webrtc::RtpCodecCapability& capability) {
return absl::EqualsIgnoreCase(capability.name, kRedCodecName);
}
-static bool IsFlexfecCodec(const Codec& codec) {
+bool IsFlexfecCodec(const Codec& codec) {
return absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName);
}
-static bool ContainsFlexfecCodec(const std::vector<Codec>& codecs) {
+bool ContainsFlexfecCodec(const std::vector<Codec>& codecs) {
for (const auto& codec : codecs) {
if (IsFlexfecCodec(codec)) {
return true;
@@ -153,15 +155,15 @@
return false;
}
-static bool IsUlpfecCodec(const Codec& codec) {
+bool IsUlpfecCodec(const Codec& codec) {
return absl::EqualsIgnoreCase(codec.name, kUlpfecCodecName);
}
-static bool IsComfortNoiseCodec(const Codec& codec) {
+bool IsComfortNoiseCodec(const Codec& codec) {
return absl::EqualsIgnoreCase(codec.name, kComfortNoiseCodecName);
}
-static RtpTransceiverDirection NegotiateRtpTransceiverDirection(
+RtpTransceiverDirection NegotiateRtpTransceiverDirection(
RtpTransceiverDirection offer,
RtpTransceiverDirection wants) {
bool offer_send = webrtc::RtpTransceiverDirectionHasSend(offer);
@@ -172,17 +174,16 @@
offer_send && wants_recv);
}
-static bool IsMediaContentOfType(const ContentInfo* content,
- MediaType media_type) {
+bool IsMediaContentOfType(const ContentInfo* content, MediaType media_type) {
if (!content || !content->media_description()) {
return false;
}
return content->media_description()->type() == media_type;
}
-static bool CreateCryptoParams(int tag,
- const std::string& cipher,
- CryptoParams* crypto_out) {
+bool CreateCryptoParams(int tag,
+ const std::string& cipher,
+ CryptoParams* crypto_out) {
int key_len;
int salt_len;
if (!rtc::GetSrtpKeyAndSaltLengths(rtc::SrtpCryptoSuiteFromName(cipher),
@@ -206,8 +207,8 @@
return true;
}
-static bool AddCryptoParams(const std::string& crypto_suite,
- CryptoParamsVec* cryptos_out) {
+bool AddCryptoParams(const std::string& crypto_suite,
+ CryptoParamsVec* cryptos_out) {
int size = static_cast<int>(cryptos_out->size());
cryptos_out->resize(size + 1);
@@ -291,31 +292,14 @@
crypto_options, crypto_suite_names);
}
-void GetSupportedDataSdesCryptoSuites(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<int>* crypto_suites) {
- crypto_suites->push_back(rtc::kSrtpAes128CmSha1_80);
- if (crypto_options.srtp.enable_gcm_crypto_suites) {
- crypto_suites->push_back(rtc::kSrtpAeadAes256Gcm);
- crypto_suites->push_back(rtc::kSrtpAeadAes128Gcm);
- }
-}
-
-void GetSupportedDataSdesCryptoSuiteNames(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<std::string>* crypto_suite_names) {
- GetSupportedSdesCryptoSuiteNames(GetSupportedDataSdesCryptoSuites,
- crypto_options, crypto_suite_names);
-}
-
// Support any GCM cipher (if enabled through options). For video support only
// 80-bit SHA1 HMAC. For audio 32-bit HMAC is tolerated (if enabled) unless
// bundle is enabled because it is low overhead.
// Pick the crypto in the list that is supported.
-static bool SelectCrypto(const MediaContentDescription* offer,
- bool bundle,
- const webrtc::CryptoOptions& crypto_options,
- CryptoParams* crypto_out) {
+bool SelectCrypto(const MediaContentDescription* offer,
+ bool bundle,
+ const webrtc::CryptoOptions& crypto_options,
+ CryptoParams* crypto_out) {
bool audio = offer->type() == MEDIA_TYPE_AUDIO;
const CryptoParamsVec& cryptos = offer->cryptos();
@@ -332,7 +316,7 @@
}
// Finds all StreamParams of all media types and attach them to stream_params.
-static StreamParamsVec GetCurrentStreamParams(
+StreamParamsVec GetCurrentStreamParams(
const std::vector<const ContentInfo*>& active_local_contents) {
StreamParamsVec stream_params;
for (const ContentInfo* content : active_local_contents) {
@@ -343,7 +327,7 @@
return stream_params;
}
-static StreamParams CreateStreamParamsForNewSenderWithSsrcs(
+StreamParams CreateStreamParamsForNewSenderWithSsrcs(
const SenderOptions& sender,
const std::string& rtcp_cname,
bool include_rtx_streams,
@@ -376,9 +360,8 @@
return result;
}
-static bool ValidateSimulcastLayers(
- const std::vector<RidDescription>& rids,
- const SimulcastLayerList& simulcast_layers) {
+bool ValidateSimulcastLayers(const std::vector<RidDescription>& rids,
+ const SimulcastLayerList& simulcast_layers) {
return absl::c_all_of(
simulcast_layers.GetAllLayers(), [&rids](const SimulcastLayer& layer) {
return absl::c_any_of(rids, [&layer](const RidDescription& rid) {
@@ -387,7 +370,7 @@
});
}
-static StreamParams CreateStreamParamsForNewSenderWithRids(
+StreamParams CreateStreamParamsForNewSenderWithRids(
const SenderOptions& sender,
const std::string& rtcp_cname) {
RTC_DCHECK(!sender.rids.empty());
@@ -409,7 +392,7 @@
// Adds SimulcastDescription if indicated by the media description options.
// MediaContentDescription should already be set up with the send rids.
-static void AddSimulcastToMediaDescription(
+void AddSimulcastToMediaDescription(
const MediaDescriptionOptions& media_description_options,
MediaContentDescription* description) {
RTC_DCHECK(description);
@@ -442,12 +425,12 @@
// Adds a StreamParams for each SenderOptions in `sender_options` to
// content_description.
// `current_params` - All currently known StreamParams of any media type.
-static bool AddStreamParams(const std::vector<SenderOptions>& sender_options,
- const std::string& rtcp_cname,
- UniqueRandomIdGenerator* ssrc_generator,
- StreamParamsVec* current_streams,
- MediaContentDescription* content_description,
- const webrtc::FieldTrialsView& field_trials) {
+bool AddStreamParams(const std::vector<SenderOptions>& sender_options,
+ const std::string& rtcp_cname,
+ UniqueRandomIdGenerator* ssrc_generator,
+ StreamParamsVec* current_streams,
+ MediaContentDescription* content_description,
+ const webrtc::FieldTrialsView& field_trials) {
// SCTP streams are not negotiated using SDP/ContentDescriptions.
if (IsSctpProtocol(content_description->protocol())) {
return true;
@@ -494,8 +477,8 @@
// `bundle_group`. The transport infos of the content names within the
// `bundle_group` should be updated to use the ufrag, pwd and DTLS role of the
// first content within the `bundle_group`.
-static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group,
- SessionDescription* sdesc) {
+bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group,
+ SessionDescription* sdesc) {
// The bundle should not be empty.
if (!sdesc || !bundle_group.FirstContentName()) {
return false;
@@ -529,9 +512,9 @@
// Gets the CryptoParamsVec of the given `content_name` from `sdesc`, and
// sets it to `cryptos`.
-static bool GetCryptosByName(const SessionDescription* sdesc,
- const std::string& content_name,
- CryptoParamsVec* cryptos) {
+bool GetCryptosByName(const SessionDescription* sdesc,
+ const std::string& content_name,
+ CryptoParamsVec* cryptos) {
if (!sdesc || !cryptos) {
return false;
}
@@ -545,8 +528,8 @@
// Prunes the `target_cryptos` by removing the crypto params (crypto_suite)
// which are not available in `filter`.
-static void PruneCryptos(const CryptoParamsVec& filter,
- CryptoParamsVec* target_cryptos) {
+void PruneCryptos(const CryptoParamsVec& filter,
+ CryptoParamsVec* target_cryptos) {
if (!target_cryptos) {
return;
}
@@ -565,8 +548,7 @@
target_cryptos->end());
}
-static bool IsRtpContent(SessionDescription* sdesc,
- const std::string& content_name) {
+bool IsRtpContent(SessionDescription* sdesc, const std::string& content_name) {
bool is_rtp = false;
ContentInfo* content = sdesc->GetContentByName(content_name);
if (content && content->media_description()) {
@@ -579,8 +561,8 @@
// `bundle_group`. The crypto parameters of all the contents within the
// `bundle_group` should be updated to use the common subset of the
// available cryptos.
-static bool UpdateCryptoParamsForBundle(const ContentGroup& bundle_group,
- SessionDescription* sdesc) {
+bool UpdateCryptoParamsForBundle(const ContentGroup& bundle_group,
+ SessionDescription* sdesc) {
// The bundle should not be empty.
if (!sdesc || !bundle_group.FirstContentName()) {
return false;
@@ -640,7 +622,7 @@
return true;
}
-static std::vector<const ContentInfo*> GetActiveContents(
+std::vector<const ContentInfo*> GetActiveContents(
const SessionDescription& description,
const MediaSessionOptions& session_options) {
std::vector<const ContentInfo*> active_contents;
@@ -663,7 +645,7 @@
// crypto (in current_cryptos) and it is enabled (in secure_policy), crypto is
// created (according to crypto_suites). The created content is added to the
// offer.
-static RTCError CreateContentOffer(
+RTCError CreateContentOffer(
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
const SecurePolicy& secure_policy,
@@ -716,7 +698,7 @@
return RTCError::OK();
}
-static RTCError CreateMediaContentOffer(
+RTCError CreateMediaContentOffer(
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
const std::vector<Codec>& codecs,
@@ -743,11 +725,11 @@
}
template <class C>
-static bool ReferencedCodecsMatch(const std::vector<C>& codecs1,
- const int codec1_id,
- const std::vector<C>& codecs2,
- const int codec2_id,
- const webrtc::FieldTrialsView* field_trials) {
+bool ReferencedCodecsMatch(const std::vector<C>& codecs1,
+ const int codec1_id,
+ const std::vector<C>& codecs2,
+ const int codec2_id,
+ const webrtc::FieldTrialsView* field_trials) {
const C* codec1 = FindCodecById(codecs1, codec1_id);
const C* codec2 = FindCodecById(codecs2, codec2_id);
return codec1 != nullptr && codec2 != nullptr &&
@@ -755,9 +737,9 @@
}
template <class C>
-static void NegotiatePacketization(const C& local_codec,
- const C& remote_codec,
- C* negotiated_codec) {}
+void NegotiatePacketization(const C& local_codec,
+ const C& remote_codec,
+ C* negotiated_codec) {}
template <>
void NegotiatePacketization(const VideoCodec& local_codec,
@@ -769,72 +751,11 @@
: absl::nullopt;
}
-template <class C>
-static void NegotiateCodecs(const std::vector<C>& local_codecs,
- const std::vector<C>& offered_codecs,
- std::vector<C>* negotiated_codecs,
- bool keep_offer_order,
- const webrtc::FieldTrialsView* field_trials) {
- for (const C& ours : local_codecs) {
- absl::optional<C> theirs =
- FindMatchingCodec(local_codecs, offered_codecs, ours, field_trials);
- // Note that we intentionally only find one matching codec for each of our
- // local codecs, in case the remote offer contains duplicate codecs.
- if (theirs) {
- C negotiated = ours;
- NegotiatePacketization(ours, *theirs, &negotiated);
- negotiated.IntersectFeedbackParams(*theirs);
- if (IsRtxCodec(negotiated)) {
- const auto apt_it =
- theirs->params.find(kCodecParamAssociatedPayloadType);
- // FindMatchingCodec shouldn't return something with no apt value.
- RTC_DCHECK(apt_it != theirs->params.end());
- negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second);
-
- // We support parsing the declarative rtx-time parameter.
- const auto rtx_time_it = theirs->params.find(kCodecParamRtxTime);
- if (rtx_time_it != theirs->params.end()) {
- negotiated.SetParam(kCodecParamRtxTime, rtx_time_it->second);
- }
- } else if (IsRedCodec(negotiated)) {
- const auto red_it =
- theirs->params.find(kCodecParamNotInNameValueFormat);
- if (red_it != theirs->params.end()) {
- negotiated.SetParam(kCodecParamNotInNameValueFormat, red_it->second);
- }
- }
- if (absl::EqualsIgnoreCase(ours.name, kH264CodecName)) {
- webrtc::H264GenerateProfileLevelIdForAnswer(ours.params, theirs->params,
- &negotiated.params);
- }
- negotiated.id = theirs->id;
- negotiated.name = theirs->name;
- negotiated_codecs->push_back(std::move(negotiated));
- }
- }
- if (keep_offer_order) {
- // RFC3264: Although the answerer MAY list the formats in their desired
- // order of preference, it is RECOMMENDED that unless there is a
- // specific reason, the answerer list formats in the same relative order
- // they were present in the offer.
- // This can be skipped when the transceiver has any codec preferences.
- std::unordered_map<int, int> payload_type_preferences;
- int preference = static_cast<int>(offered_codecs.size() + 1);
- for (const C& codec : offered_codecs) {
- payload_type_preferences[codec.id] = preference--;
- }
- absl::c_sort(*negotiated_codecs, [&payload_type_preferences](const C& a,
- const C& b) {
- return payload_type_preferences[a.id] > payload_type_preferences[b.id];
- });
- }
-}
-
// 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.
template <class C>
-static absl::optional<C> FindMatchingCodec(
+absl::optional<C> FindMatchingCodec(
const std::vector<C>& codecs1,
const std::vector<C>& codecs2,
const C& codec_to_match,
@@ -916,10 +837,71 @@
return absl::nullopt;
}
+template <class C>
+void NegotiateCodecs(const std::vector<C>& local_codecs,
+ const std::vector<C>& offered_codecs,
+ std::vector<C>* negotiated_codecs,
+ bool keep_offer_order,
+ const webrtc::FieldTrialsView* field_trials) {
+ for (const C& ours : local_codecs) {
+ absl::optional<C> theirs =
+ FindMatchingCodec(local_codecs, offered_codecs, ours, field_trials);
+ // Note that we intentionally only find one matching codec for each of our
+ // local codecs, in case the remote offer contains duplicate codecs.
+ if (theirs) {
+ C negotiated = ours;
+ NegotiatePacketization(ours, *theirs, &negotiated);
+ negotiated.IntersectFeedbackParams(*theirs);
+ if (IsRtxCodec(negotiated)) {
+ const auto apt_it =
+ theirs->params.find(kCodecParamAssociatedPayloadType);
+ // FindMatchingCodec shouldn't return something with no apt value.
+ RTC_DCHECK(apt_it != theirs->params.end());
+ negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second);
+
+ // We support parsing the declarative rtx-time parameter.
+ const auto rtx_time_it = theirs->params.find(kCodecParamRtxTime);
+ if (rtx_time_it != theirs->params.end()) {
+ negotiated.SetParam(kCodecParamRtxTime, rtx_time_it->second);
+ }
+ } else if (IsRedCodec(negotiated)) {
+ const auto red_it =
+ theirs->params.find(kCodecParamNotInNameValueFormat);
+ if (red_it != theirs->params.end()) {
+ negotiated.SetParam(kCodecParamNotInNameValueFormat, red_it->second);
+ }
+ }
+ if (absl::EqualsIgnoreCase(ours.name, kH264CodecName)) {
+ webrtc::H264GenerateProfileLevelIdForAnswer(ours.params, theirs->params,
+ &negotiated.params);
+ }
+ negotiated.id = theirs->id;
+ negotiated.name = theirs->name;
+ negotiated_codecs->push_back(std::move(negotiated));
+ }
+ }
+ if (keep_offer_order) {
+ // RFC3264: Although the answerer MAY list the formats in their desired
+ // order of preference, it is RECOMMENDED that unless there is a
+ // specific reason, the answerer list formats in the same relative order
+ // they were present in the offer.
+ // This can be skipped when the transceiver has any codec preferences.
+ std::unordered_map<int, int> payload_type_preferences;
+ int preference = static_cast<int>(offered_codecs.size() + 1);
+ for (const C& codec : offered_codecs) {
+ payload_type_preferences[codec.id] = preference--;
+ }
+ absl::c_sort(*negotiated_codecs, [&payload_type_preferences](const C& a,
+ const C& b) {
+ return payload_type_preferences[a.id] > payload_type_preferences[b.id];
+ });
+ }
+}
+
// Find the codec in `codec_list` that `rtx_codec` is associated with.
template <class C>
-static const C* GetAssociatedCodecForRtx(const std::vector<C>& codec_list,
- const C& rtx_codec) {
+const C* GetAssociatedCodecForRtx(const std::vector<C>& codec_list,
+ const C& rtx_codec) {
std::string associated_pt_str;
if (!rtx_codec.GetParam(kCodecParamAssociatedPayloadType,
&associated_pt_str)) {
@@ -948,8 +930,8 @@
// Find the codec in `codec_list` that `red_codec` is associated with.
template <class C>
-static const C* GetAssociatedCodecForRed(const std::vector<C>& codec_list,
- const C& red_codec) {
+const C* GetAssociatedCodecForRed(const std::vector<C>& codec_list,
+ const C& red_codec) {
std::string fmtp;
if (!red_codec.GetParam(kCodecParamNotInNameValueFormat, &fmtp)) {
// Normal for video/RED.
@@ -988,10 +970,10 @@
// already exist in `offered_codecs` and ensure the payload types don't
// collide.
template <class C>
-static void MergeCodecs(const std::vector<C>& reference_codecs,
- std::vector<C>* offered_codecs,
- UsedPayloadTypes* used_pltypes,
- const webrtc::FieldTrialsView* field_trials) {
+void MergeCodecs(const std::vector<C>& reference_codecs,
+ std::vector<C>* offered_codecs,
+ UsedPayloadTypes* used_pltypes,
+ const webrtc::FieldTrialsView* field_trials) {
// Add all new codecs that are not RTX/RED codecs.
// The two-pass splitting of the loops means preferring payload types
// of actual codecs with respect to collisions.
@@ -1060,7 +1042,7 @@
// a list filtered for the media section`s direction but with default payload
// types.
template <typename Codecs>
-static Codecs MatchCodecPreference(
+Codecs MatchCodecPreference(
const std::vector<webrtc::RtpCodecCapability>& codec_preferences,
const Codecs& codecs,
const Codecs& supported_codecs,
@@ -1163,11 +1145,11 @@
// `offered_extensions` is for either audio or video while `regular_extensions`
// and `encrypted_extensions` are used for both audio and video. There could be
// overlap between audio extensions and video extensions.
-static void MergeRtpHdrExts(const RtpHeaderExtensions& reference_extensions,
- RtpHeaderExtensions* offered_extensions,
- RtpHeaderExtensions* regular_extensions,
- RtpHeaderExtensions* encrypted_extensions,
- UsedRtpHeaderExtensionIds* used_ids) {
+void MergeRtpHdrExts(const RtpHeaderExtensions& reference_extensions,
+ RtpHeaderExtensions* offered_extensions,
+ RtpHeaderExtensions* regular_extensions,
+ RtpHeaderExtensions* encrypted_extensions,
+ UsedRtpHeaderExtensionIds* used_ids) {
for (auto reference_extension : reference_extensions) {
if (!webrtc::RtpExtension::FindHeaderExtensionByUriAndEncryption(
*offered_extensions, reference_extension.uri,
@@ -1201,10 +1183,9 @@
}
}
-static void AddEncryptedVersionsOfHdrExts(
- RtpHeaderExtensions* offered_extensions,
- RtpHeaderExtensions* encrypted_extensions,
- UsedRtpHeaderExtensionIds* used_ids) {
+void AddEncryptedVersionsOfHdrExts(RtpHeaderExtensions* offered_extensions,
+ RtpHeaderExtensions* encrypted_extensions,
+ UsedRtpHeaderExtensionIds* used_ids) {
RtpHeaderExtensions encrypted_extensions_to_add;
for (const auto& extension : *offered_extensions) {
// Skip existing encrypted offered extension
@@ -1253,7 +1234,7 @@
// Mostly identical to RtpExtension::FindHeaderExtensionByUri but discards any
// encrypted extensions that this implementation cannot encrypt.
-static const webrtc::RtpExtension* FindHeaderExtensionByUriDiscardUnsupported(
+const webrtc::RtpExtension* FindHeaderExtensionByUriDiscardUnsupported(
const std::vector<webrtc::RtpExtension>& extensions,
absl::string_view uri,
webrtc::RtpExtension::Filter filter) {
@@ -1277,11 +1258,10 @@
filter);
}
-static void NegotiateRtpHeaderExtensions(
- const RtpHeaderExtensions& local_extensions,
- const RtpHeaderExtensions& offered_extensions,
- webrtc::RtpExtension::Filter filter,
- RtpHeaderExtensions* negotiated_extensions) {
+void NegotiateRtpHeaderExtensions(const RtpHeaderExtensions& local_extensions,
+ const RtpHeaderExtensions& offered_extensions,
+ webrtc::RtpExtension::Filter filter,
+ RtpHeaderExtensions* negotiated_extensions) {
// TransportSequenceNumberV2 is not offered by default. The special logic for
// the TransportSequenceNumber extensions works as follows:
// Offer Answer
@@ -1361,7 +1341,7 @@
}
}
-static void StripCNCodecs(AudioCodecs* audio_codecs) {
+void StripCNCodecs(AudioCodecs* audio_codecs) {
audio_codecs->erase(std::remove_if(audio_codecs->begin(), audio_codecs->end(),
[](const AudioCodec& codec) {
return IsComfortNoiseCodec(codec);
@@ -1369,15 +1349,15 @@
audio_codecs->end());
}
-static bool SetCodecsInAnswer(
- const MediaContentDescription* offer,
- const std::vector<Codec>& local_codecs,
- const MediaDescriptionOptions& media_description_options,
- const MediaSessionOptions& session_options,
- UniqueRandomIdGenerator* ssrc_generator,
- StreamParamsVec* current_streams,
- MediaContentDescription* answer,
- const webrtc::FieldTrialsView& field_trials) {
+template <class C>
+bool SetCodecsInAnswer(const MediaContentDescriptionImpl<C>* offer,
+ const std::vector<C>& local_codecs,
+ const MediaDescriptionOptions& media_description_options,
+ const MediaSessionOptions& session_options,
+ UniqueRandomIdGenerator* ssrc_generator,
+ StreamParamsVec* current_streams,
+ MediaContentDescription* answer,
+ const webrtc::FieldTrialsView& field_trials) {
std::vector<Codec> negotiated_codecs;
NegotiateCodecs(local_codecs, offer->codecs(), &negotiated_codecs,
media_description_options.codec_preferences.empty(),
@@ -1399,7 +1379,7 @@
// (according to crypto_suites). The codecs, rtcp_mux, and crypto are all
// negotiated with the offer. If the negotiation fails, this method returns
// false. The created content is added to the offer.
-static bool CreateMediaContentAnswer(
+bool CreateMediaContentAnswer(
const MediaContentDescription* offer,
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
@@ -1468,9 +1448,9 @@
return true;
}
-static bool IsMediaProtocolSupported(MediaType type,
- const std::string& protocol,
- bool secure_transport) {
+bool IsMediaProtocolSupported(MediaType type,
+ const std::string& protocol,
+ bool secure_transport) {
// Since not all applications serialize and deserialize the media protocol,
// we will have to accept `protocol` to be empty.
if (protocol.empty()) {
@@ -1497,8 +1477,7 @@
}
}
-static void SetMediaProtocol(bool secure_transport,
- MediaContentDescription* desc) {
+void SetMediaProtocol(bool secure_transport, MediaContentDescription* desc) {
if (!desc->cryptos().empty())
desc->set_protocol(kMediaProtocolSavpf);
else if (secure_transport)
@@ -1509,7 +1488,7 @@
// Gets the TransportInfo of the given `content_name` from the
// `current_description`. If doesn't exist, returns a new one.
-static const TransportDescription* GetTransportDescription(
+const TransportDescription* GetTransportDescription(
const std::string& content_name,
const SessionDescription* current_description) {
const TransportDescription* desc = NULL;
@@ -1524,8 +1503,8 @@
}
// Gets the current DTLS state from the transport description.
-static bool IsDtlsActive(const ContentInfo* content,
- const SessionDescription* current_description) {
+bool IsDtlsActive(const ContentInfo* content,
+ const SessionDescription* current_description) {
if (!content) {
return false;
}
@@ -1540,6 +1519,8 @@
.description.secure();
}
+} // namespace
+
void MediaDescriptionOptions::AddAudioSender(
const std::string& track_id,
const std::vector<std::string>& stream_ids) {
@@ -1648,25 +1629,20 @@
ComputeVideoCodecsIntersectionAndUnion();
}
-static void RemoveUnifiedPlanExtensions(RtpHeaderExtensions* extensions) {
- RTC_DCHECK(extensions);
-
- extensions->erase(
- std::remove_if(extensions->begin(), extensions->end(),
- [](auto extension) {
- return extension.uri == webrtc::RtpExtension::kMidUri ||
- extension.uri == webrtc::RtpExtension::kRidUri ||
- extension.uri ==
- webrtc::RtpExtension::kRepairedRidUri;
- }),
- extensions->end());
-}
-
RtpHeaderExtensions
MediaSessionDescriptionFactory::filtered_rtp_header_extensions(
RtpHeaderExtensions extensions) const {
if (!is_unified_plan_) {
- RemoveUnifiedPlanExtensions(&extensions);
+ // Remove extensions only supported with unified-plan.
+ extensions.erase(
+ std::remove_if(
+ extensions.begin(), extensions.end(),
+ [](const webrtc::RtpExtension& extension) {
+ return extension.uri == webrtc::RtpExtension::kMidUri ||
+ extension.uri == webrtc::RtpExtension::kRidUri ||
+ extension.uri == webrtc::RtpExtension::kRepairedRidUri;
+ }),
+ extensions.end());
}
return extensions;
}
diff --git a/pc/media_session.h b/pc/media_session.h
index 9a3e9bf..25adeed 100644
--- a/pc/media_session.h
+++ b/pc/media_session.h
@@ -400,26 +400,6 @@
SctpDataContentDescription* GetFirstSctpDataContentDescription(
SessionDescription* sdesc);
-// Helper functions to return crypto suites used for SDES.
-void GetSupportedAudioSdesCryptoSuites(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<int>* crypto_suites);
-void GetSupportedVideoSdesCryptoSuites(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<int>* crypto_suites);
-void GetSupportedDataSdesCryptoSuites(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<int>* crypto_suites);
-void GetSupportedAudioSdesCryptoSuiteNames(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<std::string>* crypto_suite_names);
-void GetSupportedVideoSdesCryptoSuiteNames(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<std::string>* crypto_suite_names);
-void GetSupportedDataSdesCryptoSuiteNames(
- const webrtc::CryptoOptions& crypto_options,
- std::vector<std::string>* crypto_suite_names);
-
} // namespace cricket
#endif // PC_MEDIA_SESSION_H_