Update VideoSendStreamImpl for configuration transition.

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 <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22582}
This commit is contained in:
Niels Möller
2018-03-23 13:28:24 +01:00
committed by Commit Bot
parent 9bd1af199b
commit a9d988d175

View File

@ -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<uint32_t, RtpState> suspended_ssrcs_;
std::unique_ptr<FecController> 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 &&