Reland "Delete test/constants.h"

This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6.

Reason for revert: Failing tests fixed.

Original change's description:
> Revert "Delete test/constants.h"
>
> This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de.
>
> Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate
>
> Original change's description:
> > Delete test/constants.h
> >
> > It's not possible to use constants.h for all RTP extensions
> > after the number of extensions exceeds 14, which is the maximum
> > number of one-byte RTP extensions. This is because some extensions
> > would have to be assigned a number greater than 14, even if the
> > test only involves 14 extensions or less.
> >
> > For uniformity's sake, this CL also edits some files to use an
> > enum as the files involved in this CL, rather than free-floating
> > const-ints.
> >
> > Bug: webrtc:10288
> > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5
> > Reviewed-on: https://webrtc-review.googlesource.com/c/123048
> > Commit-Queue: Elad Alon <eladalon@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26728}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
>
> Bug: webrtc:10288, chromium:933127
> Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4
> Reviewed-on: https://webrtc-review.googlesource.com/c/123381
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26744}

TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org

Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954
Bug: webrtc:10288, chromium:933127
Reviewed-on: https://webrtc-review.googlesource.com/c/123384
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26750}
diff --git a/test/call_test.cc b/test/call_test.cc
index 57a5d9f..ca0d7bb 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -65,6 +65,29 @@
   });
 }
 
+void CallTest::RegisterRtpExtension(const RtpExtension& extension) {
+  for (const RtpExtension& registered_extension : rtp_extensions_) {
+    if (registered_extension.id == extension.id) {
+      ASSERT_EQ(registered_extension.uri, extension.uri)
+          << "Different URIs associated with ID " << extension.id << ".";
+      ASSERT_EQ(registered_extension.encrypt, extension.encrypt)
+          << "Encryption mismatch associated with ID " << extension.id << ".";
+      return;
+    } else {  // Different IDs.
+      // Different IDs referring to the same extension probably indicate
+      // a mistake in the test.
+      ASSERT_FALSE(registered_extension.uri == extension.uri &&
+                   registered_extension.encrypt == extension.encrypt)
+          << "URI " << extension.uri
+          << (extension.encrypt ? " with " : " without ")
+          << "encryption already registered with a different "
+          << "ID (" << extension.id << " vs. " << registered_extension.id
+          << ").";
+    }
+  }
+  rtp_extensions_.push_back(extension);
+}
+
 void CallTest::RunBaseTest(BaseTest* test) {
   task_queue_.SendTask([this, test]() {
     num_video_streams_ = test->GetNumVideoStreams();
@@ -235,25 +258,23 @@
   video_config->rtp.payload_name = "FAKE";
   video_config->rtp.payload_type = kFakeVideoSendPayloadType;
   video_config->rtp.extmap_allow_mixed = true;
-  video_config->rtp.extensions.push_back(
-      RtpExtension(RtpExtension::kTransportSequenceNumberUri,
-                   kTransportSequenceNumberExtensionId));
-  video_config->rtp.extensions.push_back(RtpExtension(
-      RtpExtension::kVideoContentTypeUri, kVideoContentTypeExtensionId));
-  video_config->rtp.extensions.push_back(RtpExtension(
-      RtpExtension::kGenericFrameDescriptorUri, kGenericDescriptorExtensionId));
+  AddRtpExtensionByUri(RtpExtension::kTransportSequenceNumberUri,
+                       &video_config->rtp.extensions);
+  AddRtpExtensionByUri(RtpExtension::kVideoContentTypeUri,
+                       &video_config->rtp.extensions);
+  AddRtpExtensionByUri(RtpExtension::kGenericFrameDescriptorUri,
+                       &video_config->rtp.extensions);
   if (video_encoder_configs_.empty()) {
     video_encoder_configs_.emplace_back();
     FillEncoderConfiguration(kVideoCodecGeneric, num_video_streams,
                              &video_encoder_configs_.back());
   }
-
   for (size_t i = 0; i < num_video_streams; ++i)
     video_config->rtp.ssrcs.push_back(kVideoSendSsrcs[num_used_ssrcs + i]);
-  video_config->rtp.extensions.push_back(
-      RtpExtension(RtpExtension::kVideoRotationUri, kVideoRotationExtensionId));
-  video_config->rtp.extensions.push_back(
-      RtpExtension(RtpExtension::kColorSpaceUri, kColorSpaceExtensionId));
+  AddRtpExtensionByUri(RtpExtension::kVideoRotationUri,
+                       &video_config->rtp.extensions);
+  AddRtpExtensionByUri(RtpExtension::kColorSpaceUri,
+                       &video_config->rtp.extensions);
 }
 
 void CallTest::CreateAudioAndFecSendConfigs(size_t num_audio_streams,
@@ -666,6 +687,25 @@
   return &flexfec_receive_configs_[0];
 }
 
+absl::optional<RtpExtension> CallTest::GetRtpExtensionByUri(
+    const std::string& uri) const {
+  for (const auto& extension : rtp_extensions_) {
+    if (extension.uri == uri) {
+      return extension;
+    }
+  }
+  return absl::nullopt;
+}
+
+void CallTest::AddRtpExtensionByUri(
+    const std::string& uri,
+    std::vector<RtpExtension>* extensions) const {
+  const absl::optional<RtpExtension> extension = GetRtpExtensionByUri(uri);
+  if (extension) {
+    extensions->push_back(*extension);
+  }
+}
+
 constexpr size_t CallTest::kNumSsrcs;
 const int CallTest::kDefaultWidth;
 const int CallTest::kDefaultHeight;