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

Unified Diff: webrtc/ortc/rtptransportcontrolleradapter.cc

Issue 2981513002: Wire up RTP keep-alive in ortc api. (Closed)
Patch Set: Moved tests around 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
Index: webrtc/ortc/rtptransportcontrolleradapter.cc
diff --git a/webrtc/ortc/rtptransportcontrolleradapter.cc b/webrtc/ortc/rtptransportcontrolleradapter.cc
index 5e0b62112357ba849fec33d5e3428e1e5c235932..96ba8be155b803590f4dfb7ee3f895d9b5f6570f 100644
--- a/webrtc/ortc/rtptransportcontrolleradapter.cc
+++ b/webrtc/ortc/rtptransportcontrolleradapter.cc
@@ -92,13 +92,15 @@ END_PROXY_MAP()
std::unique_ptr<RtpTransportControllerInterface>
RtpTransportControllerAdapter::CreateProxied(
const cricket::MediaConfig& config,
+ const RtpTransportParameters& parameters,
cricket::ChannelManager* channel_manager,
webrtc::RtcEventLog* event_log,
rtc::Thread* signaling_thread,
rtc::Thread* worker_thread) {
std::unique_ptr<RtpTransportControllerAdapter> wrapped(
- new RtpTransportControllerAdapter(config, channel_manager, event_log,
- signaling_thread, worker_thread));
+ new RtpTransportControllerAdapter(config, parameters, channel_manager,
+ event_log, signaling_thread,
+ worker_thread));
return RtpTransportControllerProxyWithInternal<
RtpTransportControllerAdapter>::Create(signaling_thread, worker_thread,
std::move(wrapped));
@@ -129,11 +131,10 @@ RtpTransportControllerAdapter::~RtpTransportControllerAdapter() {
RTCErrorOr<std::unique_ptr<RtpTransportInterface>>
RtpTransportControllerAdapter::CreateProxiedRtpTransport(
- const RtcpParameters& rtcp_parameters,
+ const RtpTransportParameters& parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp) {
- auto result =
- RtpTransportAdapter::CreateProxied(rtcp_parameters, rtp, rtcp, this);
+ auto result = RtpTransportAdapter::CreateProxied(parameters, rtp, rtcp, this);
if (result.ok()) {
transport_proxies_.push_back(result.value().get());
transport_proxies_.back()->GetInternal()->SignalDestroyed.connect(
@@ -144,11 +145,11 @@ RtpTransportControllerAdapter::CreateProxiedRtpTransport(
RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>
RtpTransportControllerAdapter::CreateProxiedSrtpTransport(
- const RtcpParameters& rtcp_parameters,
+ const RtpTransportParameters& parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp) {
auto result =
- RtpTransportAdapter::CreateSrtpProxied(rtcp_parameters, rtp, rtcp, this);
+ RtpTransportAdapter::CreateSrtpProxied(parameters, rtp, rtcp, this);
if (result.ok()) {
transport_proxies_.push_back(result.value().get());
transport_proxies_.back()->GetInternal()->SignalDestroyed.connect(
@@ -219,12 +220,20 @@ RtpTransportControllerAdapter::GetTransports() const {
return transport_proxies_;
}
-RTCError RtpTransportControllerAdapter::SetRtcpParameters(
- const RtcpParameters& parameters,
+RTCError RtpTransportControllerAdapter::SetRtpTransportAndParameters(
+ const RtpTransportParameters& parameters,
RtpTransportInterface* inner_transport) {
+ if ((video_channel_ != nullptr || voice_channel_ != nullptr) &&
+ (parameters.keepalive != keepalive_)) {
+ LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
+ "Cannot change keep-alive settings after creating "
+ "media streams.");
Taylor Brandstetter 2017/08/03 16:50:36 nit: Someone using this API may interpret "media s
+ }
+ RTC_DCHECK(call_->SetRtpKeepAliveConfig(parameters.keepalive));
Taylor Brandstetter 2017/08/03 01:18:03 If this is in a DCHECK, it will only be executed i
sprang_webrtc 2017/08/03 13:08:14 Oops, right. Let's do a check instead then.
do {
if (inner_transport == inner_audio_transport_) {
- CopyRtcpParametersToDescriptions(parameters, &local_audio_description_,
+ CopyRtcpParametersToDescriptions(parameters.rtcp,
+ &local_audio_description_,
&remote_audio_description_);
if (!voice_channel_->SetLocalContent(&local_audio_description_,
cricket::CA_OFFER, nullptr)) {
@@ -235,7 +244,8 @@ RTCError RtpTransportControllerAdapter::SetRtcpParameters(
break;
}
} else if (inner_transport == inner_video_transport_) {
- CopyRtcpParametersToDescriptions(parameters, &local_video_description_,
+ CopyRtcpParametersToDescriptions(parameters.rtcp,
+ &local_video_description_,
&remote_video_description_);
if (!video_channel_->SetLocalContent(&local_video_description_,
cricket::CA_OFFER, nullptr)) {
@@ -270,7 +280,7 @@ RTCError RtpTransportControllerAdapter::ValidateAndApplyAudioSenderParameters(
}
auto stream_params_result = MakeSendStreamParamsVec(
- parameters.encodings, inner_audio_transport_->GetRtcpParameters().cname,
+ parameters.encodings, inner_audio_transport_->GetParameters().rtcp.cname,
local_audio_description_);
if (!stream_params_result.ok()) {
return stream_params_result.MoveError();
@@ -359,7 +369,7 @@ RTCError RtpTransportControllerAdapter::ValidateAndApplyVideoSenderParameters(
}
auto stream_params_result = MakeSendStreamParamsVec(
- parameters.encodings, inner_video_transport_->GetRtcpParameters().cname,
+ parameters.encodings, inner_video_transport_->GetParameters().rtcp.cname,
local_video_description_);
if (!stream_params_result.ok()) {
return stream_params_result.MoveError();
@@ -582,6 +592,7 @@ RTCError RtpTransportControllerAdapter::ValidateAndApplyVideoReceiverParameters(
RtpTransportControllerAdapter::RtpTransportControllerAdapter(
const cricket::MediaConfig& config,
+ const RtpTransportParameters& params,
cricket::ChannelManager* channel_manager,
webrtc::RtcEventLog* event_log,
rtc::Thread* signaling_thread,
@@ -589,6 +600,7 @@ RtpTransportControllerAdapter::RtpTransportControllerAdapter(
: signaling_thread_(signaling_thread),
worker_thread_(worker_thread),
media_config_(config),
+ keepalive_(params.keepalive),
channel_manager_(channel_manager),
event_log_(event_log) {
RTC_DCHECK_RUN_ON(signaling_thread_);
@@ -607,12 +619,13 @@ RtpTransportControllerAdapter::RtpTransportControllerAdapter(
worker_thread_->Invoke<void>(
RTC_FROM_HERE,
- rtc::Bind(&RtpTransportControllerAdapter::Init_w, this));
+ rtc::Bind(&RtpTransportControllerAdapter::Init_w, this, params));
}
// TODO(nisse): Duplicates corresponding method in PeerConnection (used
// to be in MediaController).
-void RtpTransportControllerAdapter::Init_w() {
+void RtpTransportControllerAdapter::Init_w(
+ const RtpTransportParameters& params) {
RTC_DCHECK(worker_thread_->IsCurrent());
RTC_DCHECK(!call_);
@@ -625,6 +638,7 @@ void RtpTransportControllerAdapter::Init_w() {
call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
+ call_config.keepalive_config = params.keepalive;
call_.reset(webrtc::Call::Create(call_config));
}
@@ -656,7 +670,7 @@ RTCError RtpTransportControllerAdapter::AttachAudioSender(
// If setting new transport, extract its RTCP parameters and create voice
// channel.
if (!inner_audio_transport_) {
- CopyRtcpParametersToDescriptions(inner_transport->GetRtcpParameters(),
+ CopyRtcpParametersToDescriptions(inner_transport->GetParameters().rtcp,
&local_audio_description_,
&remote_audio_description_);
inner_audio_transport_ = inner_transport;
@@ -691,7 +705,7 @@ RTCError RtpTransportControllerAdapter::AttachVideoSender(
// If setting new transport, extract its RTCP parameters and create video
// channel.
if (!inner_video_transport_) {
- CopyRtcpParametersToDescriptions(inner_transport->GetRtcpParameters(),
+ CopyRtcpParametersToDescriptions(inner_transport->GetParameters().rtcp,
&local_video_description_,
&remote_video_description_);
inner_video_transport_ = inner_transport;
@@ -726,7 +740,7 @@ RTCError RtpTransportControllerAdapter::AttachAudioReceiver(
// If setting new transport, extract its RTCP parameters and create voice
// channel.
if (!inner_audio_transport_) {
- CopyRtcpParametersToDescriptions(inner_transport->GetRtcpParameters(),
+ CopyRtcpParametersToDescriptions(inner_transport->GetParameters().rtcp,
&local_audio_description_,
&remote_audio_description_);
inner_audio_transport_ = inner_transport;
@@ -761,7 +775,7 @@ RTCError RtpTransportControllerAdapter::AttachVideoReceiver(
// If setting new transport, extract its RTCP parameters and create video
// channel.
if (!inner_video_transport_) {
- CopyRtcpParametersToDescriptions(inner_transport->GetRtcpParameters(),
+ CopyRtcpParametersToDescriptions(inner_transport->GetParameters().rtcp,
&local_video_description_,
&remote_video_description_);
inner_video_transport_ = inner_transport;

Powered by Google App Engine
This is Rietveld 408576698