Move TimestampExtrapolator closer to its single user

The `TimestampExtrapolator` is only used by the `VCMTiming`
class, despite there being references to it from both
`modules/rtp_rtcp/BUILD.gn` and `modules/video_coding/BUILD.gn`.

Bug: webrtc:14111
Change-Id: If1a02a56a0c83b13d619ca08dc76c884fa829369
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275482
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Johannes Kron <kron@webrtc.org>
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38093}
diff --git a/BUILD.gn b/BUILD.gn
index 4146db8..fd5b799 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -585,7 +585,6 @@
       "rtc_base/experiments:experiments_unittests",
       "rtc_base/system:file_wrapper_unittests",
       "rtc_base/task_utils:repeating_task_unittests",
-      "rtc_base/time:timestamp_extrapolator_unittests",
       "rtc_base/units:units_unittests",
       "sdk:sdk_tests",
       "test:rtp_test_utils",
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index 0107606..c72a2fc 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -319,7 +319,6 @@
     "../../rtc_base/synchronization:mutex",
     "../../rtc_base/system:no_unique_address",
     "../../rtc_base/task_utils:repeating_task",
-    "../../rtc_base/time:timestamp_extrapolator",
     "../../system_wrappers",
     "../../system_wrappers:metrics",
     "../remote_bitrate_estimator",
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index c73e011..0a3af1b 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -292,7 +292,6 @@
     "../../rtc_base/system:no_unique_address",
     "../../rtc_base/task_utils:repeating_task",
     "../../rtc_base/third_party/base64",
-    "../../rtc_base/time:timestamp_extrapolator",
     "../../system_wrappers",
     "../../system_wrappers:field_trial",
     "../../system_wrappers:metrics",
diff --git a/modules/video_coding/timing/BUILD.gn b/modules/video_coding/timing/BUILD.gn
index d2479ae..ee05223 100644
--- a/modules/video_coding/timing/BUILD.gn
+++ b/modules/video_coding/timing/BUILD.gn
@@ -84,6 +84,18 @@
   ]
 }
 
