Delete deprecated variant of ReceiveStatistics::SetMaxReorderingThreshold

Fixed: webrtc:42220729
Change-Id: I87c08769d33746e40dcdbf213096fc9732f82a07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363962
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43095}
This commit is contained in:
Danil Chapovalov 2024-09-27 14:38:58 +02:00 committed by WebRTC LUCI CQ
parent 3ae9578f4d
commit 8d4638f985
4 changed files with 18 additions and 52 deletions

View File

@ -898,11 +898,12 @@ void ChannelReceive::SetNACKStatus(bool enable, int max_packets) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
// None of these functions can fail. // None of these functions can fail.
if (enable) { if (enable) {
rtp_receive_statistics_->SetMaxReorderingThreshold(max_packets); rtp_receive_statistics_->SetMaxReorderingThreshold(remote_ssrc_,
max_packets);
neteq_->EnableNack(max_packets); neteq_->EnableNack(max_packets);
} else { } else {
rtp_receive_statistics_->SetMaxReorderingThreshold( rtp_receive_statistics_->SetMaxReorderingThreshold(
kDefaultMaxReorderingThreshold); remote_ssrc_, kDefaultMaxReorderingThreshold);
neteq_->DisableNack(); neteq_->DisableNack();
} }
} }

View File

@ -66,11 +66,6 @@ class ReceiveStatistics : public ReceiveStatisticsProvider,
// Returns a pointer to the statistician of an ssrc. // Returns a pointer to the statistician of an ssrc.
virtual StreamStatistician* GetStatistician(uint32_t ssrc) const = 0; virtual StreamStatistician* GetStatistician(uint32_t ssrc) const = 0;
// TODO(bugs.webrtc.org/10669): Deprecated, delete as soon as downstream
// projects are updated. This method sets the max reordering threshold of all
// current and future streams.
virtual void SetMaxReorderingThreshold(int max_reordering_threshold) = 0;
// Sets the max reordering threshold in number of packets. // Sets the max reordering threshold in number of packets.
virtual void SetMaxReorderingThreshold(uint32_t ssrc, virtual void SetMaxReorderingThreshold(uint32_t ssrc,
int max_reordering_threshold) = 0; int max_reordering_threshold) = 0;

View File

