Add sanity checks to UpdateDelayStatistics and patch unit tests.
RtpPacket::UpdateDelayStatistics was previously optimized with several sanity checks added. These sanity checks caused many of the unit tests in peerconnection_integration_unittests to fail and the CL was therefore reverted. This CL contains the sanity checks along with patches so that the unit tests pass. Bug: webrtc:9439 Change-Id: Ia5f5e8b125e5f3f4b79d433e2282901143530a25 Reviewed-on: https://webrtc-review.googlesource.com/99802 Reviewed-by: Björn Terelius <terelius@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Johannes Kron <kron@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24813}
This commit is contained in:
committed by
Commit Bot
parent
bdbbc51b93
commit
965e7942a3
@ -11,6 +11,7 @@
|
||||
#include "modules/rtp_rtcp/source/rtp_sender.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@ -1011,7 +1012,15 @@ void RTPSender::UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms) {
|
||||
{
|
||||
rtc::CritScope cs(&statistics_crit_);
|
||||
// TODO(holmer): Compute this iteratively instead.
|
||||
send_delays_[now_ms] = now_ms - capture_time_ms;
|
||||
RTC_DCHECK_GE(now_ms, static_cast<int64_t>(0));
|
||||
RTC_DCHECK_LE(now_ms, std::numeric_limits<int64_t>::max() / 2);
|
||||
RTC_DCHECK_GE(capture_time_ms, static_cast<int64_t>(0));
|
||||
RTC_DCHECK_LE(capture_time_ms, std::numeric_limits<int64_t>::max() / 2);
|
||||
int64_t diff_ms = now_ms - capture_time_ms;
|
||||
RTC_DCHECK_GE(diff_ms, static_cast<int64_t>(0));
|
||||
RTC_DCHECK_LE(diff_ms,
|
||||
static_cast<int64_t>(std::numeric_limits<int>::max()));
|
||||
send_delays_[now_ms] = diff_ms;
|
||||
send_delays_.erase(
|
||||
send_delays_.begin(),
|
||||
send_delays_.lower_bound(now_ms - kSendSideDelayWindowMs));
|
||||
|
||||
Reference in New Issue
Block a user