From b5f2c3fbe92ef3f75c5aff287887505b04d0ce63 Mon Sep 17 00:00:00 2001 From: brandtr Date: Tue, 4 Oct 2016 23:28:39 -0700 Subject: [PATCH] Rename FecConfig to UlpfecConfig in config.h. Also rename some related minor methods. No functional changes are intended/expected. BUG=webrtc:5654 Review-Url: https://codereview.webrtc.org/2391963002 Cr-Commit-Position: refs/heads/master@{#14513} --- webrtc/call/call_perf_tests.cc | 9 ++-- webrtc/call/rampup_tests.cc | 12 ++--- webrtc/config.cc | 2 +- webrtc/config.h | 8 +-- webrtc/media/engine/webrtcvideoengine2.cc | 44 ++++++++--------- webrtc/media/engine/webrtcvideoengine2.h | 4 +- .../engine/webrtcvideoengine2_unittest.cc | 32 ++++++------ webrtc/video/end_to_end_tests.cc | 49 ++++++++++--------- webrtc/video/receive_statistics_proxy.cc | 2 +- webrtc/video/receive_statistics_proxy.h | 2 +- webrtc/video/replay.cc | 4 +- webrtc/video/rtp_stream_receiver.cc | 19 ++++--- webrtc/video/send_statistics_proxy.cc | 2 +- .../video/send_statistics_proxy_unittest.cc | 2 +- webrtc/video/video_quality_test.cc | 12 ++--- webrtc/video/video_receive_stream.cc | 2 +- webrtc/video/video_send_stream.cc | 29 +++++------ webrtc/video/video_send_stream_tests.cc | 20 ++++---- webrtc/video_receive_stream.h | 4 +- webrtc/video_send_stream.h | 4 +- 20 files changed, 133 insertions(+), 129 deletions(-) diff --git a/webrtc/call/call_perf_tests.cc b/webrtc/call/call_perf_tests.cc index 5fa9270061..4324d81e80 100644 --- a/webrtc/call/call_perf_tests.cc +++ b/webrtc/call/call_perf_tests.cc @@ -233,10 +233,11 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec, video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; if (fec == FecMode::kOn) { - video_send_config_.rtp.fec.red_payload_type = kRedPayloadType; - video_send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; - video_receive_configs_[0].rtp.fec.red_payload_type = kRedPayloadType; - video_receive_configs_[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; + video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; + video_receive_configs_[0].rtp.ulpfec.red_payload_type = kRedPayloadType; + video_receive_configs_[0].rtp.ulpfec.ulpfec_payload_type = + kUlpfecPayloadType; } video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000; video_receive_configs_[0].renderer = &observer; diff --git a/webrtc/call/rampup_tests.cc b/webrtc/call/rampup_tests.cc index 9c17aae5aa..0199cc8cce 100644 --- a/webrtc/call/rampup_tests.cc +++ b/webrtc/call/rampup_tests.cc @@ -169,9 +169,9 @@ void RampUpTester::ModifyVideoConfigs( send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_; } if (red_) { - send_config->rtp.fec.ulpfec_payload_type = + send_config->rtp.ulpfec.ulpfec_payload_type = test::CallTest::kUlpfecPayloadType; - send_config->rtp.fec.red_payload_type = test::CallTest::kRedPayloadType; + send_config->rtp.ulpfec.red_payload_type = test::CallTest::kRedPayloadType; } size_t i = 0; @@ -184,10 +184,10 @@ void RampUpTester::ModifyVideoConfigs( recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms; if (red_) { - recv_config.rtp.fec.red_payload_type = - send_config->rtp.fec.red_payload_type; - recv_config.rtp.fec.ulpfec_payload_type = - send_config->rtp.fec.ulpfec_payload_type; + recv_config.rtp.ulpfec.red_payload_type = + send_config->rtp.ulpfec.red_payload_type; + recv_config.rtp.ulpfec.ulpfec_payload_type = + send_config->rtp.ulpfec.ulpfec_payload_type; } if (rtx_) { diff --git a/webrtc/config.cc b/webrtc/config.cc index 7c1a0a8bc6..0331c0a833 100644 --- a/webrtc/config.cc +++ b/webrtc/config.cc @@ -22,7 +22,7 @@ std::string NackConfig::ToString() const { return ss.str(); } -std::string FecConfig::ToString() const { +std::string UlpfecConfig::ToString() const { std::stringstream ss; ss << "{ulpfec_payload_type: " << ulpfec_payload_type; ss << ", red_payload_type: " << red_payload_type; diff --git a/webrtc/config.h b/webrtc/config.h index 0231cb5682..a6778715d8 100644 --- a/webrtc/config.h +++ b/webrtc/config.h @@ -35,10 +35,10 @@ struct NackConfig { int rtp_history_ms; }; -// Settings for forward error correction, see RFC 5109 for details. Set the -// payload types to '-1' to disable. -struct FecConfig { - FecConfig() +// Settings for ULPFEC forward error correction. +// Set the payload types to '-1' to disable. +struct UlpfecConfig { + UlpfecConfig() : ulpfec_payload_type(-1), red_payload_type(-1), red_rtx_payload_type(-1) {} diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc index 86bf02855a..4e22a487a2 100644 --- a/webrtc/media/engine/webrtcvideoengine2.cc +++ b/webrtc/media/engine/webrtcvideoengine2.cc @@ -897,13 +897,13 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { if (changed_params.codec) { bool red_was_disabled = red_disabled_by_remote_side_; red_disabled_by_remote_side_ = - changed_params.codec->fec.red_payload_type == -1; + changed_params.codec->ulpfec.red_payload_type == -1; if (red_was_disabled != red_disabled_by_remote_side_) { for (auto& kv : receive_streams_) { // In practice VideoChannel::SetRemoteContent appears to most of the // time also call UpdateRemoteStreams, which recreates the receive // streams. If that's always true this call isn't needed. - kv.second->SetFecDisabledRemotely(red_disabled_by_remote_side_); + kv.second->SetUlpfecDisabledRemotely(red_disabled_by_remote_side_); } } } @@ -1475,8 +1475,8 @@ void WebRtcVideoChannel2::OnPacketReceived( // for these. for (auto& codec : recv_codecs_) { if (payload_type == codec.rtx_payload_type || - payload_type == codec.fec.red_rtx_payload_type || - payload_type == codec.fec.ulpfec_payload_type) { + payload_type == codec.ulpfec.red_rtx_payload_type || + payload_type == codec.ulpfec.ulpfec_payload_type) { return; } } @@ -1846,7 +1846,7 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::SetCodec( parameters_.config.encoder_settings.internal_source = external_encoder_factory_->EncoderTypeHasInternalSource(type); } - parameters_.config.rtp.fec = codec_settings.fec; + parameters_.config.rtp.ulpfec = codec_settings.ulpfec; // Set RTX payload type if RTX is enabled. if (!parameters_.config.rtp.rtx.ssrcs.empty()) { @@ -2394,7 +2394,7 @@ void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ConfigureCodecs( } // TODO(pbos): Reconfigure RTX based on incoming recv_codecs. - config_.rtp.fec = recv_codecs.front().fec; + config_.rtp.ulpfec = recv_codecs.front().ulpfec; config_.rtp.nack.rtp_history_ms = HasNack(recv_codecs.begin()->codec) ? kNackHistoryMs : 0; } @@ -2471,9 +2471,9 @@ void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RecreateWebRtcStream() { } webrtc::VideoReceiveStream::Config config = config_.Copy(); if (red_disabled_by_remote_side_) { - config.rtp.fec.red_payload_type = -1; - config.rtp.fec.ulpfec_payload_type = -1; - config.rtp.fec.red_rtx_payload_type = -1; + config.rtp.ulpfec.red_payload_type = -1; + config.rtp.ulpfec.ulpfec_payload_type = -1; + config.rtp.ulpfec.red_rtx_payload_type = -1; } stream_ = call_->CreateVideoReceiveStream(std::move(config)); stream_->Start(); @@ -2584,7 +2584,7 @@ WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo( return info; } -void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetFecDisabledRemotely( +void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetUlpfecDisabledRemotely( bool disable) { red_disabled_by_remote_side_ = disable; RecreateWebRtcStream(); @@ -2596,9 +2596,9 @@ WebRtcVideoChannel2::VideoCodecSettings::VideoCodecSettings() bool WebRtcVideoChannel2::VideoCodecSettings::operator==( const WebRtcVideoChannel2::VideoCodecSettings& other) const { return codec == other.codec && - fec.ulpfec_payload_type == other.fec.ulpfec_payload_type && - fec.red_payload_type == other.fec.red_payload_type && - fec.red_rtx_payload_type == other.fec.red_rtx_payload_type && + ulpfec.ulpfec_payload_type == other.ulpfec.ulpfec_payload_type && + ulpfec.red_payload_type == other.ulpfec.red_payload_type && + ulpfec.red_rtx_payload_type == other.ulpfec.red_rtx_payload_type && rtx_payload_type == other.rtx_payload_type; } @@ -2617,7 +2617,7 @@ WebRtcVideoChannel2::MapCodecs(const std::vector& codecs) { // |rtx_mapping| maps video payload type to rtx payload type. std::map rtx_mapping; - webrtc::FecConfig fec_settings; + webrtc::UlpfecConfig ulpfec_config; for (size_t i = 0; i < codecs.size(); ++i) { const VideoCodec& in_codec = codecs[i]; @@ -2634,15 +2634,15 @@ WebRtcVideoChannel2::MapCodecs(const std::vector& codecs) { switch (in_codec.GetCodecType()) { case VideoCodec::CODEC_RED: { // RED payload type, should not have duplicates. - RTC_DCHECK(fec_settings.red_payload_type == -1); - fec_settings.red_payload_type = in_codec.id; + RTC_DCHECK(ulpfec_config.red_payload_type == -1); + ulpfec_config.red_payload_type = in_codec.id; continue; } case VideoCodec::CODEC_ULPFEC: { // ULPFEC payload type, should not have duplicates. - RTC_DCHECK(fec_settings.ulpfec_payload_type == -1); - fec_settings.ulpfec_payload_type = in_codec.id; + RTC_DCHECK(ulpfec_config.ulpfec_payload_type == -1); + ulpfec_config.ulpfec_payload_type = in_codec.id; continue; } @@ -2685,16 +2685,16 @@ WebRtcVideoChannel2::MapCodecs(const std::vector& codecs) { return std::vector(); } - if (it->first == fec_settings.red_payload_type) { - fec_settings.red_rtx_payload_type = it->second; + if (it->first == ulpfec_config.red_payload_type) { + ulpfec_config.red_rtx_payload_type = it->second; } } for (size_t i = 0; i < video_codecs.size(); ++i) { - video_codecs[i].fec = fec_settings; + video_codecs[i].ulpfec = ulpfec_config; if (rtx_mapping[video_codecs[i].codec.id] != 0 && rtx_mapping[video_codecs[i].codec.id] != - fec_settings.red_payload_type) { + ulpfec_config.red_payload_type) { video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; } } diff --git a/webrtc/media/engine/webrtcvideoengine2.h b/webrtc/media/engine/webrtcvideoengine2.h index bea1b1785a..4255b2d00e 100644 --- a/webrtc/media/engine/webrtcvideoengine2.h +++ b/webrtc/media/engine/webrtcvideoengine2.h @@ -199,7 +199,7 @@ class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport { bool operator!=(const VideoCodecSettings& other) const; VideoCodec codec; - webrtc::FecConfig fec; + webrtc::UlpfecConfig ulpfec; int rtx_payload_type; }; @@ -438,7 +438,7 @@ class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport { // configured to receive RED. // TODO(holmer): Remove this after a couple of Chrome versions, M53-54 // time frame. - void SetFecDisabledRemotely(bool disable); + void SetUlpfecDisabledRemotely(bool disable); private: struct AllocatedDecoder { diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc index 644a846e59..fd41640451 100644 --- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc +++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc @@ -82,10 +82,10 @@ void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, EXPECT_TRUE(it != rtx_types.end() && it->second == config.rtp.rtx.payload_type); - if (config.rtp.fec.red_rtx_payload_type != -1) { - it = rtx_types.find(config.rtp.fec.red_payload_type); + if (config.rtp.ulpfec.red_rtx_payload_type != -1) { + it = rtx_types.find(config.rtp.ulpfec.red_payload_type); EXPECT_TRUE(it != rtx_types.end() && - it->second == config.rtp.fec.red_rtx_payload_type); + it->second == config.rtp.ulpfec.red_rtx_payload_type); } } } // namespace @@ -2245,8 +2245,8 @@ TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) { // Make sure NACK and FEC are enabled on the correct payload types. EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms); - EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.fec.ulpfec_payload_type); - EXPECT_EQ(default_red_codec_.id, config.rtp.fec.red_payload_type); + EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.ulpfec.ulpfec_payload_type); + EXPECT_EQ(default_red_codec_.id, config.rtp.ulpfec.red_payload_type); EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size()); EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]); @@ -2262,8 +2262,8 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) { FakeVideoSendStream* stream = AddSendStream(); webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); - EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); - EXPECT_EQ(-1, config.rtp.fec.red_payload_type); + EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type); + EXPECT_EQ(-1, config.rtp.ulpfec.red_payload_type); } TEST_F(WebRtcVideoChannel2Test, @@ -2301,14 +2301,14 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFecDisablesFec) { FakeVideoSendStream* stream = AddSendStream(); webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); - EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type); + EXPECT_EQ(kUlpfecCodec.id, config.rtp.ulpfec.ulpfec_payload_type); parameters.codecs.pop_back(); ASSERT_TRUE(channel_->SetSendParameters(parameters)); stream = fake_call_->GetVideoSendStreams()[0]; ASSERT_TRUE(stream != NULL); config = stream->GetConfig().Copy(); - EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type) + EXPECT_EQ(-1, config.rtp.ulpfec.ulpfec_payload_type) << "SetSendCodec without FEC should disable current FEC."; } @@ -2657,20 +2657,22 @@ TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) { FakeVideoReceiveStream* stream = AddRecvStream(); - EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type); + EXPECT_EQ(kUlpfecCodec.id, + stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); cricket::VideoRecvParameters recv_parameters; recv_parameters.codecs.push_back(kVp8Codec); ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); stream = fake_call_->GetVideoReceiveStreams()[0]; ASSERT_TRUE(stream != NULL); - EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type) + EXPECT_EQ(-1, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) << "SetSendCodec without FEC should disable current FEC."; } TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { FakeVideoReceiveStream* stream = AddRecvStream(); - EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type); + EXPECT_EQ(kUlpfecCodec.id, + stream->GetConfig().rtp.ulpfec.ulpfec_payload_type); cricket::VideoRecvParameters recv_parameters; recv_parameters.codecs.push_back(kVp8Codec); @@ -2679,14 +2681,14 @@ TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); stream = fake_call_->GetVideoReceiveStreams()[0]; ASSERT_TRUE(stream != NULL); - EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type) + EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) << "FEC should be enabled on the recieve stream."; cricket::VideoSendParameters send_parameters; send_parameters.codecs.push_back(kVp8Codec); ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); stream = fake_call_->GetVideoReceiveStreams()[0]; - EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type) + EXPECT_EQ(-1, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) << "FEC should have been disabled when we know the other side won't do " "FEC."; @@ -2694,7 +2696,7 @@ TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { send_parameters.codecs.push_back(kUlpfecCodec); ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); stream = fake_call_->GetVideoReceiveStreams()[0]; - EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type) + EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.ulpfec.ulpfec_payload_type) << "FEC should be enabled on the recieve stream."; } diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc index 0e087f1c42..631f4d9cb7 100644 --- a/webrtc/video/end_to_end_tests.cc +++ b/webrtc/video/end_to_end_tests.cc @@ -642,11 +642,11 @@ TEST_F(EndToEndTest, CanReceiveFec) { // int rtp_history_ms = 1000; // (*receive_configs)[0].rtp.nack.rtp_history_ms = rtp_history_ms; // send_config->rtp.nack.rtp_history_ms = rtp_history_ms; - send_config->rtp.fec.red_payload_type = kRedPayloadType; - send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; + send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; - (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; - (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + (*receive_configs)[0].rtp.ulpfec.red_payload_type = kRedPayloadType; + (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; (*receive_configs)[0].renderer = this; } @@ -783,16 +783,16 @@ TEST_F(EndToEndTest, ReceivedFecPacketsNotNacked) { VideoEncoderConfig* encoder_config) override { // Configure hybrid NACK/FEC. send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; - send_config->rtp.fec.red_payload_type = kRedPayloadType; - send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; + send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; // Set codec to VP8, otherwise NACK/FEC hybrid will be disabled. send_config->encoder_settings.encoder = encoder_.get(); send_config->encoder_settings.payload_name = "VP8"; send_config->encoder_settings.payload_type = kFakeVideoSendPayloadType; (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; - (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; - (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + (*receive_configs)[0].rtp.ulpfec.red_payload_type = kRedPayloadType; + (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; (*receive_configs)[0].decoders.resize(1); (*receive_configs)[0].decoders[0].payload_type = @@ -904,16 +904,16 @@ void EndToEndTest::DecodesRetransmittedFrame(bool enable_rtx, bool enable_red) { (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; if (payload_type_ == kRedPayloadType) { - send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; - send_config->rtp.fec.red_payload_type = kRedPayloadType; + send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; + send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; if (retransmission_ssrc_ == kSendRtxSsrcs[0]) - send_config->rtp.fec.red_rtx_payload_type = kRtxRedPayloadType; - (*receive_configs)[0].rtp.fec.ulpfec_payload_type = - send_config->rtp.fec.ulpfec_payload_type; - (*receive_configs)[0].rtp.fec.red_payload_type = - send_config->rtp.fec.red_payload_type; - (*receive_configs)[0].rtp.fec.red_rtx_payload_type = - send_config->rtp.fec.red_rtx_payload_type; + send_config->rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType; + (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = + send_config->rtp.ulpfec.ulpfec_payload_type; + (*receive_configs)[0].rtp.ulpfec.red_payload_type = + send_config->rtp.ulpfec.red_payload_type; + (*receive_configs)[0].rtp.ulpfec.red_rtx_payload_type = + send_config->rtp.ulpfec.red_rtx_payload_type; } if (retransmission_ssrc_ == kSendRtxSsrcs[0]) { @@ -2162,13 +2162,14 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx, (*receive_configs)[0].renderer = this; // FEC if (use_red_) { - send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; - send_config->rtp.fec.red_payload_type = kRedPayloadType; + send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; + send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; send_config->encoder_settings.encoder = vp8_encoder_.get(); send_config->encoder_settings.payload_name = "VP8"; (*receive_configs)[0].decoders[0].payload_name = "VP8"; - (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; - (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + (*receive_configs)[0].rtp.ulpfec.red_payload_type = kRedPayloadType; + (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = + kUlpfecPayloadType; } // RTX if (use_rtx_) { @@ -3715,7 +3716,7 @@ void VerifyEmptyNackConfig(const NackConfig& config) { << "Enabling NACK requires rtcp-fb: nack negotiation."; } -void VerifyEmptyFecConfig(const FecConfig& config) { +void VerifyEmptyUlpfecConfig(const UlpfecConfig& config) { EXPECT_EQ(-1, config.ulpfec_payload_type) << "Enabling FEC requires rtpmap: ulpfec negotiation."; EXPECT_EQ(-1, config.red_payload_type) @@ -3734,7 +3735,7 @@ TEST_F(EndToEndTest, VerifyDefaultSendConfigParameters) { << "Enabling RTP extensions require negotiation."; VerifyEmptyNackConfig(default_send_config.rtp.nack); - VerifyEmptyFecConfig(default_send_config.rtp.fec); + VerifyEmptyUlpfecConfig(default_send_config.rtp.ulpfec); } TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { @@ -3752,7 +3753,7 @@ TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { << "Enabling RTP extensions require negotiation."; VerifyEmptyNackConfig(default_receive_config.rtp.nack); - VerifyEmptyFecConfig(default_receive_config.rtp.fec); + VerifyEmptyUlpfecConfig(default_receive_config.rtp.ulpfec); } TEST_F(EndToEndTest, TransportSeqNumOnAudioAndVideo) { diff --git a/webrtc/video/receive_statistics_proxy.cc b/webrtc/video/receive_statistics_proxy.cc index e4be1cc43c..d4a0df371d 100644 --- a/webrtc/video/receive_statistics_proxy.cc +++ b/webrtc/video/receive_statistics_proxy.cc @@ -131,7 +131,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() { static_cast(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000)); } - if (config_.rtp.fec.ulpfec_payload_type != -1) { + if (config_.rtp.ulpfec.ulpfec_payload_type != -1) { RTC_HISTOGRAM_COUNTS_10000( "WebRTC.Video.FecBitrateReceivedInKbps", static_cast(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); diff --git a/webrtc/video/receive_statistics_proxy.h b/webrtc/video/receive_statistics_proxy.h index 4c6caf0daa..04777716af 100644 --- a/webrtc/video/receive_statistics_proxy.h +++ b/webrtc/video/receive_statistics_proxy.h @@ -99,7 +99,7 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, // Ownership of this object lies with the owner of the ReceiveStatisticsProxy // instance. Lifetime is guaranteed to outlive |this|. // TODO(tommi): In practice the config_ reference is only used for accessing - // config_.rtp.fec.ulpfec_payload_type. Instead of holding a pointer back, + // config_.rtp.ulpfec.ulpfec_payload_type. Instead of holding a pointer back, // we could just store the value of ulpfec_payload_type and change the // ReceiveStatisticsProxy() ctor to accept a const& of Config (since we'll // then no longer store a pointer to the object). diff --git a/webrtc/video/replay.cc b/webrtc/video/replay.cc index d88d6b394e..c00fe337af 100644 --- a/webrtc/video/replay.cc +++ b/webrtc/video/replay.cc @@ -217,8 +217,8 @@ void RtpReplay() { VideoReceiveStream::Config receive_config(&transport); receive_config.rtp.remote_ssrc = flags::Ssrc(); receive_config.rtp.local_ssrc = kReceiverLocalSsrc; - receive_config.rtp.fec.ulpfec_payload_type = flags::FecPayloadType(); - receive_config.rtp.fec.red_payload_type = flags::RedPayloadType(); + receive_config.rtp.ulpfec.ulpfec_payload_type = flags::FecPayloadType(); + receive_config.rtp.ulpfec.red_payload_type = flags::RedPayloadType(); receive_config.rtp.nack.rtp_history_ms = 1000; if (flags::TransmissionOffsetId() != -1) { receive_config.rtp.extensions.push_back(RtpExtension( diff --git a/webrtc/video/rtp_stream_receiver.cc b/webrtc/video/rtp_stream_receiver.cc index fc299701f8..984cc0ec2d 100644 --- a/webrtc/video/rtp_stream_receiver.cc +++ b/webrtc/video/rtp_stream_receiver.cc @@ -165,23 +165,22 @@ RtpStreamReceiver::RtpStreamReceiver( VideoCodec ulpfec_codec = {}; ulpfec_codec.codecType = kVideoCodecULPFEC; strncpy(ulpfec_codec.plName, "ulpfec", sizeof(ulpfec_codec.plName)); - ulpfec_codec.plType = config_.rtp.fec.ulpfec_payload_type; + ulpfec_codec.plType = config_.rtp.ulpfec.ulpfec_payload_type; RTC_CHECK(SetReceiveCodec(ulpfec_codec)); VideoCodec red_codec = {}; red_codec.codecType = kVideoCodecRED; strncpy(red_codec.plName, "red", sizeof(red_codec.plName)); - red_codec.plType = config_.rtp.fec.red_payload_type; + red_codec.plType = config_.rtp.ulpfec.red_payload_type; RTC_CHECK(SetReceiveCodec(red_codec)); - if (config_.rtp.fec.red_rtx_payload_type != -1) { + if (config_.rtp.ulpfec.red_rtx_payload_type != -1) { rtp_payload_registry_.SetRtxPayloadType( - config_.rtp.fec.red_rtx_payload_type, - config_.rtp.fec.red_payload_type); + config_.rtp.ulpfec.red_rtx_payload_type, + config_.rtp.ulpfec.red_payload_type); } - rtp_rtcp_->SetGenericFECStatus(true, - config_.rtp.fec.red_payload_type, - config_.rtp.fec.ulpfec_payload_type); + rtp_rtcp_->SetGenericFECStatus(true, config_.rtp.ulpfec.red_payload_type, + config_.rtp.ulpfec.ulpfec_payload_type); } if (config_.rtp.rtcp_xr.receiver_reference_time_report) @@ -338,8 +337,8 @@ int32_t RtpStreamReceiver::SliceLossIndicationRequest( } bool RtpStreamReceiver::IsFecEnabled() const { - return config_.rtp.fec.red_payload_type != -1 && - config_.rtp.fec.ulpfec_payload_type != -1; + return config_.rtp.ulpfec.red_payload_type != -1 && + config_.rtp.ulpfec.ulpfec_payload_type != -1; } bool RtpStreamReceiver::IsRetransmissionsEnabled() const { diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 039e039354..be58e3ed3d 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -329,7 +329,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( static_cast(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000)); } - if (rtp_config.fec.red_payload_type != -1) { + if (rtp_config.ulpfec.red_payload_type != -1) { RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "FecBitrateSentInKbps", static_cast(rtp_rtx.fec.TotalBytes() * diff --git a/webrtc/video/send_statistics_proxy_unittest.cc b/webrtc/video/send_statistics_proxy_unittest.cc index 46a984b414..73e98cffb7 100644 --- a/webrtc/video/send_statistics_proxy_unittest.cc +++ b/webrtc/video/send_statistics_proxy_unittest.cc @@ -57,7 +57,7 @@ class SendStatisticsProxyTest : public ::testing::Test { config.rtp.ssrcs.push_back(kSecondSsrc); config.rtp.rtx.ssrcs.push_back(kFirstRtxSsrc); config.rtp.rtx.ssrcs.push_back(kSecondRtxSsrc); - config.rtp.fec.red_payload_type = 17; + config.rtp.ulpfec.red_payload_type = 17; return config; } diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc index 4ac86d1a15..9adcc16206 100644 --- a/webrtc/video/video_quality_test.cc +++ b/webrtc/video/video_quality_test.cc @@ -1293,12 +1293,12 @@ void VideoQualityTest::RunWithRenderers(const Params& params) { params_.common.suspend_below_min_bitrate; if (params.common.fec) { - video_send_config_.rtp.fec.red_payload_type = kRedPayloadType; - video_send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; - video_receive_configs_[stream_id].rtp.fec.red_payload_type = - kRedPayloadType; - video_receive_configs_[stream_id].rtp.fec.ulpfec_payload_type = - kUlpfecPayloadType; + video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; + video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; + video_receive_configs_[stream_id].rtp.ulpfec.red_payload_type = + kRedPayloadType; + video_receive_configs_[stream_id].rtp.ulpfec.ulpfec_payload_type = + kUlpfecPayloadType; } if (params_.screenshare.enabled) diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc index f7daed34d8..2b4a3c2b7b 100644 --- a/webrtc/video/video_receive_stream.cc +++ b/webrtc/video/video_receive_stream.cc @@ -94,7 +94,7 @@ std::string VideoReceiveStream::Config::Rtp::ToString() const { ss << ", remb: " << (remb ? "on" : "off"); ss << ", transport_cc: " << (transport_cc ? "on" : "off"); ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}'; - ss << ", fec: " << fec.ToString(); + ss << ", ulpfec: " << ulpfec.ToString(); ss << ", rtx: {"; for (auto& kv : rtx) { ss << kv.first << " -> "; diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc index 3ff85d4f63..2ba5c890a2 100644 --- a/webrtc/video/video_send_stream.cc +++ b/webrtc/video/video_send_stream.cc @@ -132,7 +132,7 @@ std::string VideoSendStream::Config::Rtp::ToString() const { ss << ']'; ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}'; - ss << ", fec: " << fec.ToString(); + ss << ", ulpfec: " << ulpfec.ToString(); ss << ", rtx: " << rtx.ToString(); ss << ", c_name: " << c_name; ss << '}'; @@ -922,7 +922,7 @@ void VideoSendStreamImpl::ConfigureProtection() { RTC_DCHECK_RUN_ON(worker_queue_); // Enable NACK, FEC or both. const bool enable_protection_nack = config_->rtp.nack.rtp_history_ms > 0; - bool enable_protection_fec = config_->rtp.fec.ulpfec_payload_type != -1; + bool enable_protection_fec = config_->rtp.ulpfec.ulpfec_payload_type != -1; // Payload types without picture ID cannot determine that a stream is complete // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is // a waste of bandwidth since FEC packets still have to be transmitted. Note @@ -943,21 +943,22 @@ void VideoSendStreamImpl::ConfigureProtection() { // TODO(changbin): Should set RTX for RED mapping in RTP sender in future. // Validate payload types. If either RED or FEC payload types are set then // both should be. If FEC is enabled then they both have to be set. - if (config_->rtp.fec.red_payload_type != -1) { - RTC_DCHECK_GE(config_->rtp.fec.red_payload_type, 0); - RTC_DCHECK_LE(config_->rtp.fec.red_payload_type, 127); + if (config_->rtp.ulpfec.red_payload_type != -1) { + RTC_DCHECK_GE(config_->rtp.ulpfec.red_payload_type, 0); + RTC_DCHECK_LE(config_->rtp.ulpfec.red_payload_type, 127); // TODO(holmer): We should only enable red if ulpfec is also enabled, but // but due to an incompatibility issue with previous versions the receiver // assumes rtx packets are containing red if it has been configured to // receive red. Remove this in a few versions once the incompatibility // issue is resolved (M53 timeframe). - payload_type_red = static_cast(config_->rtp.fec.red_payload_type); + payload_type_red = + static_cast(config_->rtp.ulpfec.red_payload_type); } - if (config_->rtp.fec.ulpfec_payload_type != -1) { - RTC_DCHECK_GE(config_->rtp.fec.ulpfec_payload_type, 0); - RTC_DCHECK_LE(config_->rtp.fec.ulpfec_payload_type, 127); + if (config_->rtp.ulpfec.ulpfec_payload_type != -1) { + RTC_DCHECK_GE(config_->rtp.ulpfec.ulpfec_payload_type, 0); + RTC_DCHECK_LE(config_->rtp.ulpfec.ulpfec_payload_type, 127); payload_type_fec = - static_cast(config_->rtp.fec.ulpfec_payload_type); + static_cast(config_->rtp.ulpfec.ulpfec_payload_type); } for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { @@ -1012,11 +1013,11 @@ void VideoSendStreamImpl::ConfigureSsrcs() { config_->encoder_settings.payload_type); rtp_rtcp->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads); } - if (config_->rtp.fec.red_payload_type != -1 && - config_->rtp.fec.red_rtx_payload_type != -1) { + if (config_->rtp.ulpfec.red_payload_type != -1 && + config_->rtp.ulpfec.red_rtx_payload_type != -1) { for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { - rtp_rtcp->SetRtxSendPayloadType(config_->rtp.fec.red_rtx_payload_type, - config_->rtp.fec.red_payload_type); + rtp_rtcp->SetRtxSendPayloadType(config_->rtp.ulpfec.red_rtx_payload_type, + config_->rtp.ulpfec.red_payload_type); } } } diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc index e6aabb9c89..dd8513fa00 100644 --- a/webrtc/video/video_send_stream_tests.cc +++ b/webrtc/video/video_send_stream_tests.cc @@ -429,10 +429,10 @@ class FecObserver : public test::EndToEndTest { } send_config->encoder_settings.encoder = encoder_.get(); send_config->encoder_settings.payload_name = payload_name_; - send_config->rtp.fec.red_payload_type = - VideoSendStreamTest::kRedPayloadType; - send_config->rtp.fec.ulpfec_payload_type = - VideoSendStreamTest::kUlpfecPayloadType; + send_config->rtp.ulpfec.red_payload_type = + VideoSendStreamTest::kRedPayloadType; + send_config->rtp.ulpfec.ulpfec_payload_type = + VideoSendStreamTest::kUlpfecPayloadType; if (header_extensions_enabled_) { send_config->rtp.extensions.push_back(RtpExtension( RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); @@ -440,10 +440,10 @@ class FecObserver : public test::EndToEndTest { RtpExtension(RtpExtension::kTransportSequenceNumberUri, test::kTransportSequenceNumberExtensionId)); } - (*receive_configs)[0].rtp.fec.red_payload_type = - send_config->rtp.fec.red_payload_type; - (*receive_configs)[0].rtp.fec.ulpfec_payload_type = - send_config->rtp.fec.ulpfec_payload_type; + (*receive_configs)[0].rtp.ulpfec.red_payload_type = + send_config->rtp.ulpfec.red_payload_type; + (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = + send_config->rtp.ulpfec.ulpfec_payload_type; } void PerformTest() override { @@ -749,8 +749,8 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format, new internal::TransportAdapter(send_config->send_transport)); transport_adapter_->Enable(); if (use_fec_) { - send_config->rtp.fec.red_payload_type = kRedPayloadType; - send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; + send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; + send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; } if (!test_generic_packetization_) diff --git a/webrtc/video_receive_stream.h b/webrtc/video_receive_stream.h index eb6f8b85bf..307b0a14e3 100644 --- a/webrtc/video_receive_stream.h +++ b/webrtc/video_receive_stream.h @@ -134,8 +134,8 @@ class VideoReceiveStream { // See NackConfig for description. NackConfig nack; - // See FecConfig for description. - FecConfig fec; + // See UlpfecConfig for description. + UlpfecConfig ulpfec; // RTX settings for incoming video payloads that may be received. RTX is // disabled if there's no config present. diff --git a/webrtc/video_send_stream.h b/webrtc/video_send_stream.h index 7ac4c37324..43283a55da 100644 --- a/webrtc/video_send_stream.h +++ b/webrtc/video_send_stream.h @@ -129,8 +129,8 @@ class VideoSendStream { // See NackConfig for description. NackConfig nack; - // See FecConfig for description. - FecConfig fec; + // See UlpfecConfig for description. + UlpfecConfig ulpfec; // Settings for RTP retransmission payload format, see RFC 4588 for // details.