Only create ALR detector in PacedSender if deprecated functions are called.
Bug: webrtc:10108 Change-Id: Ic41693c4017b47093fc373547d59b7723493c70d Reviewed-on: https://webrtc-review.googlesource.com/c/113527 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Commit-Queue: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25937}
This commit is contained in:
parent
1d61c430d9
commit
a956d498a7
@ -36,8 +36,7 @@ class MockPacedSender : public PacedSender {
|
|||||||
MOCK_CONST_METHOD0(QueueInMs, int64_t());
|
MOCK_CONST_METHOD0(QueueInMs, int64_t());
|
||||||
MOCK_CONST_METHOD0(QueueInPackets, int());
|
MOCK_CONST_METHOD0(QueueInPackets, int());
|
||||||
MOCK_CONST_METHOD0(ExpectedQueueTimeMs, int64_t());
|
MOCK_CONST_METHOD0(ExpectedQueueTimeMs, int64_t());
|
||||||
MOCK_CONST_METHOD0(GetApplicationLimitedRegionStartTime,
|
MOCK_METHOD0(GetApplicationLimitedRegionStartTime, absl::optional<int64_t>());
|
||||||
absl::optional<int64_t>());
|
|
||||||
MOCK_METHOD0(Process, void());
|
MOCK_METHOD0(Process, void());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ PacedSender::PacedSender(const Clock* clock,
|
|||||||
RtcEventLog* event_log)
|
RtcEventLog* event_log)
|
||||||
: clock_(clock),
|
: clock_(clock),
|
||||||
packet_sender_(packet_sender),
|
packet_sender_(packet_sender),
|
||||||
alr_detector_(absl::make_unique<AlrDetector>(event_log)),
|
alr_detector_(),
|
||||||
drain_large_queues_(!field_trial::IsDisabled("WebRTC-Pacer-DrainQueue")),
|
drain_large_queues_(!field_trial::IsDisabled("WebRTC-Pacer-DrainQueue")),
|
||||||
send_padding_if_silent_(
|
send_padding_if_silent_(
|
||||||
field_trial::IsEnabled("WebRTC-Pacer-PadInSilence")),
|
field_trial::IsEnabled("WebRTC-Pacer-PadInSilence")),
|
||||||
@ -158,6 +158,8 @@ void PacedSender::SetEstimatedBitrate(uint32_t bitrate_bps) {
|
|||||||
pacing_bitrate_kbps_ =
|
pacing_bitrate_kbps_ =
|
||||||
std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) *
|
std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) *
|
||||||
pacing_factor_;
|
pacing_factor_;
|
||||||
|
if (!alr_detector_)
|
||||||
|
alr_detector_ = absl::make_unique<AlrDetector>(nullptr /*event_log*/);
|
||||||
alr_detector_->SetEstimatedBitrate(bitrate_bps);
|
alr_detector_->SetEstimatedBitrate(bitrate_bps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,9 +216,10 @@ int64_t PacedSender::ExpectedQueueTimeMs() const {
|
|||||||
pacing_bitrate_kbps_);
|
pacing_bitrate_kbps_);
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<int64_t> PacedSender::GetApplicationLimitedRegionStartTime()
|
absl::optional<int64_t> PacedSender::GetApplicationLimitedRegionStartTime() {
|
||||||
const {
|
|
||||||
rtc::CritScope cs(&critsect_);
|
rtc::CritScope cs(&critsect_);
|
||||||
|
if (!alr_detector_)
|
||||||
|
alr_detector_ = absl::make_unique<AlrDetector>(nullptr /*event_log*/);
|
||||||
return alr_detector_->GetApplicationLimitedRegionStartTime();
|
return alr_detector_->GetApplicationLimitedRegionStartTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +298,7 @@ void PacedSender::Process() {
|
|||||||
size_t bytes_sent = packet_sender_->TimeToSendPadding(1, PacedPacketInfo());
|
size_t bytes_sent = packet_sender_->TimeToSendPadding(1, PacedPacketInfo());
|
||||||
critsect_.Enter();
|
critsect_.Enter();
|
||||||
OnPaddingSent(bytes_sent);
|
OnPaddingSent(bytes_sent);
|
||||||
|
if (alr_detector_)
|
||||||
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
|
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,6 +382,7 @@ void PacedSender::Process() {
|
|||||||
if (!probing_send_failure_)
|
if (!probing_send_failure_)
|
||||||
prober_.ProbeSent(TimeMilliseconds(), bytes_sent);
|
prober_.ProbeSent(TimeMilliseconds(), bytes_sent);
|
||||||
}
|
}
|
||||||
|
if (alr_detector_)
|
||||||
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
|
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class PacedSender : public Pacer {
|
|||||||
virtual int64_t ExpectedQueueTimeMs() const;
|
virtual int64_t ExpectedQueueTimeMs() const;
|
||||||
|
|
||||||
// Deprecated, alr detection will be moved out of the pacer.
|
// Deprecated, alr detection will be moved out of the pacer.
|
||||||
virtual absl::optional<int64_t> GetApplicationLimitedRegionStartTime() const;
|
virtual absl::optional<int64_t> GetApplicationLimitedRegionStartTime();
|
||||||
|
|
||||||
// Returns the number of milliseconds until the module want a worker thread
|
// Returns the number of milliseconds until the module want a worker thread
|
||||||
// to call Process.
|
// to call Process.
|
||||||
@ -167,7 +167,7 @@ class PacedSender : public Pacer {
|
|||||||
|
|
||||||
const Clock* const clock_;
|
const Clock* const clock_;
|
||||||
PacketSender* const packet_sender_;
|
PacketSender* const packet_sender_;
|
||||||
const std::unique_ptr<AlrDetector> alr_detector_ RTC_PT_GUARDED_BY(critsect_);
|
std::unique_ptr<AlrDetector> alr_detector_ RTC_PT_GUARDED_BY(critsect_);
|
||||||
|
|
||||||
const bool drain_large_queues_;
|
const bool drain_large_queues_;
|
||||||
const bool send_padding_if_silent_;
|
const bool send_padding_if_silent_;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user