aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/rtp_rtcp/source/nack_rtx_unittest.cc2
-rw-r--r--modules/rtp_rtcp/source/rtcp_sender.cc2
-rw-r--r--modules/rtp_rtcp/source/rtcp_sender.h5
-rw-r--r--modules/rtp_rtcp/source/rtp_rtcp_impl2.cc45
-rw-r--r--modules/rtp_rtcp/source/rtp_rtcp_impl2.h11
-rw-r--r--modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc19
6 files changed, 8 insertions, 76 deletions
diff --git a/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
index 8afaf3ee61..fc035047b0 100644
--- a/modules/rtp_rtcp/source/nack_rtx_unittest.cc
+++ b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
@@ -218,7 +218,6 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
if (length > 0)
rtp_rtcp_module_->SendNACK(nack_list, length);
fake_clock.AdvanceTimeMilliseconds(28); // 33ms - 5ms delay.
- rtp_rtcp_module_->Process();
// Prepare next frame.
timestamp += 3000;
}
@@ -265,7 +264,6 @@ TEST_F(RtpRtcpRtxNackTest, LongNackList) {
// Prepare next frame.
timestamp += 3000;
fake_clock.AdvanceTimeMilliseconds(33);
- rtp_rtcp_module_->Process();
}
EXPECT_FALSE(transport_.expected_sequence_numbers_.empty());
EXPECT_FALSE(media_stream_.sequence_numbers_.empty());
diff --git a/modules/rtp_rtcp/source/rtcp_sender.cc b/modules/rtp_rtcp/source/rtcp_sender.cc
index 30a9d01ebb..8f5e3b104c 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -955,6 +955,8 @@ void RTCPSender::SendCombinedRtcpPacket(
void RTCPSender::SetNextRtcpSendEvaluationDuration(TimeDelta duration) {
next_time_to_send_rtcp_ = clock_->CurrentTime() + duration;
+ // TODO(bugs.webrtc.org/11581): make unconditional once downstream consumers
+ // are using the callback method.
if (schedule_next_rtcp_send_evaluation_function_)
schedule_next_rtcp_send_evaluation_function_(duration);
}
diff --git a/modules/rtp_rtcp/source/rtcp_sender.h b/modules/rtp_rtcp/source/rtcp_sender.h
index 027d3d0c13..2d1c7da0fc 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.h
+++ b/modules/rtp_rtcp/source/rtcp_sender.h
@@ -69,6 +69,11 @@ class RTCPSender final {
// TimeToSendRTCPReport/SendRTCP.
// The RTCPSender client still needs to call TimeToSendRTCPReport/SendRTCP
// to actually get RTCP sent.
+ //
+ // Note: It's recommended to use the callback to ensure program design that
+ // doesn't use polling.
+ // TODO(bugs.webrtc.org/11581): Make mandatory once downstream consumers
+ // have migrated to the callback solution.
std::function<void(TimeDelta)> schedule_next_rtcp_send_evaluation_function;
RtcEventLog* event_log = nullptr;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 77054576a8..7fae1e3bd0 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -39,7 +39,6 @@
namespace webrtc {
namespace {
-const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5;
const int64_t kDefaultExpectedRetransmissionTimeMs = 125;
constexpr TimeDelta kRttUpdateInterval = TimeDelta::Millis(1000);
@@ -84,9 +83,6 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration)
})),
rtcp_receiver_(configuration, this),
clock_(configuration.clock),
- last_rtt_process_time_(clock_->TimeInMilliseconds()),
- next_process_time_(clock_->TimeInMilliseconds() +
- kRtpRtcpMaxIdleTimeProcessMs),
packet_overhead_(28), // IPV4 UDP.
nack_last_time_sent_full_ms_(0),
nack_last_seq_number_sent_(0),
@@ -94,7 +90,6 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration)
rtt_stats_(configuration.rtt_stats),
rtt_ms_(0) {
RTC_DCHECK(worker_queue_);
- process_thread_checker_.Detach();
packet_sequence_checker_.Detach();
if (!configuration.receiver_only) {
rtp_sender_ = std::make_unique<RtpSenderContext>(configuration);
@@ -131,39 +126,6 @@ std::unique_ptr<ModuleRtpRtcpImpl2> ModuleRtpRtcpImpl2::Create(
return std::make_unique<ModuleRtpRtcpImpl2>(configuration);
}
-// Returns the number of milliseconds until the module want a worker thread
-// to call Process.
-int64_t ModuleRtpRtcpImpl2::TimeUntilNextProcess() {
- RTC_DCHECK_RUN_ON(&process_thread_checker_);
- return std::max<int64_t>(0,
- next_process_time_ - clock_->TimeInMilliseconds());
-}
-
-// Process any pending tasks such as timeouts (non time critical events).
-void ModuleRtpRtcpImpl2::Process() {
- RTC_DCHECK_RUN_ON(&process_thread_checker_);
-
- const Timestamp now = clock_->CurrentTime();
-
- // TODO(bugs.webrtc.org/11581): Figure out why we need to call Process() 200
- // times a second.
- next_process_time_ = now.ms() + kRtpRtcpMaxIdleTimeProcessMs;
-
- // TODO(bugs.webrtc.org/11581): once we don't use Process() to trigger
- // calls to SendRTCP(), the only remaining timer will require remote_bitrate_
- // to be not null. In that case, we can disable the timer when it is null.
- if (remote_bitrate_ && rtcp_sender_.Sending() && rtcp_sender_.TMMBR()) {
- unsigned int target_bitrate = 0;
- std::vector<unsigned int> ssrcs;
- if (remote_bitrate_->LatestEstimate(&ssrcs, &target_bitrate)) {
- if (!ssrcs.empty()) {
- target_bitrate = target_bitrate / ssrcs.size();
- }
- rtcp_sender_.SetTargetBitrate(target_bitrate);
- }
- }
-}
-
void ModuleRtpRtcpImpl2::SetRtxSendStatus(int mode) {
rtp_sender_->packet_generator.SetRtxStatus(mode);
}
@@ -780,13 +742,6 @@ void ModuleRtpRtcpImpl2::PeriodicUpdate() {
rtt_stats_->OnRttUpdate(rtt->ms());
set_rtt_ms(rtt->ms());
}
-
- // kTmmbrTimeoutIntervalMs is 25 seconds, so an order of seconds.
- // Instead of this polling approach, consider having an optional timer in the
- // RTCPReceiver class that is started/stopped based on the state of
- // rtcp_sender_.TMMBR().
- if (rtcp_sender_.TMMBR() && rtcp_receiver_.UpdateTmmbrTimers())
- rtcp_receiver_.NotifyTmmbrUpdated();
}
// RTC_RUN_ON(worker_queue_);
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index 849cc42c5e..0ad495593d 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -50,7 +50,6 @@ struct PacedPacketInfo;
struct RTPVideoHeader;
class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
- public Module,
public RTCPReceiver::ModuleRtpRtcp {
public:
explicit ModuleRtpRtcpImpl2(
@@ -64,13 +63,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
static std::unique_ptr<ModuleRtpRtcpImpl2> Create(
const Configuration& configuration);
- // Returns the number of milliseconds until the module want a worker thread to
- // call Process.
- int64_t TimeUntilNextProcess() override;
-
- // Process any pending tasks such as timeouts.
- void Process() override;
-
// Receiver part.
// Called when we receive an RTCP packet.
@@ -310,7 +302,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
TimeDelta duration);
TaskQueueBase* const worker_queue_;
- RTC_NO_UNIQUE_ADDRESS SequenceChecker process_thread_checker_;
RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_sequence_checker_;
std::unique_ptr<RtpSenderContext> rtp_sender_;
@@ -319,8 +310,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
Clock* const clock_;
- int64_t last_rtt_process_time_;
- int64_t next_process_time_;
uint16_t packet_overhead_;
// Send side
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc
index 5deb12d465..c8ab15de78 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc
@@ -199,25 +199,20 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver,
};
RtpRtcpModule(GlobalSimulatedTimeController* time_controller,
- ProcessThread* process_thread,
bool is_sender,
const FieldTrialConfig& trials)
: time_controller_(time_controller),
is_sender_(is_sender),
trials_(trials),
- process_thread_(process_thread),
receive_statistics_(
ReceiveStatistics::Create(time_controller->GetClock())),
transport_(kOneWayNetworkDelay, time_controller) {
CreateModuleImpl();
}
- ~RtpRtcpModule() { process_thread_->DeRegisterModule(impl_.get()); }
-
TimeController* const time_controller_;
const bool is_sender_;
const FieldTrialConfig& trials_;
- ProcessThread* const process_thread_;
RtcpPacketTypeCounter packets_sent_;
RtcpPacketTypeCounter packets_received_;
std::unique_ptr<ReceiveStatistics> receive_statistics_;
@@ -286,10 +281,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver,
config.field_trials = &trials_;
config.send_packet_observer = this;
config.fec_generator = fec_generator_;
- if (impl_)
- process_thread_->DeRegisterModule(impl_.get());
impl_.reset(new ModuleRtpRtcpImpl2(config));
- process_thread_->RegisterModule(impl_.get(), RTC_FROM_HERE);
impl_->SetRemoteSSRC(is_sender_ ? kReceiverSsrc : kSenderSsrc);
impl_->SetRTCPStatus(RtcpMode::kCompound);
}
@@ -306,20 +298,12 @@ class RtpRtcpImpl2Test : public ::testing::TestWithParam<TestConfig> {
RtpRtcpImpl2Test()
: time_controller_(Timestamp::Micros(133590000000000)),
field_trials_(FieldTrialConfig::GetFromTestConfig(GetParam())),
- process_thread_(
- time_controller_.CreateProcessThread("RtpRtcpImpl2Test")),
sender_(&time_controller_,
- process_thread_.get(),
/*is_sender=*/true,
field_trials_),
receiver_(&time_controller_,
- process_thread_.get(),
/*is_sender=*/false,
- field_trials_) {
- process_thread_->Start();
- }
-
- ~RtpRtcpImpl2Test() { process_thread_->Stop(); }
+ field_trials_) {}
void SetUp() override {
// Send module.
@@ -367,7 +351,6 @@ class RtpRtcpImpl2Test : public ::testing::TestWithParam<TestConfig> {
GlobalSimulatedTimeController time_controller_;
FieldTrialConfig field_trials_;
- std::unique_ptr<ProcessThread> process_thread_;
RtpRtcpModule sender_;
std::unique_ptr<RTPSenderVideo> sender_video_;
RtpRtcpModule receiver_;