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}
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index d9fa1d5..dd977b4 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -61,6 +61,7 @@
 #include "rtc_base/gunit.h"
 #include "rtc_base/numerics/safe_conversions.h"
 #include "rtc_base/testcertificateverifier.h"
+#include "rtc_base/timeutils.h"
 #include "rtc_base/virtualsocketserver.h"
 #include "system_wrappers/include/metrics_default.h"
 #include "test/gmock.h"
@@ -348,8 +349,9 @@
   }
 
   rtc::scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack() {
-    return CreateLocalVideoTrackInternal(
-        webrtc::FakePeriodicVideoSource::Config());
+    webrtc::FakePeriodicVideoSource::Config config;
+    config.timestamp_offset_ms = rtc::TimeMillis();
+    return CreateLocalVideoTrackInternal(config);
   }
 
   rtc::scoped_refptr<webrtc::VideoTrackInterface>
@@ -362,6 +364,7 @@
   CreateLocalVideoTrackWithRotation(webrtc::VideoRotation rotation) {
     webrtc::FakePeriodicVideoSource::Config config;
     config.rotation = rotation;
+    config.timestamp_offset_ms = rtc::TimeMillis();
     return CreateLocalVideoTrackInternal(config);
   }
 
@@ -1836,6 +1839,7 @@
   webrtc::FakePeriodicVideoSource::Config config;
   config.width = 1280;
   config.height = 720;
+  config.timestamp_offset_ms = rtc::TimeMillis();
   caller()->AddTrack(caller()->CreateLocalVideoTrackWithConfig(config));
   callee()->AddTrack(callee()->CreateLocalVideoTrackWithConfig(config));