bool SdpHelper::MsectionIsDisabled(const SdpMediaSection& msection) const { return !msection.GetPort() && !msection.GetAttributeList().HasAttribute( SdpAttribute::kBundleOnlyAttribute); }
nsresult SdpHelper::CopyTransportParams(size_t numComponents, const SdpMediaSection& oldLocal, SdpMediaSection* newLocal) { // Copy over m-section details newLocal->SetPort(oldLocal.GetPort()); newLocal->GetConnection() = oldLocal.GetConnection(); const SdpAttributeList& oldLocalAttrs = oldLocal.GetAttributeList(); SdpAttributeList& newLocalAttrs = newLocal->GetAttributeList(); // Now we copy over attributes that won't be added by the usual logic if (oldLocalAttrs.HasAttribute(SdpAttribute::kCandidateAttribute) && numComponents) { UniquePtr<SdpMultiStringAttribute> candidateAttrs( new SdpMultiStringAttribute(SdpAttribute::kCandidateAttribute)); for (const std::string& candidate : oldLocalAttrs.GetCandidate()) { size_t component; nsresult rv = GetComponent(candidate, &component); NS_ENSURE_SUCCESS(rv, rv); if (numComponents >= component) { candidateAttrs->mValues.push_back(candidate); } } if (candidateAttrs->mValues.size()) { newLocalAttrs.SetAttribute(candidateAttrs.release()); } } if (numComponents == 2 && oldLocalAttrs.HasAttribute(SdpAttribute::kRtcpAttribute)) { // copy rtcp attribute if we had one that we are using newLocalAttrs.SetAttribute(new SdpRtcpAttribute(oldLocalAttrs.GetRtcp())); } return NS_OK; }