Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: webrtc/ortc/rtptransportadapter.cc

Issue 2981513002: Wire up RTP keep-alive in ortc api. (Closed)
Patch Set: deps, again Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/ortc/rtptransportadapter.h ('k') | webrtc/ortc/rtptransportcontrolleradapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/ortc/rtptransportadapter.cc
diff --git a/webrtc/ortc/rtptransportadapter.cc b/webrtc/ortc/rtptransportadapter.cc
index 1154ff629b87367fadefdbe2fe527322d2465a95..10e5e8fefc911a985b94369ab75dab6efb0927d9 100644
--- a/webrtc/ortc/rtptransportadapter.cc
+++ b/webrtc/ortc/rtptransportadapter.cc
@@ -24,8 +24,8 @@ BEGIN_OWNED_PROXY_MAP(RtpTransport)
PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtpPacketTransport)
PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtcpPacketTransport)
-PROXY_METHOD1(RTCError, SetRtcpParameters, const RtcpParameters&)
-PROXY_CONSTMETHOD0(RtcpParameters, GetRtcpParameters)
+PROXY_METHOD1(RTCError, SetParameters, const RtpTransportParameters&)
+PROXY_CONSTMETHOD0(RtpTransportParameters, GetParameters)
protected:
RtpTransportAdapter* GetInternal() override {
return internal();
@@ -36,8 +36,8 @@ BEGIN_OWNED_PROXY_MAP(SrtpTransport)
PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtpPacketTransport)
PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtcpPacketTransport)
-PROXY_METHOD1(RTCError, SetRtcpParameters, const RtcpParameters&)
-PROXY_CONSTMETHOD0(RtcpParameters, GetRtcpParameters)
+PROXY_METHOD1(RTCError, SetParameters, const RtpTransportParameters&)
+PROXY_CONSTMETHOD0(RtpTransportParameters, GetParameters)
PROXY_METHOD1(RTCError, SetSrtpSendKey, const cricket::CryptoParams&)
PROXY_METHOD1(RTCError, SetSrtpReceiveKey, const cricket::CryptoParams&)
protected:
@@ -49,7 +49,7 @@ END_PROXY_MAP()
// static
RTCErrorOr<std::unique_ptr<RtpTransportInterface>>
RtpTransportAdapter::CreateProxied(
- const RtcpParameters& rtcp_parameters,
+ const RtpTransportParameters& parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
RtpTransportControllerAdapter* rtp_transport_controller) {
@@ -57,12 +57,12 @@ RtpTransportAdapter::CreateProxied(
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Must provide an RTP packet transport.");
}
- if (!rtcp_parameters.mux && !rtcp) {
+ if (!parameters.rtcp.mux && !rtcp) {
LOG_AND_RETURN_ERROR(
RTCErrorType::INVALID_PARAMETER,
"Must provide an RTCP packet transport when RTCP muxing is not used.");
}
- if (rtcp_parameters.mux && rtcp) {
+ if (parameters.rtcp.mux && rtcp) {
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Creating an RtpTransport with RTCP muxing enabled, "
"with a separate RTCP packet transport?");
@@ -74,17 +74,23 @@ RtpTransportAdapter::CreateProxied(
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Must provide an RTP transport controller.");
}
+ std::unique_ptr<RtpTransportAdapter> transport_adapter(
+ new RtpTransportAdapter(parameters.rtcp, rtp, rtcp,
+ rtp_transport_controller,
+ false /*is_srtp_transport*/));
+ RTCError params_result = transport_adapter->SetParameters(parameters);
+ if (!params_result.ok()) {
+ return std::move(params_result);
+ }
+
return RtpTransportProxyWithInternal<RtpTransportAdapter>::Create(
rtp_transport_controller->signaling_thread(),
- rtp_transport_controller->worker_thread(),
- std::unique_ptr<RtpTransportAdapter>(new RtpTransportAdapter(
- rtcp_parameters, rtp, rtcp, rtp_transport_controller,
- /*is_srtp_transport*/ false)));
+ rtp_transport_controller->worker_thread(), std::move(transport_adapter));
}
RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>
RtpTransportAdapter::CreateSrtpProxied(
- const RtcpParameters& rtcp_parameters,
+ const RtpTransportParameters& parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
RtpTransportControllerAdapter* rtp_transport_controller) {
@@ -92,12 +98,12 @@ RtpTransportAdapter::CreateSrtpProxied(
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Must provide an RTP packet transport.");
}
- if (!rtcp_parameters.mux && !rtcp) {
+ if (!parameters.rtcp.mux && !rtcp) {
LOG_AND_RETURN_ERROR(
RTCErrorType::INVALID_PARAMETER,
"Must provide an RTCP packet transport when RTCP muxing is not used.");
}
- if (rtcp_parameters.mux && rtcp) {
+ if (parameters.rtcp.mux && rtcp) {
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Creating an RtpTransport with RTCP muxing enabled, "
"with a separate RTCP packet transport?");
@@ -109,12 +115,18 @@ RtpTransportAdapter::CreateSrtpProxied(
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Must provide an RTP transport controller.");
}
+ std::unique_ptr<RtpTransportAdapter> transport_adapter(
+ new RtpTransportAdapter(parameters.rtcp, rtp, rtcp,
+ rtp_transport_controller,
+ true /*is_srtp_transport*/));
+ RTCError params_result = transport_adapter->SetParameters(parameters);
+ if (!params_result.ok()) {
+ return std::move(params_result);
+ }
+
return SrtpTransportProxyWithInternal<RtpTransportAdapter>::Create(
rtp_transport_controller->signaling_thread(),
- rtp_transport_controller->worker_thread(),
- std::unique_ptr<RtpTransportAdapter>(new RtpTransportAdapter(
- rtcp_parameters, rtp, rtcp, rtp_transport_controller,
- /*is_srtp_transport*/ true)));
+ rtp_transport_controller->worker_thread(), std::move(transport_adapter));
}
void RtpTransportAdapter::TakeOwnershipOfRtpTransportController(
@@ -125,7 +137,7 @@ void RtpTransportAdapter::TakeOwnershipOfRtpTransportController(
}
RtpTransportAdapter::RtpTransportAdapter(
- const RtcpParameters& rtcp_parameters,
+ const RtcpParameters& rtcp_params,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
RtpTransportControllerAdapter* rtp_transport_controller,
@@ -133,11 +145,11 @@ RtpTransportAdapter::RtpTransportAdapter(
: rtp_packet_transport_(rtp),
rtcp_packet_transport_(rtcp),
rtp_transport_controller_(rtp_transport_controller),
- rtcp_parameters_(rtcp_parameters),
is_srtp_transport_(is_srtp_transport) {
- RTC_DCHECK(rtp_transport_controller);
+ parameters_.rtcp = rtcp_params;
// CNAME should have been filled by OrtcFactory if empty.
- RTC_DCHECK(!rtcp_parameters_.cname.empty());
+ RTC_DCHECK(!parameters_.rtcp.cname.empty());
+ RTC_DCHECK(rtp_transport_controller);
}
RtpTransportAdapter::~RtpTransportAdapter() {
@@ -152,27 +164,29 @@ PacketTransportInterface* RtpTransportAdapter::GetRtcpPacketTransport() const {
return rtcp_packet_transport_;
}
-RTCError RtpTransportAdapter::SetRtcpParameters(
- const RtcpParameters& parameters) {
- if (!parameters.mux && rtcp_parameters_.mux) {
+RTCError RtpTransportAdapter::SetParameters(
+ const RtpTransportParameters& parameters) {
+ if (!parameters.rtcp.mux && parameters_.rtcp.mux) {
LOG_AND_RETURN_ERROR(webrtc::RTCErrorType::INVALID_STATE,
"Can't disable RTCP muxing after enabling.");
}
- if (!parameters.cname.empty() && parameters.cname != rtcp_parameters_.cname) {
+ if (!parameters.rtcp.cname.empty() &&
+ parameters.rtcp.cname != parameters_.rtcp.cname) {
LOG_AND_RETURN_ERROR(webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
"Changing the RTCP CNAME is currently unsupported.");
}
// If the CNAME is empty, use the existing one.
- RtcpParameters copy = parameters;
- if (copy.cname.empty()) {
- copy.cname = rtcp_parameters_.cname;
+ RtpTransportParameters copy = parameters;
+ if (copy.rtcp.cname.empty()) {
+ copy.rtcp.cname = parameters_.rtcp.cname;
}
- RTCError err = rtp_transport_controller_->SetRtcpParameters(copy, this);
+ RTCError err =
+ rtp_transport_controller_->SetRtpTransportParameters(copy, this);
if (!err.ok()) {
return err;
}
- rtcp_parameters_ = copy;
- if (rtcp_parameters_.mux) {
+ parameters_ = copy;
+ if (parameters_.rtcp.mux) {
rtcp_packet_transport_ = nullptr;
}
return RTCError::OK();
« no previous file with comments | « webrtc/ortc/rtptransportadapter.h ('k') | webrtc/ortc/rtptransportcontrolleradapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698