+rtc_library("timestamp_extrapolator") {
+  sources = [
+    "timestamp_extrapolator.cc",
+    "timestamp_extrapolator.h",
+  ]
+  deps = [
+    "../../../api/units:timestamp",
+    "../../../modules:module_api_public",
+  ]
+  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+}
+
 rtc_library("timing_module") {
   sources = [
     "timing.cc",
@@ -91,6 +103,7 @@
   ]
   deps = [
     ":codec_timer",
+    ":timestamp_extrapolator",
     "../../../api:field_trials_view",
     "../../../api/units:time_delta",
     "../../../api/video:video_frame",
@@ -100,7 +113,6 @@
     "../../../rtc_base:rtc_numerics",
     "../../../rtc_base/experiments:field_trial_parser",
     "../../../rtc_base/synchronization:mutex",
-    "../../../rtc_base/time:timestamp_extrapolator",
     "../../../system_wrappers",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
@@ -113,6 +125,7 @@
     "inter_frame_delay_unittest.cc",
     "jitter_estimator_unittest.cc",
     "rtt_filter_unittest.cc",
+    "timestamp_extrapolator_unittest.cc",
     "timing_unittest.cc",
   ]
   deps = [
@@ -120,6 +133,7 @@
     ":inter_frame_delay",
     ":jitter_estimator",
     ":rtt_filter",
+    ":timestamp_extrapolator",
     ":timing_module",
     "../../../api:array_view",
     "../../../api:field_trials",
diff --git a/rtc_base/time/timestamp_extrapolator.cc b/modules/video_coding/timing/timestamp_extrapolator.cc
similarity index 98%
rename from rtc_base/time/timestamp_extrapolator.cc
rename to modules/video_coding/timing/timestamp_extrapolator.cc
index 4f8fe0a..d13fa7d 100644
--- a/rtc_base/time/timestamp_extrapolator.cc
+++ b/modules/video_coding/timing/timestamp_extrapolator.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "rtc_base/time/timestamp_extrapolator.h"
+#include "modules/video_coding/timing/timestamp_extrapolator.h"
 
 #include <algorithm>
 
diff --git a/rtc_base/time/timestamp_extrapolator.h b/modules/video_coding/timing/timestamp_extrapolator.h
similarity index 86%
rename from rtc_base/time/timestamp_extrapolator.h
rename to modules/video_coding/timing/timestamp_extrapolator.h
index 23e7975..b7162ed 100644
--- a/rtc_base/time/timestamp_extrapolator.h
+++ b/modules/video_coding/timing/timestamp_extrapolator.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
-#define RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
+#ifndef MODULES_VIDEO_CODING_TIMING_TIMESTAMP_EXTRAPOLATOR_H_
+#define MODULES_VIDEO_CODING_TIMING_TIMESTAMP_EXTRAPOLATOR_H_
 
 #include <stdint.h>
 
@@ -45,4 +45,4 @@
 
 }  // namespace webrtc
 
-#endif  // RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
+#endif  // MODULES_VIDEO_CODING_TIMING_TIMESTAMP_EXTRAPOLATOR_H_
diff --git a/rtc_base/time/timestamp_extrapolator_unittest.cc b/modules/video_coding/timing/timestamp_extrapolator_unittest.cc
similarity index 98%
rename from rtc_base/time/timestamp_extrapolator_unittest.cc
rename to modules/video_coding/timing/timestamp_extrapolator_unittest.cc
index b153d7a..bb24f92 100644
--- a/rtc_base/time/timestamp_extrapolator_unittest.cc
+++ b/modules/video_coding/timing/timestamp_extrapolator_unittest.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "rtc_base/time/timestamp_extrapolator.h"
+#include "modules/video_coding/timing/timestamp_extrapolator.h"
 
 #include <stdint.h>
 
diff --git a/modules/video_coding/timing/timing.cc b/modules/video_coding/timing/timing.cc
index 37dc825..0b61d5a 100644
--- a/modules/video_coding/timing/timing.cc
+++ b/modules/video_coding/timing/timing.cc
@@ -13,9 +13,9 @@
 #include <algorithm>
 
 #include "api/units/time_delta.h"
+#include "modules/video_coding/timing/timestamp_extrapolator.h"
 #include "rtc_base/experiments/field_trial_parser.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/time/timestamp_extrapolator.h"
 #include "system_wrappers/include/clock.h"
 
 namespace webrtc {
diff --git a/modules/video_coding/timing/timing.h b/modules/video_coding/timing/timing.h
index 6ee1cf4..7a8183d 100644
--- a/modules/video_coding/timing/timing.h
+++ b/modules/video_coding/timing/timing.h
@@ -19,10 +19,10 @@
 #include "api/video/video_frame.h"
 #include "api/video/video_timing.h"
 #include "modules/video_coding/timing/codec_timer.h"
+#include "modules/video_coding/timing/timestamp_extrapolator.h"
 #include "rtc_base/experiments/field_trial_parser.h"
 #include "rtc_base/synchronization/mutex.h"
 #include "rtc_base/thread_annotations.h"
-#include "rtc_base/time/timestamp_extrapolator.h"
 
 namespace webrtc {
 
diff --git a/rtc_base/time/BUILD.gn b/rtc_base/time/BUILD.gn
deleted file mode 100644
index bac649e..0000000
--- a/rtc_base/time/BUILD.gn
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS.  All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-import("../../webrtc.gni")
-if (is_android) {
-  import("//build/config/android/config.gni")
-  import("//build/config/android/rules.gni")
-}
-
-rtc_library("timestamp_extrapolator") {
-  sources = [
-    "timestamp_extrapolator.cc",
-    "timestamp_extrapolator.h",
-  ]
-  deps = [
-    "../../api/units:timestamp",
-    "../../modules:module_api_public",
-  ]
-  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
-}
-
-if (rtc_include_tests) {
-  rtc_library("timestamp_extrapolator_unittests") {
-    testonly = true
-    sources = [ "timestamp_extrapolator_unittest.cc" ]
-    deps = [
-      ":timestamp_extrapolator",
-      "../../api/units:frequency",
-      "../../api/units:time_delta",
-      "../../api/units:timestamp",
-      "../../system_wrappers",
-      "../../test:test_support",
-    ]
-    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
-  }
-}