Fix setting max reordering threshold in ReceiveStatistics
By ensuring new max reordering threshold applies to future statisticians too. Bug: b/38179459 Change-Id: I0df32fb893a930b93faaf2161cd03626f9544a74 Reviewed-on: https://webrtc-review.googlesource.com/c/111752 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25756}
This commit is contained in:

committed by
Commit Bot

parent
286df00f72
commit
ebb50c217d
@ -33,13 +33,14 @@ StreamStatisticianImpl::StreamStatisticianImpl(
|
|||||||
uint32_t ssrc,
|
uint32_t ssrc,
|
||||||
Clock* clock,
|
Clock* clock,
|
||||||
bool enable_retransmit_detection,
|
bool enable_retransmit_detection,
|
||||||
|
int max_reordering_threshold,
|
||||||
RtcpStatisticsCallback* rtcp_callback,
|
RtcpStatisticsCallback* rtcp_callback,
|
||||||
StreamDataCountersCallback* rtp_callback)
|
StreamDataCountersCallback* rtp_callback)
|
||||||
: ssrc_(ssrc),
|
: ssrc_(ssrc),
|
||||||
clock_(clock),
|
clock_(clock),
|
||||||
incoming_bitrate_(kStatisticsProcessIntervalMs,
|
incoming_bitrate_(kStatisticsProcessIntervalMs,
|
||||||
RateStatistics::kBpsScale),
|
RateStatistics::kBpsScale),
|
||||||
max_reordering_threshold_(kDefaultMaxReorderingThreshold),
|
max_reordering_threshold_(max_reordering_threshold),
|
||||||
enable_retransmit_detection_(enable_retransmit_detection),
|
enable_retransmit_detection_(enable_retransmit_detection),
|
||||||
jitter_q4_(0),
|
jitter_q4_(0),
|
||||||
cumulative_loss_(0),
|
cumulative_loss_(0),
|
||||||
@ -340,6 +341,7 @@ ReceiveStatistics* ReceiveStatistics::Create(Clock* clock) {
|
|||||||
ReceiveStatisticsImpl::ReceiveStatisticsImpl(Clock* clock)
|
ReceiveStatisticsImpl::ReceiveStatisticsImpl(Clock* clock)
|
||||||
: clock_(clock),
|
: clock_(clock),
|
||||||
last_returned_ssrc_(0),
|
last_returned_ssrc_(0),
|
||||||
|
max_reordering_threshold_(kDefaultMaxReorderingThreshold),
|
||||||
rtcp_stats_callback_(NULL),
|
rtcp_stats_callback_(NULL),
|
||||||
rtp_stats_callback_(NULL) {}
|
rtp_stats_callback_(NULL) {}
|
||||||
|
|
||||||
@ -360,7 +362,7 @@ void ReceiveStatisticsImpl::OnRtpPacket(const RtpPacketReceived& packet) {
|
|||||||
} else {
|
} else {
|
||||||
impl = new StreamStatisticianImpl(
|
impl = new StreamStatisticianImpl(
|
||||||
packet.Ssrc(), clock_, /* enable_retransmit_detection = */ false,
|
packet.Ssrc(), clock_, /* enable_retransmit_detection = */ false,
|
||||||
this, this);
|
max_reordering_threshold_, this, this);
|
||||||
statisticians_[packet.Ssrc()] = impl;
|
statisticians_[packet.Ssrc()] = impl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,8 +397,13 @@ StreamStatistician* ReceiveStatisticsImpl::GetStatistician(
|
|||||||
|
|
||||||
void ReceiveStatisticsImpl::SetMaxReorderingThreshold(
|
void ReceiveStatisticsImpl::SetMaxReorderingThreshold(
|
||||||
int max_reordering_threshold) {
|
int max_reordering_threshold) {
|
||||||
|
std::map<uint32_t, StreamStatisticianImpl*> statisticians;
|
||||||
|
{
|
||||||
rtc::CritScope cs(&receive_statistics_lock_);
|
rtc::CritScope cs(&receive_statistics_lock_);
|
||||||
for (auto& statistician : statisticians_) {
|
max_reordering_threshold_ = max_reordering_threshold;
|
||||||
|
statisticians = statisticians_;
|
||||||
|
}
|
||||||
|
for (auto& statistician : statisticians) {
|
||||||
statistician.second->SetMaxReorderingThreshold(max_reordering_threshold);
|
statistician.second->SetMaxReorderingThreshold(max_reordering_threshold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,7 +415,8 @@ void ReceiveStatisticsImpl::EnableRetransmitDetection(uint32_t ssrc,
|
|||||||
rtc::CritScope cs(&receive_statistics_lock_);
|
rtc::CritScope cs(&receive_statistics_lock_);
|
||||||
StreamStatisticianImpl*& impl_ref = statisticians_[ssrc];
|
StreamStatisticianImpl*& impl_ref = statisticians_[ssrc];
|
||||||
if (impl_ref == nullptr) { // new element
|
if (impl_ref == nullptr) { // new element
|
||||||
impl_ref = new StreamStatisticianImpl(ssrc, clock_, enable, this, this);
|
impl_ref = new StreamStatisticianImpl(
|
||||||
|
ssrc, clock_, enable, max_reordering_threshold_, this, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
impl = impl_ref;
|
impl = impl_ref;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "rtc_base/criticalsection.h"
|
#include "rtc_base/criticalsection.h"
|
||||||
#include "rtc_base/rate_statistics.h"
|
#include "rtc_base/rate_statistics.h"
|
||||||
|
#include "rtc_base/thread_annotations.h"
|
||||||
#include "system_wrappers/include/ntp_time.h"
|
#include "system_wrappers/include/ntp_time.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -29,6 +30,7 @@ class StreamStatisticianImpl : public StreamStatistician,
|
|||||||
StreamStatisticianImpl(uint32_t ssrc,
|
StreamStatisticianImpl(uint32_t ssrc,
|
||||||
Clock* clock,
|
Clock* clock,
|
||||||
bool enable_retransmit_detection,
|
bool enable_retransmit_detection,
|
||||||
|
int max_reordering_threshold,
|
||||||
RtcpStatisticsCallback* rtcp_callback,
|
RtcpStatisticsCallback* rtcp_callback,
|
||||||
StreamDataCountersCallback* rtp_callback);
|
StreamDataCountersCallback* rtp_callback);
|
||||||
~StreamStatisticianImpl() override;
|
~StreamStatisticianImpl() override;
|
||||||
@ -128,7 +130,9 @@ class ReceiveStatisticsImpl : public ReceiveStatistics,
|
|||||||
Clock* const clock_;
|
Clock* const clock_;
|
||||||
rtc::CriticalSection receive_statistics_lock_;
|
rtc::CriticalSection receive_statistics_lock_;
|
||||||
uint32_t last_returned_ssrc_;
|
uint32_t last_returned_ssrc_;
|
||||||
std::map<uint32_t, StreamStatisticianImpl*> statisticians_;
|
int max_reordering_threshold_ RTC_GUARDED_BY(receive_statistics_lock_);
|
||||||
|
std::map<uint32_t, StreamStatisticianImpl*> statisticians_
|
||||||
|
RTC_GUARDED_BY(receive_statistics_lock_);
|
||||||
|
|
||||||
RtcpStatisticsCallback* rtcp_stats_callback_;
|
RtcpStatisticsCallback* rtcp_stats_callback_;
|
||||||
StreamDataCountersCallback* rtp_stats_callback_;
|
StreamDataCountersCallback* rtp_stats_callback_;
|
||||||
|
Reference in New Issue
Block a user