Delete RtcpStatisticsCallback from ReceiveStatistics
Update VideoReceiveStream::GetStats to use StreamStatistician::GetStatistics instead, similarly to the audio receiver. Bug: webrtc:10679 Change-Id: I8a701e8a8e921c87895424362dc83500737c916d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/142233 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28793}
This commit is contained in:
@ -34,7 +34,6 @@ StreamStatisticianImpl::StreamStatisticianImpl(
|
||||
uint32_t ssrc,
|
||||
Clock* clock,
|
||||
int max_reordering_threshold,
|
||||
RtcpStatisticsCallback* rtcp_callback,
|
||||
StreamDataCountersCallback* rtp_callback)
|
||||
: ssrc_(ssrc),
|
||||
clock_(clock),
|
||||
@ -51,7 +50,6 @@ StreamStatisticianImpl::StreamStatisticianImpl(
|
||||
last_report_inorder_packets_(0),
|
||||
last_report_old_packets_(0),
|
||||
last_report_seq_max_(-1),
|
||||
rtcp_callback_(rtcp_callback),
|
||||
rtp_callback_(rtp_callback) {}
|
||||
|
||||
StreamStatisticianImpl::~StreamStatisticianImpl() = default;
|
||||
@ -181,48 +179,40 @@ void StreamStatisticianImpl::EnableRetransmitDetection(bool enable) {
|
||||
|
||||
bool StreamStatisticianImpl::GetStatistics(RtcpStatistics* statistics,
|
||||
bool reset) {
|
||||
{
|
||||
rtc::CritScope cs(&stream_lock_);
|
||||
if (!ReceivedRtpPacket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reset) {
|
||||
if (last_report_inorder_packets_ == 0) {
|
||||
// No report.
|
||||
return false;
|
||||
}
|
||||
// Just get last report.
|
||||
*statistics = last_reported_statistics_;
|
||||
return true;
|
||||
}
|
||||
|
||||
*statistics = CalculateRtcpStatistics();
|
||||
rtc::CritScope cs(&stream_lock_);
|
||||
if (!ReceivedRtpPacket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rtcp_callback_)
|
||||
rtcp_callback_->StatisticsUpdated(*statistics, ssrc_);
|
||||
if (!reset) {
|
||||
if (last_report_inorder_packets_ == 0) {
|
||||
// No report.
|
||||
return false;
|
||||
}
|
||||
// Just get last report.
|
||||
*statistics = last_reported_statistics_;
|
||||
return true;
|
||||
}
|
||||
|
||||
*statistics = CalculateRtcpStatistics();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StreamStatisticianImpl::GetActiveStatisticsAndReset(
|
||||
RtcpStatistics* statistics) {
|
||||
{
|
||||
rtc::CritScope cs(&stream_lock_);
|
||||
if (clock_->TimeInMilliseconds() - last_receive_time_ms_ >=
|
||||
kStatisticsTimeoutMs) {
|
||||
// Not active.
|
||||
return false;
|
||||
}
|
||||
if (!ReceivedRtpPacket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*statistics = CalculateRtcpStatistics();
|
||||
rtc::CritScope cs(&stream_lock_);
|
||||
if (clock_->TimeInMilliseconds() - last_receive_time_ms_ >=
|
||||
kStatisticsTimeoutMs) {
|
||||
// Not active.
|
||||
return false;
|
||||
}
|
||||
if (!ReceivedRtpPacket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rtcp_callback_)
|
||||
rtcp_callback_->StatisticsUpdated(*statistics, ssrc_);
|
||||
*statistics = CalculateRtcpStatistics();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -355,22 +345,26 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
|
||||
return time_diff_ms > rtp_time_stamp_diff_ms + max_delay_ms;
|
||||
}
|
||||
|
||||
std::unique_ptr<ReceiveStatistics> ReceiveStatistics::Create(
|
||||
Clock* clock,
|
||||
StreamDataCountersCallback* rtp_callback) {
|
||||
return absl::make_unique<ReceiveStatisticsImpl>(clock, rtp_callback);
|
||||
}
|
||||
|
||||
std::unique_ptr<ReceiveStatistics> ReceiveStatistics::Create(
|
||||
Clock* clock,
|
||||
RtcpStatisticsCallback* rtcp_callback,
|
||||
StreamDataCountersCallback* rtp_callback) {
|
||||
return absl::make_unique<ReceiveStatisticsImpl>(clock, rtcp_callback,
|
||||
rtp_callback);
|
||||
RTC_CHECK(rtcp_callback == nullptr);
|
||||
return Create(clock, rtp_callback);
|
||||
}
|
||||
|
||||
ReceiveStatisticsImpl::ReceiveStatisticsImpl(
|
||||
Clock* clock,
|
||||
RtcpStatisticsCallback* rtcp_callback,
|
||||
StreamDataCountersCallback* rtp_callback)
|
||||
: clock_(clock),
|
||||
last_returned_ssrc_(0),
|
||||
max_reordering_threshold_(kDefaultMaxReorderingThreshold),
|
||||
rtcp_stats_callback_(rtcp_callback),
|
||||
rtp_stats_callback_(rtp_callback) {}
|
||||
|
||||
ReceiveStatisticsImpl::~ReceiveStatisticsImpl() {
|
||||
@ -410,9 +404,8 @@ StreamStatisticianImpl* ReceiveStatisticsImpl::GetOrCreateStatistician(
|
||||
rtc::CritScope cs(&receive_statistics_lock_);
|
||||
StreamStatisticianImpl*& impl = statisticians_[ssrc];
|
||||
if (impl == nullptr) { // new element
|
||||
impl =
|
||||
new StreamStatisticianImpl(ssrc, clock_, max_reordering_threshold_,
|
||||
rtcp_stats_callback_, rtp_stats_callback_);
|
||||
impl = new StreamStatisticianImpl(ssrc, clock_, max_reordering_threshold_,
|
||||
rtp_stats_callback_);
|
||||
}
|
||||
return impl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user