@ -41,14 +41,12 @@ TimeDelta UnixEpochDelta(Clock& clock) {
StreamStatistician::~StreamStatistician() {} StreamStatistician::~StreamStatistician() {}
StreamStatisticianImpl::StreamStatisticianImpl(uint32_t ssrc, StreamStatisticianImpl::StreamStatisticianImpl(uint32_t ssrc, Clock* clock)
Clock* clock,
int max_reordering_threshold)
: ssrc_(ssrc), : ssrc_(ssrc),
clock_(clock), clock_(clock),
delta_internal_unix_epoch_(UnixEpochDelta(*clock_)), delta_internal_unix_epoch_(UnixEpochDelta(*clock_)),
incoming_bitrate_(/*max_window_size=*/kStatisticsProcessInterval), incoming_bitrate_(/*max_window_size=*/kStatisticsProcessInterval),
max_reordering_threshold_(max_reordering_threshold), max_reordering_threshold_(kDefaultMaxReorderingThreshold),
enable_retransmit_detection_(false), enable_retransmit_detection_(false),
cumulative_loss_is_capped_(false), cumulative_loss_is_capped_(false),
jitter_q4_(0), jitter_q4_(0),
@ -334,18 +332,16 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
std::unique_ptr<ReceiveStatistics> ReceiveStatistics::Create(Clock* clock) { std::unique_ptr<ReceiveStatistics> ReceiveStatistics::Create(Clock* clock) {
return std::make_unique<ReceiveStatisticsLocked>( return std::make_unique<ReceiveStatisticsLocked>(
clock, [](uint32_t ssrc, Clock* clock, int max_reordering_threshold) { clock, [](uint32_t ssrc, Clock* clock) {
return std::make_unique<StreamStatisticianLocked>( return std::make_unique<StreamStatisticianLocked>(ssrc, clock);
ssrc, clock, max_reordering_threshold);
}); });
} }
std::unique_ptr<ReceiveStatistics> ReceiveStatistics::CreateThreadCompatible( std::unique_ptr<ReceiveStatistics> ReceiveStatistics::CreateThreadCompatible(
Clock* clock) { Clock* clock) {
return std::make_unique<ReceiveStatisticsImpl>( return std::make_unique<ReceiveStatisticsImpl>(
clock, [](uint32_t ssrc, Clock* clock, int max_reordering_threshold) { clock, [](uint32_t ssrc, Clock* clock) {
return std::make_unique<StreamStatisticianImpl>( return std::make_unique<StreamStatisticianImpl>(ssrc, clock);
ssrc, clock, max_reordering_threshold);
}); });
} }
@ -353,12 +349,10 @@ ReceiveStatisticsImpl::ReceiveStatisticsImpl(
Clock* clock, Clock* clock,
std::function<std::unique_ptr<StreamStatisticianImplInterface>( std::function<std::unique_ptr<StreamStatisticianImplInterface>(
uint32_t ssrc, uint32_t ssrc,
Clock* clock, Clock* clock)> stream_statistician_factory)
int max_reordering_threshold)> stream_statistician_factory)
: clock_(clock), : clock_(clock),
stream_statistician_factory_(std::move(stream_statistician_factory)), stream_statistician_factory_(std::move(stream_statistician_factory)),
last_returned_ssrc_idx_(0), last_returned_ssrc_idx_(0) {}
max_reordering_threshold_(kDefaultMaxReorderingThreshold) {}
void ReceiveStatisticsImpl::OnRtpPacket(const RtpPacketReceived& packet) { void ReceiveStatisticsImpl::OnRtpPacket(const RtpPacketReceived& packet) {
// StreamStatisticianImpl instance is created once and only destroyed when // StreamStatisticianImpl instance is created once and only destroyed when
@ -380,21 +374,12 @@ StreamStatisticianImplInterface* ReceiveStatisticsImpl::GetOrCreateStatistician(
uint32_t ssrc) { uint32_t ssrc) {
std::unique_ptr<StreamStatisticianImplInterface>& impl = statisticians_[ssrc]; std::unique_ptr<StreamStatisticianImplInterface>& impl = statisticians_[ssrc];
if (impl == nullptr) { // new element if (impl == nullptr) { // new element
impl = impl = stream_statistician_factory_(ssrc, clock_);
stream_statistician_factory_(ssrc, clock_, max_reordering_threshold_);
all_ssrcs_.push_back(ssrc); all_ssrcs_.push_back(ssrc);
} }
return impl.get(); return impl.get();
} }
void ReceiveStatisticsImpl::SetMaxReorderingThreshold(
int max_reordering_threshold) {
max_reordering_threshold_ = max_reordering_threshold;
for (auto& statistician : statisticians_) {
statistician.second->SetMaxReorderingThreshold(max_reordering_threshold);
}
}
void ReceiveStatisticsImpl::SetMaxReorderingThreshold( void ReceiveStatisticsImpl::SetMaxReorderingThreshold(
uint32_t ssrc, uint32_t ssrc,
int max_reordering_threshold) { int max_reordering_threshold) {

View File

@ -44,9 +44,7 @@ class StreamStatisticianImplInterface : public StreamStatistician {
// Thread-compatible implementation of StreamStatisticianImplInterface. // Thread-compatible implementation of StreamStatisticianImplInterface.
class StreamStatisticianImpl : public StreamStatisticianImplInterface { class StreamStatisticianImpl : public StreamStatisticianImplInterface {
public: public:
StreamStatisticianImpl(uint32_t ssrc, StreamStatisticianImpl(uint32_t ssrc, Clock* clock);
Clock* clock,
int max_reordering_threshold);
~StreamStatisticianImpl() override; ~StreamStatisticianImpl() override;
// Implements StreamStatistician // Implements StreamStatistician
@ -119,10 +117,7 @@ class StreamStatisticianImpl : public StreamStatisticianImplInterface {
// Thread-safe implementation of StreamStatisticianImplInterface. // Thread-safe implementation of StreamStatisticianImplInterface.
class StreamStatisticianLocked : public StreamStatisticianImplInterface { class StreamStatisticianLocked : public StreamStatisticianImplInterface {
public: public:
StreamStatisticianLocked(uint32_t ssrc, StreamStatisticianLocked(uint32_t ssrc, Clock* clock) : impl_(ssrc, clock) {}
Clock* clock,
int max_reordering_threshold)
: impl_(ssrc, clock, max_reordering_threshold) {}
~StreamStatisticianLocked() override = default; ~StreamStatisticianLocked() override = default;
RtpReceiveStats GetStats() const override { RtpReceiveStats GetStats() const override {
@ -171,8 +166,7 @@ class ReceiveStatisticsImpl : public ReceiveStatistics {
Clock* clock, Clock* clock,
std::function<std::unique_ptr<StreamStatisticianImplInterface>( std::function<std::unique_ptr<StreamStatisticianImplInterface>(
uint32_t ssrc, uint32_t ssrc,
Clock* clock, Clock* clock)> stream_statistician_factory);
int max_reordering_threshold)> stream_statistician_factory);
~ReceiveStatisticsImpl() override = default; ~ReceiveStatisticsImpl() override = default;
// Implements ReceiveStatisticsProvider. // Implements ReceiveStatisticsProvider.
@ -183,7 +177,6 @@ class ReceiveStatisticsImpl : public ReceiveStatistics {
// Implements ReceiveStatistics. // Implements ReceiveStatistics.
StreamStatistician* GetStatistician(uint32_t ssrc) const override; StreamStatistician* GetStatistician(uint32_t ssrc) const override;
void SetMaxReorderingThreshold(int max_reordering_threshold) override;
void SetMaxReorderingThreshold(uint32_t ssrc, void SetMaxReorderingThreshold(uint32_t ssrc,
int max_reordering_threshold) override; int max_reordering_threshold) override;
void EnableRetransmitDetection(uint32_t ssrc, bool enable) override; void EnableRetransmitDetection(uint32_t ssrc, bool enable) override;
@ -192,15 +185,12 @@ class ReceiveStatisticsImpl : public ReceiveStatistics {
StreamStatisticianImplInterface* GetOrCreateStatistician(uint32_t ssrc); StreamStatisticianImplInterface* GetOrCreateStatistician(uint32_t ssrc);
Clock* const clock_; Clock* const clock_;
std::function<std::unique_ptr<StreamStatisticianImplInterface>( std::function<std::unique_ptr<StreamStatisticianImplInterface>(uint32_t ssrc,
uint32_t ssrc, Clock* clock)>
Clock* clock,
int max_reordering_threshold)>
stream_statistician_factory_; stream_statistician_factory_;
// The index within `all_ssrcs_` that was last returned. // The index within `all_ssrcs_` that was last returned.
size_t last_returned_ssrc_idx_; size_t last_returned_ssrc_idx_;
std::vector<uint32_t> all_ssrcs_; std::vector<uint32_t> all_ssrcs_;
int max_reordering_threshold_;
flat_map<uint32_t /*ssrc*/, std::unique_ptr<StreamStatisticianImplInterface>> flat_map<uint32_t /*ssrc*/, std::unique_ptr<StreamStatisticianImplInterface>>
statisticians_; statisticians_;
}; };
@ -213,8 +203,7 @@ class ReceiveStatisticsLocked : public ReceiveStatistics {
Clock* clock, Clock* clock,
std::function<std::unique_ptr<StreamStatisticianImplInterface>( std::function<std::unique_ptr<StreamStatisticianImplInterface>(
uint32_t ssrc, uint32_t ssrc,
Clock* clock, Clock* clock)> stream_statitician_factory)
int max_reordering_threshold)> stream_statitician_factory)
: impl_(clock, std::move(stream_statitician_factory)) {} : impl_(clock, std::move(stream_statitician_factory)) {}
~ReceiveStatisticsLocked() override = default; ~ReceiveStatisticsLocked() override = default;
std::vector<rtcp::ReportBlock> RtcpReportBlocks(size_t max_blocks) override { std::vector<rtcp::ReportBlock> RtcpReportBlocks(size_t max_blocks) override {
@ -229,10 +218,6 @@ class ReceiveStatisticsLocked : public ReceiveStatistics {
MutexLock lock(&receive_statistics_lock_); MutexLock lock(&receive_statistics_lock_);
return impl_.GetStatistician(ssrc); return impl_.GetStatistician(ssrc);
} }
void SetMaxReorderingThreshold(int max_reordering_threshold) override {
MutexLock lock(&receive_statistics_lock_);
return impl_.SetMaxReorderingThreshold(max_reordering_threshold);
}
void SetMaxReorderingThreshold(uint32_t ssrc, void SetMaxReorderingThreshold(uint32_t ssrc,
int max_reordering_threshold) override { int max_reordering_threshold) override {
MutexLock lock(&receive_statistics_lock_); MutexLock lock(&receive_statistics_lock_);