From a9d988d17571d5e53142f823ebae9c3bd29ca8f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Fri, 23 Mar 2018 13:28:24 +0100 Subject: [PATCH] Update VideoSendStreamImpl for configuration transition. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Yet another followup fix to https://webrtc-review.googlesource.com/64101. Bug: webrtc:8830 Change-Id: I742e675589450fea4c212a2435d3a7484e301fa7 Reviewed-on: https://webrtc-review.googlesource.com/64441 Commit-Queue: Niels Moller Reviewed-by: Erik Språng Cr-Commit-Position: refs/heads/master@{#22582} --- video/video_send_stream.cc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc index 0bf1cf2378..4e1360d1b4 100644 --- a/video/video_send_stream.cc +++ b/video/video_send_stream.cc @@ -402,6 +402,11 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, SendStatisticsProxy* const stats_proxy_; const VideoSendStream::Config* const config_; + // TODO(nisse): Transition hack, to support either + // config.rtp.payload_* or config_.encoder_settings.payload_*. + std::string payload_name_; + int payload_type_; + std::map suspended_ssrcs_; std::unique_ptr fec_controller_; @@ -700,6 +705,12 @@ VideoSendStreamImpl::VideoSendStreamImpl( webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), stats_proxy_(stats_proxy), config_(config), + payload_name_(!config_->rtp.payload_name.empty() + ? config_->rtp.payload_name.c_str() + : config_->encoder_settings.payload_name.c_str()), + payload_type_(config_->rtp.payload_type != -1 + ? config_->rtp.payload_type + : config_->encoder_settings.payload_type), suspended_ssrcs_(std::move(suspended_ssrcs)), fec_controller_(std::move(fec_controller)), module_process_thread_(nullptr), @@ -827,18 +838,11 @@ VideoSendStreamImpl::VideoSendStreamImpl( // TODO(pbos): Should we set CNAME on all RTP modules? rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); - int payload_type = config_->rtp.payload_type != -1 - ? config_->rtp.payload_type - : config_->encoder_settings.payload_type; - for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(stats_proxy_); rtp_rtcp->SetMaxRtpPacketSize(config_->rtp.max_packet_size); - rtp_rtcp->RegisterVideoSendPayload( - payload_type, !config_->rtp.payload_name.empty() - ? config_->rtp.payload_name.c_str() - : config_->encoder_settings.payload_name.c_str()); + rtp_rtcp->RegisterVideoSendPayload(payload_type_, payload_name_.c_str()); } fec_controller_->SetProtectionCallback(this); @@ -848,8 +852,8 @@ VideoSendStreamImpl::VideoSendStreamImpl( } RTC_DCHECK(config_->encoder_settings.encoder); - RTC_DCHECK_GE(payload_type, 0); - RTC_DCHECK_LE(payload_type, 127); + RTC_DCHECK_GE(payload_type_, 0); + RTC_DCHECK_LE(payload_type_, 127); video_stream_encoder_->SetStartBitrate( bitrate_allocator_->GetStartBitrate(this)); @@ -1142,8 +1146,7 @@ void VideoSendStreamImpl::ConfigureProtection() { // is a waste of bandwidth since FEC packets still have to be transmitted. // Note that this is not the case with FlexFEC. if (nack_enabled && IsUlpfecEnabled() && - !PayloadTypeSupportsSkippingFecPackets( - config_->encoder_settings.payload_name)) { + !PayloadTypeSupportsSkippingFecPackets(payload_name_)) { RTC_LOG(LS_WARNING) << "Transmitting payload type without picture ID using " "NACK+ULPFEC is a waste of bandwidth since ULPFEC packets " @@ -1221,7 +1224,7 @@ void VideoSendStreamImpl::ConfigureSsrcs() { RTC_DCHECK_GE(config_->rtp.rtx.payload_type, 0); for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { rtp_rtcp->SetRtxSendPayloadType(config_->rtp.rtx.payload_type, - config_->encoder_settings.payload_type); + payload_type_); rtp_rtcp->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads); } if (config_->rtp.ulpfec.red_payload_type != -1 &&