diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/libwebrtc/call | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/call')
11 files changed, 153 insertions, 158 deletions
diff --git a/third_party/libwebrtc/call/BUILD.gn b/third_party/libwebrtc/call/BUILD.gn index 50a8257631..985a3a4e04 100644 --- a/third_party/libwebrtc/call/BUILD.gn +++ b/third_party/libwebrtc/call/BUILD.gn @@ -121,6 +121,7 @@ rtc_library("rtp_interfaces") { "../api/crypto:options", "../api/environment", "../api/rtc_event_log", + "../api/transport:bandwidth_estimation_settings", "../api/transport:bitrate_settings", "../api/transport:network_control", "../api/units:time_delta", @@ -495,6 +496,7 @@ if (rtc_include_tests) { "../api:array_view", "../api:create_frame_generator", "../api:mock_audio_mixer", + "../api:mock_frame_transformer", "../api:rtp_headers", "../api:rtp_parameters", "../api:transport_api", @@ -539,7 +541,6 @@ if (rtc_include_tests) { "../test:fake_video_codecs", "../test:field_trial", "../test:frame_generator_capturer", - "../test:mock_frame_transformer", "../test:mock_transport", "../test:run_loop", "../test:scoped_key_value_config", diff --git a/third_party/libwebrtc/call/rtp_transport_controller_send.cc b/third_party/libwebrtc/call/rtp_transport_controller_send.cc index 600d4e2620..32c4addfb9 100644 --- a/third_party/libwebrtc/call/rtp_transport_controller_send.cc +++ b/third_party/libwebrtc/call/rtp_transport_controller_send.cc @@ -159,6 +159,37 @@ void RtpTransportControllerSend::DestroyRtpVideoSender( video_rtp_senders_.erase(it); } +void RtpTransportControllerSend::RegisterSendingRtpStream( + RtpRtcpInterface& rtp_module) { + RTC_DCHECK_RUN_ON(&sequence_checker_); + // Allow pacer to send packets using this module. + packet_router_.AddSendRtpModule(&rtp_module, + /*remb_candidate=*/true); + pacer_.SetAllowProbeWithoutMediaPacket( + bwe_settings_.allow_probe_without_media && + packet_router_.SupportsRtxPayloadPadding()); +} + +void RtpTransportControllerSend::DeRegisterSendingRtpStream( + RtpRtcpInterface& rtp_module) { + RTC_DCHECK_RUN_ON(&sequence_checker_); + // Disabling media, remove from packet router map to reduce size and + // prevent any stray packets in the pacer from asynchronously arriving + // to a disabled module. + packet_router_.RemoveSendRtpModule(&rtp_module); + // Clear the pacer queue of any packets pertaining to this module. + pacer_.RemovePacketsForSsrc(rtp_module.SSRC()); + if (rtp_module.RtxSsrc().has_value()) { + pacer_.RemovePacketsForSsrc(*rtp_module.RtxSsrc()); + } + if (rtp_module.FlexfecSsrc().has_value()) { + pacer_.RemovePacketsForSsrc(*rtp_module.FlexfecSsrc()); + } + pacer_.SetAllowProbeWithoutMediaPacket( + bwe_settings_.allow_probe_without_media && + packet_router_.SupportsRtxPayloadPadding()); +} + void RtpTransportControllerSend::UpdateControlState() { absl::optional<TargetTransferRate> update = control_handler_->GetUpdate(); if (!update) @@ -224,6 +255,29 @@ RtpTransportControllerSend::GetStreamFeedbackProvider() { return &feedback_demuxer_; } +void RtpTransportControllerSend::ReconfigureBandwidthEstimation( + const BandwidthEstimationSettings& settings) { + RTC_DCHECK_RUN_ON(&sequence_checker_); + bwe_settings_ = settings; + + if (controller_) { + // Recreate the controller and handler. + control_handler_ = nullptr; + controller_ = nullptr; + // The BWE controller is created when/if the network is available. + MaybeCreateControllers(); + if (controller_) { + BitrateConstraints constraints = bitrate_configurator_.GetConfig(); + UpdateBitrateConstraints(constraints); + UpdateStreamsConfig(); + UpdateNetworkAvailability(); + } + } + pacer_.SetAllowProbeWithoutMediaPacket( + bwe_settings_.allow_probe_without_media && + packet_router_.SupportsRtxPayloadPadding()); +} + void RtpTransportControllerSend::RegisterTargetTransferRateObserver( TargetTransferRateObserver* observer) { RTC_DCHECK_RUN_ON(&sequence_checker_); @@ -325,9 +379,6 @@ void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) { RTC_DCHECK_RUN_ON(&sequence_checker_); RTC_LOG(LS_VERBOSE) << "SignalNetworkState " << (network_available ? "Up" : "Down"); - NetworkAvailability msg; - msg.at_time = Timestamp::Millis(env_.clock().TimeInMilliseconds()); - msg.network_available = network_available; network_available_ = network_available; if (network_available) { pacer_.Resume(); @@ -340,11 +391,7 @@ void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) { if (!controller_) { MaybeCreateControllers(); } - if (controller_) { - control_handler_->SetNetworkAvailability(network_available); - PostUpdates(controller_->OnNetworkAvailability(msg)); - UpdateControlState(); - } + UpdateNetworkAvailability(); for (auto& rtp_sender : video_rtp_senders_) { rtp_sender->OnNetworkAvailability(network_available); } @@ -587,6 +634,18 @@ void RtpTransportControllerSend::MaybeCreateControllers() { StartProcessPeriodicTasks(); } +void RtpTransportControllerSend::UpdateNetworkAvailability() { + if (!controller_) { + return; + } + NetworkAvailability msg; + msg.at_time = Timestamp::Millis(env_.clock().TimeInMilliseconds()); + msg.network_available = network_available_; + control_handler_->SetNetworkAvailability(network_available_); + PostUpdates(controller_->OnNetworkAvailability(msg)); + UpdateControlState(); +} + void RtpTransportControllerSend::UpdateInitialConstraints( TargetRateConstraints new_contraints) { if (!new_contraints.starting_rate) diff --git a/third_party/libwebrtc/call/rtp_transport_controller_send.h b/third_party/libwebrtc/call/rtp_transport_controller_send.h index c0bca41a2b..4428336672 100644 --- a/third_party/libwebrtc/call/rtp_transport_controller_send.h +++ b/third_party/libwebrtc/call/rtp_transport_controller_send.h @@ -75,6 +75,8 @@ class RtpTransportControllerSend final RtpVideoSenderInterface* rtp_video_sender) override; // Implements RtpTransportControllerSendInterface + void RegisterSendingRtpStream(RtpRtcpInterface& rtp_module) override; + void DeRegisterSendingRtpStream(RtpRtcpInterface& rtp_module) override; PacketRouter* packet_router() override; NetworkStateEstimateObserver* network_state_estimate_observer() override; @@ -82,6 +84,8 @@ class RtpTransportControllerSend final RtpPacketSender* packet_sender() override; void SetAllocatedSendBitrateLimits(BitrateAllocationLimits limits) override; + void ReconfigureBandwidthEstimation( + const BandwidthEstimationSettings& settings) override; void SetPacingFactor(float pacing_factor) override; void SetQueueTimeLimit(int limit_ms) override; @@ -125,6 +129,7 @@ class RtpTransportControllerSend final private: void MaybeCreateControllers() RTC_RUN_ON(sequence_checker_); + void UpdateNetworkAvailability() RTC_RUN_ON(sequence_checker_); void UpdateInitialConstraints(TargetRateConstraints new_contraints) RTC_RUN_ON(sequence_checker_); @@ -155,6 +160,7 @@ class RtpTransportControllerSend final RtpBitrateConfigurator bitrate_configurator_; std::map<std::string, rtc::NetworkRoute> network_routes_ RTC_GUARDED_BY(sequence_checker_); + BandwidthEstimationSettings bwe_settings_ RTC_GUARDED_BY(sequence_checker_); bool pacer_started_ RTC_GUARDED_BY(sequence_checker_); TaskQueuePacedSender pacer_; diff --git a/third_party/libwebrtc/call/rtp_transport_controller_send_interface.h b/third_party/libwebrtc/call/rtp_transport_controller_send_interface.h index 7edc135037..c4b1536bad 100644 --- a/third_party/libwebrtc/call/rtp_transport_controller_send_interface.h +++ b/third_party/libwebrtc/call/rtp_transport_controller_send_interface.h @@ -24,6 +24,7 @@ #include "api/fec_controller.h" #include "api/frame_transformer_interface.h" #include "api/rtc_event_log/rtc_event_log.h" +#include "api/transport/bandwidth_estimation_settings.h" #include "api/transport/bitrate_settings.h" #include "api/units/timestamp.h" #include "call/rtp_config.h" @@ -47,6 +48,7 @@ class Transport; class PacketRouter; class RtpVideoSenderInterface; class RtpPacketSender; +class RtpRtcpInterface; struct RtpSenderObservers { RtcpRttStats* rtcp_rtt_stats; @@ -108,6 +110,12 @@ class RtpTransportControllerSendInterface { virtual void DestroyRtpVideoSender( RtpVideoSenderInterface* rtp_video_sender) = 0; + // Register a specific RTP stream as sending. This means that the pacer and + // packet router can send packets using this RTP stream. + virtual void RegisterSendingRtpStream(RtpRtcpInterface& rtp_module) = 0; + // Pacer and PacketRouter stop using this RTP stream. + virtual void DeRegisterSendingRtpStream(RtpRtcpInterface& rtp_module) = 0; + virtual NetworkStateEstimateObserver* network_state_estimate_observer() = 0; virtual TransportFeedbackObserver* transport_feedback_observer() = 0; @@ -118,6 +126,9 @@ class RtpTransportControllerSendInterface { virtual void SetAllocatedSendBitrateLimits( BitrateAllocationLimits limits) = 0; + virtual void ReconfigureBandwidthEstimation( + const BandwidthEstimationSettings& settings) = 0; + virtual void SetPacingFactor(float pacing_factor) = 0; virtual void SetQueueTimeLimit(int limit_ms) = 0; diff --git a/third_party/libwebrtc/call/rtp_video_sender.cc b/third_party/libwebrtc/call/rtp_video_sender.cc index 4d99c61bb4..ac5540a7f2 100644 --- a/third_party/libwebrtc/call/rtp_video_sender.cc +++ b/third_party/libwebrtc/call/rtp_video_sender.cc @@ -470,86 +470,42 @@ RtpVideoSender::RtpVideoSender( } RtpVideoSender::~RtpVideoSender() { - // TODO(bugs.webrtc.org/13517): Remove once RtpVideoSender gets deleted on the - // transport task queue. - transport_checker_.Detach(); - + RTC_DCHECK_RUN_ON(&transport_checker_); SetActiveModulesLocked( - std::vector<bool>(rtp_streams_.size(), /*active=*/false)); - - RTC_DCHECK(!registered_for_feedback_); + /*sending=*/false); } -void RtpVideoSender::Stop() { +void RtpVideoSender::SetSending(bool enabled) { RTC_DCHECK_RUN_ON(&transport_checker_); MutexLock lock(&mutex_); - if (!active_) + if (enabled == active_) { return; - - const std::vector<bool> active_modules(rtp_streams_.size(), false); - SetActiveModulesLocked(active_modules); -} - -void RtpVideoSender::SetActiveModules(const std::vector<bool>& active_modules) { - RTC_DCHECK_RUN_ON(&transport_checker_); - MutexLock lock(&mutex_); - return SetActiveModulesLocked(active_modules); + } + SetActiveModulesLocked(/*sending=*/enabled); } -void RtpVideoSender::SetActiveModulesLocked( - const std::vector<bool>& active_modules) { +void RtpVideoSender::SetActiveModulesLocked(bool sending) { RTC_DCHECK_RUN_ON(&transport_checker_); - RTC_CHECK_EQ(rtp_streams_.size(), active_modules.size()); - active_ = false; - for (size_t i = 0; i < active_modules.size(); ++i) { - if (active_modules[i]) { - active_ = true; - } - + if (active_ == sending) { + return; + } + active_ = sending; + for (size_t i = 0; i < rtp_streams_.size(); ++i) { RtpRtcpInterface& rtp_module = *rtp_streams_[i].rtp_rtcp; - const bool was_active = rtp_module.Sending(); - const bool should_be_active = active_modules[i]; - // Sends a kRtcpByeCode when going from true to false. - rtp_module.SetSendingStatus(active_modules[i]); - - if (was_active && !should_be_active) { - // Disabling media, remove from packet router map to reduce size and - // prevent any stray packets in the pacer from asynchronously arriving - // to a disabled module. - transport_->packet_router()->RemoveSendRtpModule(&rtp_module); - - // Clear the pacer queue of any packets pertaining to this module. - transport_->packet_sender()->RemovePacketsForSsrc(rtp_module.SSRC()); - if (rtp_module.RtxSsrc().has_value()) { - transport_->packet_sender()->RemovePacketsForSsrc( - *rtp_module.RtxSsrc()); - } - if (rtp_module.FlexfecSsrc().has_value()) { - transport_->packet_sender()->RemovePacketsForSsrc( - *rtp_module.FlexfecSsrc()); - } - } - - // If set to false this module won't send media. - rtp_module.SetSendingMediaStatus(active_modules[i]); - - if (!was_active && should_be_active) { - // Turning on media, register with packet router. - transport_->packet_router()->AddSendRtpModule(&rtp_module, - /*remb_candidate=*/true); + rtp_module.SetSendingStatus(sending); + rtp_module.SetSendingMediaStatus(sending); + if (sending) { + transport_->RegisterSendingRtpStream(rtp_module); + } else { + transport_->DeRegisterSendingRtpStream(rtp_module); } } - if (!active_) { - auto* feedback_provider = transport_->GetStreamFeedbackProvider(); - if (registered_for_feedback_) { - feedback_provider->DeRegisterStreamFeedbackObserver(this); - registered_for_feedback_ = false; - } - } else if (!registered_for_feedback_) { - auto* feedback_provider = transport_->GetStreamFeedbackProvider(); + auto* feedback_provider = transport_->GetStreamFeedbackProvider(); + if (!sending) { + feedback_provider->DeRegisterStreamFeedbackObserver(this); + } else { feedback_provider->RegisterStreamFeedbackObserver(rtp_config_.ssrcs, this); - registered_for_feedback_ = true; } } diff --git a/third_party/libwebrtc/call/rtp_video_sender.h b/third_party/libwebrtc/call/rtp_video_sender.h index 10b0d19d05..957b46e560 100644 --- a/third_party/libwebrtc/call/rtp_video_sender.h +++ b/third_party/libwebrtc/call/rtp_video_sender.h @@ -95,11 +95,7 @@ class RtpVideoSender : public RtpVideoSenderInterface, RtpVideoSender(const RtpVideoSender&) = delete; RtpVideoSender& operator=(const RtpVideoSender&) = delete; - // Sets the sending status of the rtp modules and appropriately sets the - // payload router to active if any rtp modules are active. - void SetActiveModules(const std::vector<bool>& active_modules) - RTC_LOCKS_EXCLUDED(mutex_) override; - void Stop() RTC_LOCKS_EXCLUDED(mutex_) override; + void SetSending(bool enabled) RTC_LOCKS_EXCLUDED(mutex_) override; bool IsActive() RTC_LOCKS_EXCLUDED(mutex_) override; void OnNetworkAvailability(bool network_available) @@ -160,7 +156,7 @@ class RtpVideoSender : public RtpVideoSenderInterface, private: bool IsActiveLocked() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - void SetActiveModulesLocked(const std::vector<bool>& active_modules) + void SetActiveModulesLocked(bool sending) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void UpdateModuleSendingState() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void ConfigureProtection(); @@ -184,7 +180,6 @@ class RtpVideoSender : public RtpVideoSenderInterface, // transport task queue. mutable Mutex mutex_; bool active_ RTC_GUARDED_BY(mutex_); - bool registered_for_feedback_ RTC_GUARDED_BY(transport_checker_) = false; const std::unique_ptr<FecController> fec_controller_; bool fec_allowed_ RTC_GUARDED_BY(mutex_); diff --git a/third_party/libwebrtc/call/rtp_video_sender_interface.h b/third_party/libwebrtc/call/rtp_video_sender_interface.h index 3f2877155a..6bbcb7f46e 100644 --- a/third_party/libwebrtc/call/rtp_video_sender_interface.h +++ b/third_party/libwebrtc/call/rtp_video_sender_interface.h @@ -31,12 +31,8 @@ struct FecProtectionParams; class RtpVideoSenderInterface : public EncodedImageCallback, public FecControllerOverride { public: - // Sets the sending status of the rtp modules and appropriately sets the - // RtpVideoSender to active if any rtp modules are active. - // A module will only send packet if beeing active. - virtual void SetActiveModules(const std::vector<bool>& active_modules) = 0; - // Set the sending status of all rtp modules to inactive. - virtual void Stop() = 0; + // Sets weather or not RTP packets is allowed to be sent on this sender. + virtual void SetSending(bool enabled) = 0; virtual bool IsActive() = 0; virtual void OnNetworkAvailability(bool network_available) = 0; diff --git a/third_party/libwebrtc/call/rtp_video_sender_unittest.cc b/third_party/libwebrtc/call/rtp_video_sender_unittest.cc index cf099afaa3..cd525f0d61 100644 --- a/third_party/libwebrtc/call/rtp_video_sender_unittest.cc +++ b/third_party/libwebrtc/call/rtp_video_sender_unittest.cc @@ -18,6 +18,7 @@ #include "absl/functional/any_invocable.h" #include "api/environment/environment.h" #include "api/environment/environment_factory.h" +#include "api/test/mock_frame_transformer.h" #include "call/rtp_transport_controller_send.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/byte_io.h" @@ -29,7 +30,6 @@ #include "rtc_base/rate_limiter.h" #include "test/gmock.h" #include "test/gtest.h" -#include "test/mock_frame_transformer.h" #include "test/mock_transport.h" #include "test/scenario/scenario.h" #include "test/scoped_key_value_config.h" @@ -180,17 +180,13 @@ class RtpVideoSenderTestFixture { /*frame_transformer=*/nullptr, field_trials) {} - ~RtpVideoSenderTestFixture() { Stop(); } + ~RtpVideoSenderTestFixture() { SetSending(false); } RtpVideoSender* router() { return router_.get(); } MockTransport& transport() { return transport_; } void AdvanceTime(TimeDelta delta) { time_controller_.AdvanceTime(delta); } - void Stop() { router_->Stop(); } - - void SetActiveModules(const std::vector<bool>& active_modules) { - router_->SetActiveModules(active_modules); - } + void SetSending(bool sending) { router_->SetSending(sending); } private: test::ScopedKeyValueConfig field_trials_; @@ -227,20 +223,20 @@ TEST(RtpVideoSenderTest, SendOnOneModule) { EXPECT_NE(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image, nullptr).error); - test.SetActiveModules({true}); + test.SetSending(true); EXPECT_EQ(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image, nullptr).error); - test.SetActiveModules({false}); + test.SetSending(false); EXPECT_NE(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image, nullptr).error); - test.SetActiveModules({true}); + test.SetSending(true); EXPECT_EQ(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image, nullptr).error); } -TEST(RtpVideoSenderTest, SendSimulcastSetActive) { +TEST(RtpVideoSenderTest, OnEncodedImageReturnOkWhenSendingTrue) { constexpr uint8_t kPayload = 'a'; EncodedImage encoded_image_1; encoded_image_1.SetRtpTimestamp(1); @@ -254,7 +250,7 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActive) { CodecSpecificInfo codec_info; codec_info.codecType = kVideoCodecVP8; - test.SetActiveModules({true, true}); + test.SetSending(true); EXPECT_EQ(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image_1, &codec_info).error); @@ -262,20 +258,9 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActive) { encoded_image_2.SetSimulcastIndex(1); EXPECT_EQ(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image_2, &codec_info).error); - - // Inactive. - test.Stop(); - EXPECT_NE(EncodedImageCallback::Result::OK, - test.router()->OnEncodedImage(encoded_image_1, &codec_info).error); - EXPECT_NE(EncodedImageCallback::Result::OK, - test.router()->OnEncodedImage(encoded_image_2, &codec_info).error); } -// Tests how setting individual rtp modules to active affects the overall -// behavior of the payload router. First sets one module to active and checks -// that outgoing data can be sent on this module, and checks that no data can -// be sent if both modules are inactive. -TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) { +TEST(RtpVideoSenderTest, OnEncodedImageReturnErrorCodeWhenSendingFalse) { constexpr uint8_t kPayload = 'a'; EncodedImage encoded_image_1; encoded_image_1.SetRtpTimestamp(1); @@ -291,23 +276,15 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) { CodecSpecificInfo codec_info; codec_info.codecType = kVideoCodecVP8; - // Only setting one stream to active will still set the payload router to - // active and allow sending data on the active stream. - std::vector<bool> active_modules({true, false}); - test.SetActiveModules(active_modules); - EXPECT_EQ(EncodedImageCallback::Result::OK, - test.router()->OnEncodedImage(encoded_image_1, &codec_info).error); - - // Setting both streams to inactive will turn the payload router to + // Setting rtp streams to inactive will turn the payload router to // inactive. - active_modules = {false, false}; - test.SetActiveModules(active_modules); + test.SetSending(false); // An incoming encoded image will not ask the module to send outgoing data // because the payload router is inactive. EXPECT_NE(EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image_1, &codec_info).error); EXPECT_NE(EncodedImageCallback::Result::OK, - test.router()->OnEncodedImage(encoded_image_1, &codec_info).error); + test.router()->OnEncodedImage(encoded_image_2, &codec_info).error); } TEST(RtpVideoSenderTest, @@ -324,7 +301,7 @@ TEST(RtpVideoSenderTest, codec_info.codecType = kVideoCodecVP8; RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2}, kPayloadType, {}); - test.SetActiveModules({true, true}); + test.SetSending(true); // A layer is sent on both rtp streams. test.router()->OnVideoLayersAllocationUpdated( {.active_spatial_layers = {{.rtp_stream_index = 0}, @@ -347,7 +324,7 @@ TEST(RtpVideoSenderTest, TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) { RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2}, kPayloadType, {}); - test.SetActiveModules({true, true}); + test.SetSending(true); std::map<uint32_t, RtpPayloadState> initial_states = test.router()->GetRtpPayloadStates(); @@ -372,7 +349,7 @@ TEST(RtpVideoSenderTest, CreateWithPreviousStates) { RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2}, kPayloadType, states); - test.SetActiveModules({true, true}); + test.SetSending(true); std::map<uint32_t, RtpPayloadState> initial_states = test.router()->GetRtpPayloadStates(); @@ -412,7 +389,7 @@ TEST(RtpVideoSenderTest, FrameCountCallbacks) { test.router()->OnEncodedImage(encoded_image, nullptr).error); ::testing::Mock::VerifyAndClearExpectations(&callback); - test.SetActiveModules({true}); + test.SetSending(true); FrameCounts frame_counts; EXPECT_CALL(callback, FrameCountUpdated(_, kSsrc1)) @@ -441,7 +418,7 @@ TEST(RtpVideoSenderTest, FrameCountCallbacks) { TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) { RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2}, kPayloadType, {}); - test.SetActiveModules({true, true}); + test.SetSending(true); constexpr uint8_t kPayload = 'a'; EncodedImage encoded_image; @@ -606,7 +583,7 @@ TEST(RtpVideoSenderTest, RetransmitsOnTransportWideLossInfo) { TEST(RtpVideoSenderTest, EarlyRetransmits) { RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2}, kPayloadType, {}); - test.SetActiveModules({true, true}); + test.SetSending(true); const uint8_t kPayload[1] = {'a'}; EncodedImage encoded_image; @@ -701,7 +678,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) { TEST(RtpVideoSenderTest, SupportsDependencyDescriptor) { RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}); - test.SetActiveModules({true}); + test.SetSending(true); RtpHeaderExtensionMap extensions; extensions.Register<RtpDependencyDescriptorExtension>( @@ -773,7 +750,7 @@ TEST(RtpVideoSenderTest, EXPECT_TRUE(sent_packets.emplace_back(&extensions).Parse(packet)); return true; }); - test.SetActiveModules({true}); + test.SetSending(true); EncodedImage key_frame_image; key_frame_image._frameType = VideoFrameType::kVideoFrameKey; @@ -807,7 +784,7 @@ TEST(RtpVideoSenderTest, TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9) { RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}); - test.SetActiveModules({true}); + test.SetSending(true); RtpHeaderExtensionMap extensions; extensions.Register<RtpDependencyDescriptorExtension>( @@ -863,7 +840,7 @@ TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9) { TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9NotProvidedByEncoder) { RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}); - test.SetActiveModules({true}); + test.SetSending(true); RtpHeaderExtensionMap extensions; extensions.Register<RtpDependencyDescriptorExtension>( @@ -918,7 +895,7 @@ TEST(RtpVideoSenderTest, GenerateDependecyDescriptorForGenericCodecs) { test::ScopedKeyValueConfig field_trials( "WebRTC-GenericCodecDependencyDescriptor/Enabled/"); RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}, &field_trials); - test.SetActiveModules({true}); + test.SetSending(true); RtpHeaderExtensionMap extensions; extensions.Register<RtpDependencyDescriptorExtension>( @@ -964,7 +941,7 @@ TEST(RtpVideoSenderTest, GenerateDependecyDescriptorForGenericCodecs) { TEST(RtpVideoSenderTest, SupportsStoppingUsingDependencyDescriptor) { RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}); - test.SetActiveModules({true}); + test.SetSending(true); RtpHeaderExtensionMap extensions; extensions.Register<RtpDependencyDescriptorExtension>( @@ -1049,7 +1026,7 @@ TEST(RtpVideoSenderTest, OverheadIsSubtractedFromTargetBitrate) { kRtpHeaderSizeBytes + kTransportPacketOverheadBytes; RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}, &field_trials); test.router()->OnTransportOverheadChanged(kTransportPacketOverheadBytes); - test.SetActiveModules({true}); + test.SetSending(true); { test.router()->OnBitrateUpdated(CreateBitrateAllocationUpdate(300000), @@ -1076,7 +1053,7 @@ TEST(RtpVideoSenderTest, OverheadIsSubtractedFromTargetBitrate) { TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) { RtpVideoSenderTestFixture test({kSsrc1}, {kRtxSsrc1}, kPayloadType, {}); - test.SetActiveModules({true}); + test.SetSending(true); RtpHeaderExtensionMap extensions; extensions.Register<RtpDependencyDescriptorExtension>( @@ -1127,13 +1104,13 @@ TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) { // Disable the sending module and advance time slightly. No packets should be // sent. - test.SetActiveModules({false}); + test.SetSending(false); test.AdvanceTime(TimeDelta::Millis(20)); EXPECT_TRUE(sent_packets.empty()); // Reactive the send module - any packets should have been removed, so nothing // should be transmitted. - test.SetActiveModules({true}); + test.SetSending(true); test.AdvanceTime(TimeDelta::Millis(33)); EXPECT_TRUE(sent_packets.empty()); @@ -1156,7 +1133,7 @@ TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) { TEST(RtpVideoSenderTest, RetransmitsBaseLayerOnly) { RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2}, kPayloadType, {}); - test.SetActiveModules({true, true}); + test.SetSending(true); test.router()->SetRetransmissionMode(kRetransmitBaseLayer); constexpr uint8_t kPayload = 'a'; diff --git a/third_party/libwebrtc/call/test/mock_rtp_transport_controller_send.h b/third_party/libwebrtc/call/test/mock_rtp_transport_controller_send.h index b24e5a59ec..63f686eb3c 100644 --- a/third_party/libwebrtc/call/test/mock_rtp_transport_controller_send.h +++ b/third_party/libwebrtc/call/test/mock_rtp_transport_controller_send.h @@ -50,6 +50,11 @@ class MockRtpTransportControllerSend DestroyRtpVideoSender, (RtpVideoSenderInterface*), (override)); + MOCK_METHOD(void, RegisterSendingRtpStream, (RtpRtcpInterface&), (override)); + MOCK_METHOD(void, + DeRegisterSendingRtpStream, + (RtpRtcpInterface&), + (override)); MOCK_METHOD(PacketRouter*, packet_router, (), (override)); MOCK_METHOD(NetworkStateEstimateObserver*, network_state_estimate_observer, @@ -64,6 +69,10 @@ class MockRtpTransportControllerSend SetAllocatedSendBitrateLimits, (BitrateAllocationLimits), (override)); + MOCK_METHOD(void, + ReconfigureBandwidthEstimation, + (const BandwidthEstimationSettings&), + (override)); MOCK_METHOD(void, SetPacingFactor, (float), (override)); MOCK_METHOD(void, SetQueueTimeLimit, (int), (override)); MOCK_METHOD(StreamFeedbackProvider*, diff --git a/third_party/libwebrtc/call/version.cc b/third_party/libwebrtc/call/version.cc index 85fdf004ea..9b1f88ad87 100644 --- a/third_party/libwebrtc/call/version.cc +++ b/third_party/libwebrtc/call/version.cc @@ -13,7 +13,7 @@ namespace webrtc { // The timestamp is always in UTC. -const char* const kSourceTimestamp = "WebRTC source stamp 2024-01-21T04:12:31"; +const char* const kSourceTimestamp = "WebRTC source stamp 2024-02-18T04:06:34"; void LoadWebRTCVersionInRegister() { // Using volatile to instruct the compiler to not optimize `p` away even diff --git a/third_party/libwebrtc/call/video_send_stream.h b/third_party/libwebrtc/call/video_send_stream.h index 2b4ea5b66a..ca900823c8 100644 --- a/third_party/libwebrtc/call/video_send_stream.h +++ b/third_party/libwebrtc/call/video_send_stream.h @@ -212,20 +212,8 @@ class VideoSendStream { Config(const Config&); }; - // Updates the sending state for all simulcast layers that the video send - // stream owns. This can mean updating the activity one or for multiple - // layers. The ordering of active layers is the order in which the - // rtp modules are stored in the VideoSendStream. - // Note: This starts stream activity if it is inactive and one of the layers - // is active. This stops stream activity if it is active and all layers are - // inactive. - // `active_layers` should have the same size as the number of configured - // simulcast layers or one if only one rtp stream is used. - virtual void StartPerRtpStream(std::vector<bool> active_layers) = 0; - // Starts stream activity. // When a stream is active, it can receive, process and deliver packets. - // Prefer to use StartPerRtpStream. virtual void Start() = 0; // Stops stream activity. @@ -234,11 +222,8 @@ class VideoSendStream { // Accessor for determining if the stream is active. This is an inexpensive // call that must be made on the same thread as `Start()` and `Stop()` methods - // are called on and will return `true` iff activity has been started either - // via `Start()` or `StartPerRtpStream()`. If activity is either - // stopped or is in the process of being stopped as a result of a call to - // either `Stop()` or `StartPerRtpStream()` where all layers were - // deactivated, the return value will be `false`. + // are called on and will return `true` iff activity has been started + // via `Start()`. virtual bool started() = 0; // If the resource is overusing, the VideoSendStream will try to reduce |