#include "pc/jsep_transport_controller.h"
#include <stddef.h>
#include <functional>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include "absl/algorithm/container.h"
#include "api/dtls_transport_interface.h"
#include "api/environment/environment.h"
#include "api/rtp_parameters.h"
#include "api/sequence_checker.h"
#include "api/transport/enums.h"
#include "media/sctp/sctp_transport_internal.h"
#include "p2p/base/dtls_transport.h"
#include "p2p/base/ice_transport_internal.h"
#include "p2p/base/p2p_constants.h"
#include "p2p/base/port.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread.h"
#include "rtc_base/trace_event.h"
SdpType;
namespace webrtc {
JsepTransportController::JsepTransportController(
const Environment& env,
rtc::Thread* network_thread,
cricket::PortAllocator* port_allocator,
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory,
PayloadTypePicker& payload_type_picker,
Config config)
: … { … }
JsepTransportController::~JsepTransportController() { … }
RTCError JsepTransportController::SetLocalDescription(
SdpType type,
const cricket::SessionDescription* local_desc,
const cricket::SessionDescription* remote_desc) { … }
RTCError JsepTransportController::SetRemoteDescription(
SdpType type,
const cricket::SessionDescription* local_desc,
const cricket::SessionDescription* remote_desc) { … }
RtpTransportInternal* JsepTransportController::GetRtpTransport(
absl::string_view mid) const { … }
DataChannelTransportInterface* JsepTransportController::GetDataChannelTransport(
const std::string& mid) const { … }
cricket::DtlsTransportInternal* JsepTransportController::GetDtlsTransport(
const std::string& mid) { … }
const cricket::DtlsTransportInternal*
JsepTransportController::GetRtcpDtlsTransport(const std::string& mid) const { … }
rtc::scoped_refptr<DtlsTransport>
JsepTransportController::LookupDtlsTransportByMid(const std::string& mid) { … }
rtc::scoped_refptr<SctpTransport> JsepTransportController::GetSctpTransport(
const std::string& mid) const { … }
void JsepTransportController::SetIceConfig(const cricket::IceConfig& config) { … }
void JsepTransportController::SetNeedsIceRestartFlag() { … }
bool JsepTransportController::NeedsIceRestart(
const std::string& transport_name) const { … }
absl::optional<rtc::SSLRole> JsepTransportController::GetDtlsRole(
const std::string& mid) const { … }
RTCErrorOr<webrtc::PayloadType> JsepTransportController::SuggestPayloadType(
const std::string& mid,
cricket::Codec codec) { … }
bool JsepTransportController::SetLocalCertificate(
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { … }
rtc::scoped_refptr<rtc::RTCCertificate>
JsepTransportController::GetLocalCertificate(
const std::string& transport_name) const { … }
std::unique_ptr<rtc::SSLCertChain>
JsepTransportController::GetRemoteSSLCertChain(
const std::string& transport_name) const { … }
void JsepTransportController::MaybeStartGathering() { … }
RTCError JsepTransportController::AddRemoteCandidates(
const std::string& transport_name,
const cricket::Candidates& candidates) { … }
RTCError JsepTransportController::RemoveRemoteCandidates(
const cricket::Candidates& candidates) { … }
bool JsepTransportController::GetStats(const std::string& transport_name,
cricket::TransportStats* stats) { … }
void JsepTransportController::SetActiveResetSrtpParams(
bool active_reset_srtp_params) { … }
RTCError JsepTransportController::RollbackTransports() { … }
rtc::scoped_refptr<IceTransportInterface>
JsepTransportController::CreateIceTransport(const std::string& transport_name,
bool rtcp) { … }
std::unique_ptr<cricket::DtlsTransportInternal>
JsepTransportController::CreateDtlsTransport(
const cricket::ContentInfo& content_info,
cricket::IceTransportInternal* ice) { … }
std::unique_ptr<RtpTransport>
JsepTransportController::CreateUnencryptedRtpTransport(
const std::string& transport_name,
rtc::PacketTransportInternal* rtp_packet_transport,
rtc::PacketTransportInternal* rtcp_packet_transport) { … }
std::unique_ptr<SrtpTransport> JsepTransportController::CreateSdesTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport) { … }
std::unique_ptr<DtlsSrtpTransport>
JsepTransportController::CreateDtlsSrtpTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport) { … }
std::vector<cricket::DtlsTransportInternal*>
JsepTransportController::GetDtlsTransports() { … }
std::vector<cricket::DtlsTransportInternal*>
JsepTransportController::GetActiveDtlsTransports() { … }
RTCError JsepTransportController::ApplyDescription_n(
bool local,
SdpType type,
const cricket::SessionDescription* local_desc,
const cricket::SessionDescription* remote_desc) { … }
RTCError JsepTransportController::ValidateAndMaybeUpdateBundleGroups(
bool local,
SdpType type,
const cricket::SessionDescription* local_desc,
const cricket::SessionDescription* remote_desc) { … }
RTCError JsepTransportController::ValidateContent(
const cricket::ContentInfo& content_info) { … }
void JsepTransportController::HandleRejectedContent(
const cricket::ContentInfo& content_info) { … }
bool JsepTransportController::HandleBundledContent(
const cricket::ContentInfo& content_info,
const cricket::ContentGroup& bundle_group) { … }
cricket::JsepTransportDescription
JsepTransportController::CreateJsepTransportDescription(
const cricket::ContentInfo& content_info,
const cricket::TransportInfo& transport_info,
const std::vector<int>& encrypted_extension_ids,
int rtp_abs_sendtime_extn_id) { … }
std::vector<int> JsepTransportController::GetEncryptedHeaderExtensionIds(
const cricket::ContentInfo& content_info) { … }
std::map<const cricket::ContentGroup*, std::vector<int>>
JsepTransportController::MergeEncryptedHeaderExtensionIdsForBundles(
const cricket::SessionDescription* description) { … }
int JsepTransportController::GetRtpAbsSendTimeHeaderExtensionId(
const cricket::ContentInfo& content_info) { … }
const cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
const std::string& mid) const { … }
cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
const std::string& mid) { … }
const cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
absl::string_view mid) const { … }
cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
absl::string_view mid) { … }
const cricket::JsepTransport* JsepTransportController::GetJsepTransportByName(
const std::string& transport_name) const { … }
cricket::JsepTransport* JsepTransportController::GetJsepTransportByName(
const std::string& transport_name) { … }
RTCError JsepTransportController::MaybeCreateJsepTransport(
bool local,
const cricket::ContentInfo& content_info,
const cricket::SessionDescription& description) { … }
void JsepTransportController::DestroyAllJsepTransports_n() { … }
void JsepTransportController::SetIceRole_n(cricket::IceRole ice_role) { … }
cricket::IceRole JsepTransportController::DetermineIceRole(
cricket::JsepTransport* jsep_transport,
const cricket::TransportInfo& transport_info,
SdpType type,
bool local) { … }
void JsepTransportController::OnTransportWritableState_n(
rtc::PacketTransportInternal* transport) { … }
void JsepTransportController::OnTransportReceivingState_n(
rtc::PacketTransportInternal* transport) { … }
void JsepTransportController::OnTransportGatheringState_n(
cricket::IceTransportInternal* transport) { … }
void JsepTransportController::OnTransportCandidateGathered_n(
cricket::IceTransportInternal* transport,
const cricket::Candidate& candidate) { … }
void JsepTransportController::OnTransportCandidateError_n(
cricket::IceTransportInternal* transport,
const cricket::IceCandidateErrorEvent& event) { … }
void JsepTransportController::OnTransportCandidatesRemoved_n(
cricket::IceTransportInternal* transport,
const cricket::Candidates& candidates) { … }
void JsepTransportController::OnTransportCandidatePairChanged_n(
const cricket::CandidatePairChangeEvent& event) { … }
void JsepTransportController::OnTransportRoleConflict_n(
cricket::IceTransportInternal* transport) { … }
void JsepTransportController::OnTransportStateChanged_n(
cricket::IceTransportInternal* transport) { … }
void JsepTransportController::UpdateAggregateStates_n() { … }
void JsepTransportController::OnRtcpPacketReceived_n(
rtc::CopyOnWriteBuffer* packet,
int64_t packet_time_us) { … }
void JsepTransportController::OnUnDemuxableRtpPacketReceived_n(
const RtpPacketReceived& packet) { … }
void JsepTransportController::OnDtlsHandshakeError(
rtc::SSLHandshakeError error) { … }
bool JsepTransportController::OnTransportChanged(
const std::string& mid,
cricket::JsepTransport* jsep_transport) { … }
}