Refactor media constants to inline constexpr absl::string_view

This CL converts most string constants in media/base/media_constants.h
to inline constexpr absl::string_view, moving their definitions to the
header file. Constants marked with RTC_EXPORT are preserved as
extern const char[] for ABI compatibility.

Infrastructure updates:
- Updated CodecParameterMap to use a transparent comparator (std::less<>)
  allowing lookups with string_view.
- Updated Codec, SdpVideoFormat, and SdpAudioFormat to better handle
  absl::string_view in constructors and parameter methods.
- systemically updated downstream call sites to use SetParam or explicit
  std::string conversions where necessary.

Bug: webrtc:42223790
Change-Id: I017fd4e6c85b072a8d31aa0aec09cb1264464627
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/467720
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#48098}
diff --git a/api/audio_codecs/audio_format.cc b/api/audio_codecs/audio_format.cc
index c83e631..2073a8d 100644
--- a/api/audio_codecs/audio_format.cc
+++ b/api/audio_codecs/audio_format.cc
@@ -11,6 +11,7 @@
 #include "api/audio_codecs/audio_format.h"
 
 #include <cstddef>
+#include <initializer_list>
 #include <utility>
 
 #include "absl/strings/match.h"
@@ -37,6 +38,17 @@
       num_channels(num_channels),
       parameters(param) {}
 
+SdpAudioFormat::SdpAudioFormat(
+    absl::string_view name,
+    int clockrate_hz,
+    size_t num_channels,
+    std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+        param)
+    : name(name),
+      clockrate_hz(clockrate_hz),
+      num_channels(num_channels),
+      parameters(param.begin(), param.end()) {}
+
 SdpAudioFormat::SdpAudioFormat(absl::string_view name,
                                int clockrate_hz,
                                size_t num_channels,
diff --git a/api/audio_codecs/audio_format.h b/api/audio_codecs/audio_format.h
index d390b19..78aa48b 100644
--- a/api/audio_codecs/audio_format.h
+++ b/api/audio_codecs/audio_format.h
@@ -13,7 +13,9 @@
 
 #include <stddef.h>
 
+#include <initializer_list>
 #include <string>
+#include <utility>
 
 #include "absl/strings/string_view.h"
 #include "api/rtp_parameters.h"
@@ -32,6 +34,12 @@
                  int clockrate_hz,
                  size_t num_channels,
                  const CodecParameterMap& param);
+  SdpAudioFormat(
+      absl::string_view name,
+      int clockrate_hz,
+      size_t num_channels,
+      std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+          param);
   SdpAudioFormat(absl::string_view name,
                  int clockrate_hz,
                  size_t num_channels,
diff --git a/api/rtp_parameters.h b/api/rtp_parameters.h
index a6810fb..5b6a081 100644
--- a/api/rtp_parameters.h
+++ b/api/rtp_parameters.h
@@ -23,9 +23,11 @@
 #include <stdint.h>
 
 #include <cstddef>
+#include <initializer_list>
 #include <map>
 #include <optional>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "absl/base/macros.h"
@@ -47,7 +49,43 @@
 
 class StringBuilder;
 
-using CodecParameterMap = std::map<std::string, std::string>;
+struct RTC_EXPORT CodecParameterMap
+    : public std::map<std::string, std::string> {
+  using std::map<std::string, std::string>::map;
+
+  CodecParameterMap() = default;
+  CodecParameterMap(const CodecParameterMap&) = default;
+  CodecParameterMap(CodecParameterMap&&) = default;
+  CodecParameterMap& operator=(const CodecParameterMap&) = default;
+  CodecParameterMap& operator=(CodecParameterMap&&) = default;
+
+  // TODO(bugs.webrtc.org/42223790): Remove these implicit converters when
+  // downstream projects have been updated to not rely on them.
+  CodecParameterMap(
+      const std::map<std::string, std::string>& o)  // NOLINT(runtime/explicit)
+      : std::map<std::string, std::string>(o) {}
+  CodecParameterMap(
+      std::map<std::string, std::string>&& o)  // NOLINT(runtime/explicit)
+      : std::map<std::string, std::string>(std::move(o)) {}
+
+  CodecParameterMap(
+      std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+          il) {
+    for (const auto& p : il) {
+      emplace(p.first, p.second);
+    }
+  }
+
+  CodecParameterMap& operator=(
+      std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+          il) {
+    clear();
+    for (const auto& p : il) {
+      emplace(p.first, p.second);
+    }
+    return *this;
+  }
+};
 
 enum class FecMechanism {
   RED,
@@ -207,7 +245,7 @@
   //
   // Corresponds to "a=fmtp" parameters in SDP. The keys are lowercase strings.
   // Boolean values are represented by the string "1".
-  std::map<std::string, std::string> parameters;
+  CodecParameterMap parameters;
 
   bool operator==(const RtpCodec& o) const {
     return name == o.name && kind == o.kind && clock_rate == o.clock_rate &&
diff --git a/api/rtp_parameters_unittest.cc b/api/rtp_parameters_unittest.cc
index 506ecb6..b536f75 100644
--- a/api/rtp_parameters_unittest.cc
+++ b/api/rtp_parameters_unittest.cc
@@ -16,13 +16,18 @@
 #include <vector>
 
 #include "absl/strings/str_cat.h"
+#include "absl/strings/string_view.h"
 #include "api/rtp_header_extension_id.h"
 #include "rtc_base/checks.h"
+#include "test/gmock.h"
 #include "test/gtest.h"
 
 namespace webrtc {
 
 namespace {
+
+using ::testing::Pair;
+using ::testing::UnorderedElementsAre;
 RtpParameters CreateRtpParametersWithCodecs(
     const std::vector<bool>& active,
     const std::vector<std::optional<RtpCodec>>& codecs) {
@@ -402,5 +407,23 @@
   EXPECT_EQ(absl::StrCat(ext), "[1 http://example.com/test\\r\\n\\\\foo]");
 }
 
+TEST(CodecParameterMapTest, InitializerListWithAbslStringView) {
+  absl::string_view key1 = "key1";
+  absl::string_view val1 = "val1";
+  absl::string_view key2 = "key2";
+  absl::string_view val2 = "val2";
+
+  // Test constructor
+  CodecParameterMap map1 = {{key1, val1}, {key2, val2}};
+  EXPECT_THAT(map1,
+              UnorderedElementsAre(Pair("key1", "val1"), Pair("key2", "val2")));
+
+  // Test assignment
+  CodecParameterMap map2;
+  map2 = {{key1, val2}, {key2, val1}};
+  EXPECT_THAT(map2,
+              UnorderedElementsAre(Pair("key1", "val2"), Pair("key2", "val1")));
+}
+
 }  // namespace
 }  // namespace webrtc
diff --git a/api/test/pclf/media_configuration.cc b/api/test/pclf/media_configuration.cc
index 1ce3f2a..22fa391 100644
--- a/api/test/pclf/media_configuration.cc
+++ b/api/test/pclf/media_configuration.cc
@@ -22,6 +22,7 @@
 #include <vector>
 
 #include "absl/strings/string_view.h"
+#include "api/rtp_parameters.h"
 #include "api/test/video/video_frame_writer.h"
 #include "api/units/time_delta.h"
 #include "rtc_base/checks.h"
@@ -223,9 +224,8 @@
 VideoCodecConfig::VideoCodecConfig(absl::string_view name)
     : name(name), required_params() {}
 
-VideoCodecConfig::VideoCodecConfig(
-    absl::string_view name,
-    std::map<std::string, std::string> required_params)
+VideoCodecConfig::VideoCodecConfig(absl::string_view name,
+                                   CodecParameterMap required_params)
     : name(name), required_params(std::move(required_params)) {}
 
 std::optional<VideoResolution> VideoSubscription::GetMaxResolution(
diff --git a/api/test/pclf/media_configuration.h b/api/test/pclf/media_configuration.h
index c39978a..2dcf273 100644
--- a/api/test/pclf/media_configuration.h
+++ b/api/test/pclf/media_configuration.h
@@ -370,8 +370,7 @@
 
 struct VideoCodecConfig {
   explicit VideoCodecConfig(absl::string_view name);
-  VideoCodecConfig(absl::string_view name,
-                   std::map<std::string, std::string> required_params);
+  VideoCodecConfig(absl::string_view name, CodecParameterMap required_params);
   // Next two fields are used to specify concrete video codec, that should be
   // used in the test. Video code will be negotiated in SDP during offer/
   // answer exchange.
@@ -384,7 +383,7 @@
   // a parameter with name equal to this key and parameter value will be equal
   // to the value from `required_params` for this key.
   // If empty then only name will be used to match the codec.
-  std::map<std::string, std::string> required_params;
+  CodecParameterMap required_params;
 };
 
 // Subscription to the remote video streams. It declares which remote stream
diff --git a/api/video_codecs/av1_profile.cc b/api/video_codecs/av1_profile.cc
index 1cbe9ab..ea423f2 100644
--- a/api/video_codecs/av1_profile.cc
+++ b/api/video_codecs/av1_profile.cc
@@ -52,7 +52,7 @@
 
 std::optional<AV1Profile> ParseSdpForAV1Profile(
     const CodecParameterMap& params) {
-  const auto profile_it = params.find(kAv1FmtpProfile);
+  const auto profile_it = params.find(std::string(kAv1FmtpProfile));
   if (profile_it == params.end())
     return AV1Profile::kProfile0;
   const std::string& profile_str = profile_it->second;
diff --git a/api/video_codecs/sdp_video_format.cc b/api/video_codecs/sdp_video_format.cc
index 8b62f14..b6736c3 100644
--- a/api/video_codecs/sdp_video_format.cc
+++ b/api/video_codecs/sdp_video_format.cc
@@ -10,12 +10,15 @@
 
 #include "api/video_codecs/sdp_video_format.h"
 
+#include <initializer_list>
 #include <optional>
 #include <span>
 #include <string>
+#include <utility>
 
 #include "absl/container/inlined_vector.h"
 #include "absl/strings/match.h"
+#include "absl/strings/string_view.h"
 #include "api/rtp_parameters.h"
 #include "api/video/video_codec_type.h"
 #include "api/video_codecs/av1_profile.h"
@@ -110,27 +113,41 @@
 
 }  // namespace
 
-SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {}
+SdpVideoFormat::SdpVideoFormat(absl::string_view name) : name(name) {}
 
-SdpVideoFormat::SdpVideoFormat(const std::string& name,
+SdpVideoFormat::SdpVideoFormat(absl::string_view name,
                                const CodecParameterMap& parameters)
     : name(name), parameters(parameters) {}
 
 SdpVideoFormat::SdpVideoFormat(
-    const std::string& name,
+    absl::string_view name,
+    std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+        parameters)
+    : name(name), parameters(parameters.begin(), parameters.end()) {}
+
+SdpVideoFormat::SdpVideoFormat(
+    absl::string_view name,
     const CodecParameterMap& parameters,
-    const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
-        scalability_modes)
+    std::span<const ScalabilityMode> scalability_modes)
     : name(name),
       parameters(parameters),
-      scalability_modes(scalability_modes) {}
+      scalability_modes(scalability_modes.begin(), scalability_modes.end()) {}
+
+SdpVideoFormat::SdpVideoFormat(
+    absl::string_view name,
+    std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+        parameters,
+    std::span<const ScalabilityMode> scalability_modes)
+    : name(name),
+      parameters(parameters.begin(), parameters.end()),
+      scalability_modes(scalability_modes.begin(), scalability_modes.end()) {}
 
 SdpVideoFormat::SdpVideoFormat(
     const SdpVideoFormat& format,
-    const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>& modes)
-    : SdpVideoFormat(format) {
-  scalability_modes = modes;
-}
+    std::span<const ScalabilityMode> scalability_modes)
+    : name(format.name),
+      parameters(format.parameters),
+      scalability_modes(scalability_modes.begin(), scalability_modes.end()) {}
 
 SdpVideoFormat::SdpVideoFormat(const SdpVideoFormat&) = default;
 SdpVideoFormat::SdpVideoFormat(SdpVideoFormat&&) = default;
diff --git a/api/video_codecs/sdp_video_format.h b/api/video_codecs/sdp_video_format.h
index 6f1b7a6..6957b58 100644
--- a/api/video_codecs/sdp_video_format.h
+++ b/api/video_codecs/sdp_video_format.h
@@ -11,12 +11,15 @@
 #ifndef API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_
 #define API_VIDEO_CODECS_SDP_VIDEO_FORMAT_H_
 
+#include <initializer_list>
 #include <map>
 #include <optional>
 #include <span>
 #include <string>
+#include <utility>
 
 #include "absl/container/inlined_vector.h"
+#include "absl/strings/string_view.h"
 #include "api/rtp_parameters.h"
 #include "api/video_codecs/scalability_mode.h"
 #include "rtc_base/system/rtc_export.h"
@@ -29,20 +32,44 @@
   using Parameters [[deprecated("Use CodecParameterMap")]] =
       std::map<std::string, std::string>;
 
-  explicit SdpVideoFormat(const std::string& name);
-  SdpVideoFormat(const std::string& name, const CodecParameterMap& parameters);
+  explicit SdpVideoFormat(absl::string_view name);
+  SdpVideoFormat(absl::string_view name, const CodecParameterMap& parameters);
   SdpVideoFormat(
-      const std::string& name,
-      const CodecParameterMap& parameters,
-      const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
-          scalability_modes);
+      absl::string_view name,
+      std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+          parameters);
+  SdpVideoFormat(absl::string_view name,
+                 const CodecParameterMap& parameters,
+                 std::span<const ScalabilityMode> scalability_modes);
+  SdpVideoFormat(
+      absl::string_view name,
+      std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+          parameters,
+      std::span<const ScalabilityMode> scalability_modes);
   // Creates a new SdpVideoFormat object identical to the supplied
   // SdpVideoFormat except the scalability_modes that are set to be the same as
   // the supplied scalability modes.
+  SdpVideoFormat(const SdpVideoFormat& format,
+                 std::span<const ScalabilityMode> scalability_modes);
+
+  SdpVideoFormat(absl::string_view name,
+                 const CodecParameterMap& parameters,
+                 std::initializer_list<ScalabilityMode> scalability_modes)
+      : SdpVideoFormat(name,
+                       parameters,
+                       std::span<const ScalabilityMode>(scalability_modes)) {}
   SdpVideoFormat(
-      const SdpVideoFormat& format,
-      const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
-          scalability_modes);
+      absl::string_view name,
+      std::initializer_list<std::pair<absl::string_view, absl::string_view>>
+          parameters,
+      std::initializer_list<ScalabilityMode> scalability_modes)
+      : SdpVideoFormat(name,
+                       parameters,
+                       std::span<const ScalabilityMode>(scalability_modes)) {}
+  SdpVideoFormat(const SdpVideoFormat& format,
+                 std::initializer_list<ScalabilityMode> scalability_modes)
+      : SdpVideoFormat(format,
+                       std::span<const ScalabilityMode>(scalability_modes)) {}
 
   SdpVideoFormat(const SdpVideoFormat&);
   SdpVideoFormat(SdpVideoFormat&&);
diff --git a/api/webrtc_sdp.cc b/api/webrtc_sdp.cc
index 895a5cb..f657f33 100644
--- a/api/webrtc_sdp.cc
+++ b/api/webrtc_sdp.cc
@@ -1059,10 +1059,10 @@
   return true;
 }
 
-bool GetParameter(const std::string& name,
+bool GetParameter(absl::string_view name,
                   const CodecParameterMap& params,
                   int* value) {
-  std::map<std::string, std::string>::const_iterator found = params.find(name);
+  CodecParameterMap::const_iterator found = params.find(std::string(name));
   if (found == params.end()) {
     return false;
   }
@@ -2615,7 +2615,7 @@
   }
 }
 
-void AddAudioAttribute(const std::string& name,
+void AddAudioAttribute(absl::string_view name,
                        absl::string_view value,
                        MediaContentDescription* desc) {
   RTC_DCHECK(desc);
@@ -2624,7 +2624,7 @@
   }
   std::vector<Codec> codecs = desc->codecs();
   for (Codec& codec : codecs) {
-    codec.params[name] = std::string(value);
+    codec.SetParam(name, value);
   }
   desc->set_codecs(codecs);
 }
diff --git a/media/BUILD.gn b/media/BUILD.gn
index ed10a5e..82ed3bf 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -377,7 +377,10 @@
     "base/media_constants.cc",
     "base/media_constants.h",
   ]
-  deps = [ "../rtc_base/system:rtc_export" ]
+  deps = [
+    "../rtc_base/system:rtc_export",
+    "//third_party/abseil-cpp/absl/strings:string_view",
+  ]
 }
 
 rtc_library("turn_utils") {
diff --git a/media/base/codec.cc b/media/base/codec.cc
index 8b7da35..0420c2a 100644
--- a/media/base/codec.cc
+++ b/media/base/codec.cc
@@ -21,6 +21,7 @@
 #include "absl/algorithm/container.h"
 #include "absl/strings/match.h"
 #include "absl/strings/str_cat.h"
+#include "absl/strings/string_view.h"
 #include "api/audio_codecs/audio_format.h"
 #include "api/field_trials_view.h"
 #include "api/media_types.h"
@@ -170,31 +171,31 @@
           codec_parameters.parameters == codec_capability.parameters);
 }
 
-bool Codec::GetParam(const std::string& key, std::string* out) const {
-  CodecParameterMap::const_iterator iter = params.find(key);
+bool Codec::GetParam(absl::string_view key, std::string* out) const {
+  CodecParameterMap::const_iterator iter = params.find(std::string(key));
   if (iter == params.end())
     return false;
   *out = iter->second;
   return true;
 }
 
-bool Codec::GetParam(const std::string& key, int* out) const {
-  CodecParameterMap::const_iterator iter = params.find(key);
+bool Codec::GetParam(absl::string_view key, int* out) const {
+  CodecParameterMap::const_iterator iter = params.find(std::string(key));
   if (iter == params.end())
     return false;
   return FromString(iter->second, out);
 }
 
-void Codec::SetParam(const std::string& key, const std::string& value) {
-  params[key] = value;
+void Codec::SetParam(absl::string_view key, absl::string_view value) {
+  params[std::string(key)] = std::string(value);
 }
 
-void Codec::SetParam(const std::string& key, int value) {
-  params[key] = absl::StrCat(value);
+void Codec::SetParam(absl::string_view key, int value) {
+  params[std::string(key)] = absl::StrCat(value);
 }
 
-bool Codec::RemoveParam(const std::string& key) {
-  return params.erase(key) == 1;
+bool Codec::RemoveParam(absl::string_view key) {
+  return params.erase(std::string(key)) == 1;
 }
 
 void Codec::AddFeedbackParam(const FeedbackParam& param) {
@@ -436,22 +437,22 @@
 }
 
 Codec CreateAudioCodec(PayloadType id,
-                       const std::string& name,
+                       absl::string_view name,
                        int clockrate,
                        size_t channels) {
-  return Codec(Codec::Type::kAudio, id, name, clockrate, channels);
+  return Codec(Codec::Type::kAudio, id, std::string(name), clockrate, channels);
 }
 
 Codec CreateAudioCodec(const SdpAudioFormat& c) {
   return Codec(c);
 }
 
-Codec CreateVideoCodec(const std::string& name) {
+Codec CreateVideoCodec(absl::string_view name) {
   return CreateVideoCodec(PayloadType::NotSet(), name);
 }
 
-Codec CreateVideoCodec(PayloadType id, const std::string& name) {
-  Codec c(Codec::Type::kVideo, id, name, kVideoCodecClockrate);
+Codec CreateVideoCodec(PayloadType id, absl::string_view name) {
+  Codec c(Codec::Type::kVideo, id, std::string(name), kVideoCodecClockrate);
   if (absl::EqualsIgnoreCase(kH264CodecName, name)) {
     // This default is set for all H.264 codecs created because
     // that was the default before packetization mode support was added.
diff --git a/media/base/codec.h b/media/base/codec.h
index 6d5f23e..8334947 100644
--- a/media/base/codec.h
+++ b/media/base/codec.h
@@ -33,7 +33,7 @@
 class FeedbackParam {
  public:
   FeedbackParam() = default;
-  FeedbackParam(absl::string_view id, const std::string& param)
+  FeedbackParam(absl::string_view id, absl::string_view param)
       : id_(id), param_(param) {}
   explicit FeedbackParam(absl::string_view id)
       : id_(id), param_(kParamValueEmpty) {}
@@ -142,15 +142,15 @@
   bool MatchesRtpCodec(const RtpCodec& capability) const;
 
   // Find the parameter for `key` and write the value to `out`.
-  bool GetParam(const std::string& key, std::string* out) const;
-  bool GetParam(const std::string& key, int* out) const;
+  bool GetParam(absl::string_view key, std::string* out) const;
+  bool GetParam(absl::string_view key, int* out) const;
 
-  void SetParam(const std::string& key, const std::string& value);
-  void SetParam(const std::string& key, int value);
+  void SetParam(absl::string_view key, absl::string_view value);
+  void SetParam(absl::string_view key, int value);
 
   // It is safe to input a non-existent parameter.
   // Returns true if the parameter existed, false if it did not exist.
-  bool RemoveParam(const std::string& key);
+  bool RemoveParam(absl::string_view key);
 
   bool HasFeedbackParam(const FeedbackParam& param) const;
   void AddFeedbackParam(const FeedbackParam& param);
@@ -225,13 +225,13 @@
   explicit Codec(const SdpVideoFormat& c);
 
   friend Codec CreateAudioCodec(PayloadType id,
-                                const std::string& name,
+                                absl::string_view name,
                                 int clockrate,
                                 size_t channels);
   friend Codec CreateAudioCodec(const SdpAudioFormat& c);
   friend Codec CreateAudioRtxCodec(PayloadType rtx_payload_type,
                                    PayloadType associated_payload_type);
-  friend Codec CreateVideoCodec(PayloadType id, const std::string& name);
+  friend Codec CreateVideoCodec(PayloadType id, absl::string_view name);
   friend Codec CreateVideoCodec(const SdpVideoFormat& c);
   friend Codec CreateVideoCodec(PayloadType id, const SdpVideoFormat& sdp);
 };
@@ -239,14 +239,14 @@
 using Codecs = std::vector<Codec>;
 
 Codec CreateAudioCodec(PayloadType id,
-                       const std::string& name,
+                       absl::string_view name,
                        int clockrate,
                        size_t channels);
 Codec CreateAudioCodec(const SdpAudioFormat& c);
 Codec CreateAudioRtxCodec(PayloadType rtx_payload_type,
                           PayloadType associated_payload_type);
-Codec CreateVideoCodec(const std::string& name);
-Codec CreateVideoCodec(PayloadType id, const std::string& name);
+Codec CreateVideoCodec(absl::string_view name);
+Codec CreateVideoCodec(PayloadType id, absl::string_view name);
 Codec CreateVideoCodec(const SdpVideoFormat& c);
 Codec CreateVideoCodec(PayloadType id, const SdpVideoFormat& sdp);
 Codec CreateVideoRtxCodec(PayloadType rtx_payload_type,
diff --git a/media/base/codec_comparators.cc b/media/base/codec_comparators.cc
index c89ea5a..690e03e 100644
--- a/media/base/codec_comparators.cc
+++ b/media/base/codec_comparators.cc
@@ -40,17 +40,17 @@
 // TODO(bugs.webrtc.org/15847): remove code duplication of IsSameCodecSpecific
 // in api/video_codecs/sdp_video_format.cc
 std::string GetFmtpParameterOrDefault(const CodecParameterMap& params,
-                                      const std::string& name,
+                                      absl::string_view name,
                                       const std::string& default_value) {
-  const auto it = params.find(name);
+  const auto it = params.find(std::string(name));
   if (it != params.end()) {
     return it->second;
   }
   return default_value;
 }
 
-bool HasParameter(const CodecParameterMap& params, const std::string& name) {
-  return params.find(name) != params.end();
+bool HasParameter(const CodecParameterMap& params, absl::string_view name) {
+  return params.find(std::string(name)) != params.end();
 }
 
 std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
@@ -127,15 +127,15 @@
   return codec1 != nullptr && codec2 != nullptr && codec1->Matches(*codec2);
 }
 
-CodecParameterMap InsertDefaultParams(const std::string& name,
+CodecParameterMap InsertDefaultParams(absl::string_view name,
                                       const CodecParameterMap& params) {
   CodecParameterMap updated_params = params;
   if (absl::EqualsIgnoreCase(name, kVp9CodecName)) {
     if (!HasParameter(params, kVP9FmtpProfileId)) {
       if (std::optional<VP9Profile> default_profile =
               ParseSdpForVP9Profile({})) {
-        updated_params.insert(
-            {kVP9FmtpProfileId, VP9ProfileToString(*default_profile)});
+        updated_params.emplace(kVP9FmtpProfileId,
+                               VP9ProfileToString(*default_profile));
       }
     }
   }
@@ -143,21 +143,21 @@
     if (!HasParameter(params, kAv1FmtpProfile)) {
       if (std::optional<AV1Profile> default_profile =
               ParseSdpForAV1Profile({})) {
-        updated_params.insert(
-            {kAv1FmtpProfile, AV1ProfileToString(*default_profile).data()});
+        updated_params.emplace(kAv1FmtpProfile,
+                               AV1ProfileToString(*default_profile).data());
       }
     }
     if (!HasParameter(params, kAv1FmtpTier)) {
-      updated_params.insert({kAv1FmtpTier, AV1GetTierOrDefault({})});
+      updated_params.emplace(kAv1FmtpTier, AV1GetTierOrDefault({}));
     }
     if (!HasParameter(params, kAv1FmtpLevelIdx)) {
-      updated_params.insert({kAv1FmtpLevelIdx, AV1GetLevelIdxOrDefault({})});
+      updated_params.emplace(kAv1FmtpLevelIdx, AV1GetLevelIdxOrDefault({}));
     }
   }
   if (absl::EqualsIgnoreCase(name, kH264CodecName)) {
     if (!HasParameter(params, kH264FmtpPacketizationMode)) {
-      updated_params.insert(
-          {kH264FmtpPacketizationMode, H264GetPacketizationModeOrDefault({})});
+      updated_params.emplace(kH264FmtpPacketizationMode,
+                             H264GetPacketizationModeOrDefault({}));
     }
   }
 #ifdef RTC_ENABLE_H265
@@ -165,20 +165,20 @@
     if (std::optional<H265ProfileTierLevel> default_params =
             ParseSdpForH265ProfileTierLevel({})) {
       if (!HasParameter(params, kH265FmtpProfileId)) {
-        updated_params.insert(
-            {kH265FmtpProfileId, H265ProfileToString(default_params->profile)});
+        updated_params.emplace(kH265FmtpProfileId,
+                               H265ProfileToString(default_params->profile));
       }
       if (!HasParameter(params, kH265FmtpLevelId)) {
-        updated_params.insert(
-            {kH265FmtpLevelId, H265LevelToString(default_params->level)});
+        updated_params.emplace(kH265FmtpLevelId,
+                               H265LevelToString(default_params->level));
       }
       if (!HasParameter(params, kH265FmtpTierFlag)) {
-        updated_params.insert(
-            {kH265FmtpTierFlag, H265TierToString(default_params->tier)});
+        updated_params.emplace(kH265FmtpTierFlag,
+                               H265TierToString(default_params->tier));
       }
     }
     if (!HasParameter(params, kH265FmtpTxMode)) {
-      updated_params.insert({kH265FmtpTxMode, GetH265TxModeOrDefault({})});
+      updated_params.emplace(kH265FmtpTxMode, GetH265TxModeOrDefault({}));
     }
   }
 #endif
@@ -212,10 +212,10 @@
                                 PayloadType(apt_value_2_int));
   }
   if (resiliency_type == Codec::ResiliencyType::kRed) {
-    auto red_parameters_1 =
-        codec_to_match.params.find(kCodecParamNotInNameValueFormat);
-    auto red_parameters_2 =
-        potential_match.params.find(kCodecParamNotInNameValueFormat);
+    auto red_parameters_1 = codec_to_match.params.find(
+        std::string(kCodecParamNotInNameValueFormat));
+    auto red_parameters_2 = potential_match.params.find(
+        std::string(kCodecParamNotInNameValueFormat));
     bool has_parameters_1 = red_parameters_1 != codec_to_match.params.end();
     bool has_parameters_2 = red_parameters_2 != potential_match.params.end();
 
diff --git a/media/base/codec_comparators_unittest.cc b/media/base/codec_comparators_unittest.cc
index 575323c..d4613b6 100644
--- a/media/base/codec_comparators_unittest.cc
+++ b/media/base/codec_comparators_unittest.cc
@@ -492,11 +492,11 @@
 
   Codec c_no_profile = CreateVideoCodec(95, kAv1CodecName);
   Codec c_profile0 = CreateVideoCodec(95, kAv1CodecName);
-  c_profile0.params[kAv1FmtpProfile] = kProfile0;
+  c_profile0.params[std::string(kAv1FmtpProfile)] = kProfile0;
   Codec c_profile1 = CreateVideoCodec(95, kAv1CodecName);
-  c_profile1.params[kAv1FmtpProfile] = kProfile1;
+  c_profile1.params[std::string(kAv1FmtpProfile)] = kProfile1;
   Codec c_profile2 = CreateVideoCodec(95, kAv1CodecName);
-  c_profile2.params[kAv1FmtpProfile] = kProfile2;
+  c_profile2.params[std::string(kAv1FmtpProfile)] = kProfile2;
 
   // An AV1 entry with no profile specified should be treated as profile-0.
   EXPECT_TRUE(c_profile0.Matches(c_no_profile));
@@ -510,14 +510,14 @@
   {
     // Two AV1 entries with profile 0 specified are treated as duplicates.
     Codec c_profile0_eq = CreateVideoCodec(95, kAv1CodecName);
-    c_profile0_eq.params[kAv1FmtpProfile] = kProfile0;
+    c_profile0_eq.params[std::string(kAv1FmtpProfile)] = kProfile0;
     EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
   }
 
   {
     // Two AV1 entries with profile 1 specified are treated as duplicates.
     Codec c_profile1_eq = CreateVideoCodec(95, kAv1CodecName);
-    c_profile1_eq.params[kAv1FmtpProfile] = kProfile1;
+    c_profile1_eq.params[std::string(kAv1FmtpProfile)] = kProfile1;
     EXPECT_TRUE(c_profile1.Matches(c_profile1_eq));
   }
 
@@ -531,20 +531,20 @@
 
   // AV1 entries with same profile and different tier are seen as equal.
   Codec c_tier0 = CreateVideoCodec(95, kAv1CodecName);
-  c_tier0.params[kAv1FmtpProfile] = kProfile0;
-  c_tier0.params[kAv1FmtpTier] = "0";
+  c_tier0.params[std::string(kAv1FmtpProfile)] = kProfile0;
+  c_tier0.params[std::string(kAv1FmtpTier)] = "0";
   Codec c_tier1 = CreateVideoCodec(95, kAv1CodecName);
-  c_tier1.params[kAv1FmtpProfile] = kProfile0;
-  c_tier1.params[kAv1FmtpTier] = "1";
+  c_tier1.params[std::string(kAv1FmtpProfile)] = kProfile0;
+  c_tier1.params[std::string(kAv1FmtpTier)] = "1";
   EXPECT_TRUE(c_tier0.Matches(c_tier1));
 
   // AV1 entries with profile and different level are seen as equal.
   Codec c_level0 = CreateVideoCodec(95, kAv1CodecName);
-  c_level0.params[kAv1FmtpProfile] = kProfile0;
-  c_level0.params[kAv1FmtpLevelIdx] = "0";
+  c_level0.params[std::string(kAv1FmtpProfile)] = kProfile0;
+  c_level0.params[std::string(kAv1FmtpLevelIdx)] = "0";
   Codec c_level1 = CreateVideoCodec(95, kAv1CodecName);
-  c_level1.params[kAv1FmtpProfile] = kProfile0;
-  c_level1.params[kAv1FmtpLevelIdx] = "1";
+  c_level1.params[std::string(kAv1FmtpProfile)] = kProfile0;
+  c_level1.params[std::string(kAv1FmtpLevelIdx)] = "1";
   EXPECT_TRUE(c_level0.Matches(c_level1));
 }
 
@@ -555,19 +555,19 @@
 
   Codec c_no_profile = CreateVideoCodec(95, kVp9CodecName);
   Codec c_profile0 = CreateVideoCodec(95, kVp9CodecName);
-  c_profile0.params[kVP9FmtpProfileId] = kProfile0;
+  c_profile0.SetParam(kVP9FmtpProfileId, kProfile0);
 
   EXPECT_TRUE(c_profile0.Matches(c_no_profile));
 
   {
     Codec c_profile0_eq = CreateVideoCodec(95, kVp9CodecName);
-    c_profile0_eq.params[kVP9FmtpProfileId] = kProfile0;
+    c_profile0_eq.SetParam(kVP9FmtpProfileId, kProfile0);
     EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
   }
 
   {
     Codec c_profile2 = CreateVideoCodec(95, kVp9CodecName);
-    c_profile2.params[kVP9FmtpProfileId] = kProfile2;
+    c_profile2.SetParam(kVP9FmtpProfileId, kProfile2);
     EXPECT_FALSE(c_profile0.Matches(c_profile2));
     EXPECT_FALSE(c_no_profile.Matches(c_profile2));
   }
@@ -586,12 +586,12 @@
   const char kProfileLevelId3[] = "42e01e";
 
   Codec pli_1_pm_0 = CreateVideoCodec(95, "H264");
-  pli_1_pm_0.params[kH264FmtpProfileLevelId] = kProfileLevelId1;
-  pli_1_pm_0.params[kH264FmtpPacketizationMode] = "0";
+  pli_1_pm_0.SetParam(kH264FmtpProfileLevelId, kProfileLevelId1);
+  pli_1_pm_0.SetParam(kH264FmtpPacketizationMode, "0");
 
   {
     Codec pli_1_pm_blank = CreateVideoCodec(95, "H264");
-    pli_1_pm_blank.params[kH264FmtpProfileLevelId] = kProfileLevelId1;
+    pli_1_pm_blank.SetParam(kH264FmtpProfileLevelId, kProfileLevelId1);
     pli_1_pm_blank.params.erase(
         pli_1_pm_blank.params.find(kH264FmtpPacketizationMode));
 
@@ -605,8 +605,8 @@
 
   {
     Codec pli_1_pm_1 = CreateVideoCodec(95, "H264");
-    pli_1_pm_1.params[kH264FmtpProfileLevelId] = kProfileLevelId1;
-    pli_1_pm_1.params[kH264FmtpPacketizationMode] = "1";
+    pli_1_pm_1.SetParam(kH264FmtpProfileLevelId, kProfileLevelId1);
+    pli_1_pm_1.SetParam(kH264FmtpPacketizationMode, "1");
 
     // Does not match since packetization-mode is different.
     EXPECT_FALSE(pli_1_pm_0.Matches(pli_1_pm_1));
@@ -616,9 +616,8 @@
 
   {
     Codec pli_2_pm_0 = CreateVideoCodec(95, "H264");
-    pli_2_pm_0.params[kH264FmtpProfileLevelId] = kProfileLevelId2;
-    pli_2_pm_0.params[kH264FmtpPacketizationMode] = "0";
-
+    pli_2_pm_0.SetParam(kH264FmtpProfileLevelId, kProfileLevelId2);
+    pli_2_pm_0.SetParam(kH264FmtpPacketizationMode, "0");
     // Does not match since profile-level-id is different.
     EXPECT_FALSE(pli_1_pm_0.Matches(pli_2_pm_0));
 
@@ -627,8 +626,8 @@
 
   {
     Codec pli_3_pm_0_asym = CreateVideoCodec(95, "H264");
-    pli_3_pm_0_asym.params[kH264FmtpProfileLevelId] = kProfileLevelId3;
-    pli_3_pm_0_asym.params[kH264FmtpPacketizationMode] = "0";
+    pli_3_pm_0_asym.SetParam(kH264FmtpProfileLevelId, kProfileLevelId3);
+    pli_3_pm_0_asym.SetParam(kH264FmtpPacketizationMode, "0");
 
     // Does match, profile-level-id is different but the level is not compared.
     // and the profile matches.
@@ -654,7 +653,7 @@
 
   {
     Codec c_profile_1 = CreateVideoCodec(95, kH265CodecName);
-    c_profile_1.params[kH265FmtpProfileId] = kProfile1;
+    c_profile_1.SetParam(kH265FmtpProfileId, kProfile1);
 
     // Matches since profile-id unspecified defaults to "1".
     EXPECT_TRUE(c_ptl_blank.Matches(c_profile_1));
@@ -662,7 +661,7 @@
 
   {
     Codec c_tier_flag_1 = CreateVideoCodec(95, kH265CodecName);
-    c_tier_flag_1.params[kH265FmtpTierFlag] = kTier1;
+    c_tier_flag_1.SetParam(kH265FmtpTierFlag, kTier1);
 
     // Does not match since profile-space unspecified defaults to "0".
     EXPECT_FALSE(c_ptl_blank.Matches(c_tier_flag_1));
@@ -670,7 +669,7 @@
 
   {
     Codec c_level_id_3_1 = CreateVideoCodec(95, kH265CodecName);
-    c_level_id_3_1.params[kH265FmtpLevelId] = kLevel3_1;
+    c_level_id_3_1.SetParam(kH265FmtpLevelId, kLevel3_1);
 
     // Matches since level-id unspecified defaults to "93".
     EXPECT_TRUE(c_ptl_blank.Matches(c_level_id_3_1));
@@ -678,7 +677,7 @@
 
   {
     Codec c_level_id_4 = CreateVideoCodec(95, kH265CodecName);
-    c_level_id_4.params[kH265FmtpLevelId] = kLevel4;
+    c_level_id_4.SetParam(kH265FmtpLevelId, kLevel4);
 
     // Matches since we ignore level-id when matching H.265 codecs.
     EXPECT_TRUE(c_ptl_blank.Matches(c_level_id_4));
@@ -686,7 +685,7 @@
 
   {
     Codec c_tx_mode_mrst = CreateVideoCodec(95, kH265CodecName);
-    c_tx_mode_mrst.params[kH265FmtpTxMode] = kTxMrst;
+    c_tx_mode_mrst.SetParam(kH265FmtpTxMode, kTxMrst);
 
     // Does not match since tx-mode implies to "SRST" and must be not specified
     // when it is the only mode supported:
diff --git a/media/base/codec_unittest.cc b/media/base/codec_unittest.cc
index 0e5973e..e2b203b 100644
--- a/media/base/codec_unittest.cc
+++ b/media/base/codec_unittest.cc
@@ -234,20 +234,20 @@
 
   // Reject codecs with min bitrate > max bitrate.
   Codec incorrect_bitrates = codec;
-  incorrect_bitrates.params[kCodecParamMinBitrate] = "100";
-  incorrect_bitrates.params[kCodecParamMaxBitrate] = "80";
+  incorrect_bitrates.SetParam(kCodecParamMinBitrate, "100");
+  incorrect_bitrates.SetParam(kCodecParamMaxBitrate, "80");
   EXPECT_FALSE(incorrect_bitrates.ValidateCodecFormat());
 
   // Accept min bitrate == max bitrate.
   Codec equal_bitrates = codec;
-  equal_bitrates.params[kCodecParamMinBitrate] = "100";
-  equal_bitrates.params[kCodecParamMaxBitrate] = "100";
+  equal_bitrates.SetParam(kCodecParamMinBitrate, "100");
+  equal_bitrates.SetParam(kCodecParamMaxBitrate, "100");
   EXPECT_TRUE(equal_bitrates.ValidateCodecFormat());
 
   // Accept min bitrate < max bitrate.
   Codec different_bitrates = codec;
-  different_bitrates.params[kCodecParamMinBitrate] = "99";
-  different_bitrates.params[kCodecParamMaxBitrate] = "100";
+  different_bitrates.SetParam(kCodecParamMinBitrate, "99");
+  different_bitrates.SetParam(kCodecParamMaxBitrate, "100");
   EXPECT_TRUE(different_bitrates.ValidateCodecFormat());
 }
 
diff --git a/media/base/media_constants.cc b/media/base/media_constants.cc
index 966ac39..e7d72b1 100644
--- a/media/base/media_constants.cc
+++ b/media/base/media_constants.cc
@@ -14,94 +14,6 @@
 
 namespace webrtc {
 
-const int kVideoCodecClockrate = 90000;
-
-const int kVideoMtu = 1200;
-const int kVideoRtpSendBufferSize = 262144;
-const int kVideoRtpRecvBufferSize = 1048576;
-
-const float kHighSystemCpuThreshold = 0.85f;
-const float kLowSystemCpuThreshold = 0.65f;
-const float kProcessCpuThreshold = 0.10f;
-
-const char kRedCodecName[] = "red";
-const char kUlpfecCodecName[] = "ulpfec";
-
-// TODO(brandtr): Change this to 'flexfec' when we are confident that the
-// header format is not changing anymore.
-const char kFlexfecCodecName[] = "flexfec-03";
-
-// draft-ietf-payload-flexible-fec-scheme-02.txt
-const char kFlexfecFmtpRepairWindow[] = "repair-window";
-
-// RFC 4588 RTP Retransmission Payload Format
-const char kRtxCodecName[] = "rtx";
-const char kCodecParamRtxTime[] = "rtx-time";
-const char kCodecParamAssociatedPayloadType[] = "apt";
-
-const char kCodecParamAssociatedCodecName[] = "acn";
-// Parameters that do not follow the key-value convention
-// are treated as having the empty string as key.
-const char kCodecParamNotInNameValueFormat[] = "";
-
-const char kOpusCodecName[] = "opus";
-const char kL16CodecName[] = "L16";
-const char kG722CodecName[] = "G722";
-const char kPcmuCodecName[] = "PCMU";
-const char kPcmaCodecName[] = "PCMA";
-const char kCnCodecName[] = "CN";
-const char kDtmfCodecName[] = "telephone-event";
-
-// draft-spittka-payload-rtp-opus-03.txt
-const char kCodecParamPTime[] = "ptime";
-const char kCodecParamMaxPTime[] = "maxptime";
-const char kCodecParamMinPTime[] = "minptime";
-const char kCodecParamSPropStereo[] = "sprop-stereo";
-const char kCodecParamStereo[] = "stereo";
-const char kCodecParamUseInbandFec[] = "useinbandfec";
-const char kCodecParamUseDtx[] = "usedtx";
-const char kCodecParamCbr[] = "cbr";
-const char kCodecParamMaxAverageBitrate[] = "maxaveragebitrate";
-const char kCodecParamMaxPlaybackRate[] = "maxplaybackrate";
-
-const char kParamValueTrue[] = "1";
-const char kParamValueEmpty[] = "";
-
-const int kOpusDefaultMaxPTime = 120;
-const int kOpusDefaultPTime = 20;
-const int kOpusDefaultMinPTime = 3;
-const int kOpusDefaultSPropStereo = 0;
-const int kOpusDefaultStereo = 0;
-const int kOpusDefaultUseInbandFec = 0;
-const int kOpusDefaultUseDtx = 0;
-const int kOpusDefaultMaxPlaybackRate = 48000;
-
-const int kPreferredMaxPTime = 120;
-const int kPreferredMinPTime = 10;
-const int kPreferredSPropStereo = 0;
-const int kPreferredStereo = 0;
-const int kPreferredUseInbandFec = 0;
-
-const char kPacketizationParamRaw[] = "raw";
-
-const char kRtcpFbParamLntf[] = "goog-lntf";
-const char kRtcpFbParamNack[] = "nack";
-const char kRtcpFbNackParamPli[] = "pli";
-const char kRtcpFbParamRemb[] = "goog-remb";
-const char kRtcpFbParamTransportCc[] = "transport-cc";
-
-const char kRtcpFbParamCcm[] = "ccm";
-const char kRtcpFbCcmParamFir[] = "fir";
-const char kRtcpFbParamRrtr[] = "rrtr";
-const char kCodecParamMaxBitrate[] = "x-google-max-bitrate";
-const char kCodecParamMinBitrate[] = "x-google-min-bitrate";
-const char kCodecParamStartBitrate[] = "x-google-start-bitrate";
-const char kCodecParamMaxQuantization[] = "x-google-max-quantization";
-const char kCodecParamPerLayerPictureLossIndication[] =
-    "x-google-per-layer-pli";
-
-const char kComfortNoiseCodecName[] = "CN";
-
 const char kVp8CodecName[] = "VP8";
 const char kVp9CodecName[] = "VP9";
 const char kAv1CodecName[] = "AV1";
@@ -112,10 +24,6 @@
 const char kH264FmtpProfileLevelId[] = "profile-level-id";
 const char kH264FmtpLevelAsymmetryAllowed[] = "level-asymmetry-allowed";
 const char kH264FmtpPacketizationMode[] = "packetization-mode";
-const char kH264FmtpSpropParameterSets[] = "sprop-parameter-sets";
-const char kH264FmtpSpsPpsIdrInKeyframe[] = "sps-pps-idr-in-keyframe";
-const char kH264ProfileLevelConstrainedBaseline[] = "42e01f";
-const char kH264ProfileLevelConstrainedHigh[] = "640c1f";
 
 // RFC 7798 RTP Payload Format for H.265 video
 const char kH265FmtpProfileSpace[] = "profile-space";
@@ -127,27 +35,25 @@
 const char kH265FmtpInteropConstraints[] = "interop-constraints";
 const char kH265FmtpTxMode[] = "tx-mode";
 
-// draft-ietf-payload-vp9
-const char kVP9ProfileId[] = "profile-id";
+const char kCodecParamAssociatedPayloadType[] = "apt";
+const char kCodecParamStereo[] = "stereo";
+const char kCodecParamUseInbandFec[] = "useinbandfec";
+const char kCodecParamUseDtx[] = "usedtx";
+const char kCodecParamMaxBitrate[] = "x-google-max-bitrate";
+const char kCodecParamMinBitrate[] = "x-google-min-bitrate";
+const char kCodecParamStartBitrate[] = "x-google-start-bitrate";
 
-// https://aomediacodec.github.io/av1-rtp-spec/
-const char kAv1FmtpProfile[] = "profile";
-const char kAv1FmtpLevelIdx[] = "level-idx";
-const char kAv1FmtpTier[] = "tier";
+const char kRedCodecName[] = "red";
+const char kUlpfecCodecName[] = "ulpfec";
+const char kFlexfecCodecName[] = "flexfec-03";
+const char kRtxCodecName[] = "rtx";
+const char kOpusCodecName[] = "opus";
+const char kL16CodecName[] = "L16";
+const char kG722CodecName[] = "G722";
+const char kPcmuCodecName[] = "PCMU";
+const char kPcmaCodecName[] = "PCMA";
+const char kCnCodecName[] = "CN";
+const char kDtmfCodecName[] = "telephone-event";
+const char kComfortNoiseCodecName[] = "CN";
 
-const int kDefaultVideoMaxFramerate = 60;
-// Max encode quantizer for VP8/9 and AV1 encoders assuming libvpx/libaom API
-// range [0, 63]
-const int kDefaultVideoMaxQpVpx = 56;
-const int kDefaultVideoMaxQpAv1 = 52;
-// Max encode quantizer for H264/5 assuming the bitstream range [0, 51].
-const int kDefaultVideoMaxQpH26x = 51;
-
-const size_t kConferenceMaxNumSpatialLayers = 3;
-const size_t kConferenceMaxNumTemporalLayers = 3;
-const size_t kConferenceDefaultNumTemporalLayers = 3;
-
-// RFC 3556 and RFC 3890
-const char kApplicationSpecificBandwidth[] = "AS";
-const char kTransportSpecificBandwidth[] = "TIAS";
 }  // namespace webrtc
diff --git a/media/base/media_constants.h b/media/base/media_constants.h
index 44918ac..79beaca 100644
--- a/media/base/media_constants.h
+++ b/media/base/media_constants.h
@@ -13,36 +13,36 @@
 
 #include <stddef.h>
 
+#include "absl/strings/string_view.h"
 #include "rtc_base/system/rtc_export.h"
 
 // This file contains constants related to media.
 
 namespace webrtc {
 
-extern const int kVideoCodecClockrate;
+inline constexpr int kVideoCodecClockrate = 90'000;
 
-extern const int kVideoMtu;
-extern const int kVideoRtpSendBufferSize;
-extern const int kVideoRtpRecvBufferSize;
+inline constexpr int kVideoMtu = 1200;
+inline constexpr int kVideoRtpSendBufferSize = 262'144;
+inline constexpr int kVideoRtpRecvBufferSize = 1'048'576;
 
 // Default CPU thresholds.
-extern const float kHighSystemCpuThreshold;
-extern const float kLowSystemCpuThreshold;
-extern const float kProcessCpuThreshold;
+inline constexpr float kHighSystemCpuThreshold = 0.85f;
+inline constexpr float kLowSystemCpuThreshold = 0.65f;
+inline constexpr float kProcessCpuThreshold = 0.10f;
 
 extern const char kRedCodecName[];
 extern const char kUlpfecCodecName[];
 extern const char kFlexfecCodecName[];
-extern const char kMultiplexCodecName[];
 
-extern const char kFlexfecFmtpRepairWindow[];
+inline constexpr absl::string_view kFlexfecFmtpRepairWindow = "repair-window";
 
 extern const char kRtxCodecName[];
-extern const char kCodecParamRtxTime[];
+inline constexpr absl::string_view kCodecParamRtxTime = "rtx-time";
 extern const char kCodecParamAssociatedPayloadType[];
 
-extern const char kCodecParamAssociatedCodecName[];
-extern const char kCodecParamNotInNameValueFormat[];
+inline constexpr absl::string_view kCodecParamAssociatedCodecName = "acn";
+inline constexpr absl::string_view kCodecParamNotInNameValueFormat = "";
 
 extern const char kOpusCodecName[];
 extern const char kL16CodecName[];
@@ -53,70 +53,74 @@
 extern const char kDtmfCodecName[];
 
 // Attribute parameters
-extern const char kCodecParamPTime[];
-extern const char kCodecParamMaxPTime[];
+inline constexpr absl::string_view kCodecParamPTime = "ptime";
+inline constexpr absl::string_view kCodecParamMaxPTime = "maxptime";
 // fmtp parameters
-extern const char kCodecParamMinPTime[];
-extern const char kCodecParamSPropStereo[];
+inline constexpr absl::string_view kCodecParamMinPTime = "minptime";
+inline constexpr absl::string_view kCodecParamSPropStereo = "sprop-stereo";
 extern const char kCodecParamStereo[];
 extern const char kCodecParamUseInbandFec[];
 extern const char kCodecParamUseDtx[];
-extern const char kCodecParamCbr[];
-extern const char kCodecParamMaxAverageBitrate[];
-extern const char kCodecParamMaxPlaybackRate[];
-extern const char kCodecParamPerLayerPictureLossIndication[];
+inline constexpr absl::string_view kCodecParamCbr = "cbr";
+inline constexpr absl::string_view kCodecParamMaxAverageBitrate =
+    "maxaveragebitrate";
+inline constexpr absl::string_view kCodecParamMaxPlaybackRate =
+    "maxplaybackrate";
+inline constexpr absl::string_view kCodecParamPerLayerPictureLossIndication =
+    "x-google-per-layer-pli";
 
-extern const char kParamValueTrue[];
+inline constexpr absl::string_view kParamValueTrue = "1";
 // Parameters are stored as parameter/value pairs. For parameters who do not
 // have a value, `kParamValueEmpty` should be used as value.
-extern const char kParamValueEmpty[];
+inline constexpr absl::string_view kParamValueEmpty = "";
 
 // opus parameters.
 // Default value for maxptime according to
 // http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03
-extern const int kOpusDefaultMaxPTime;
-extern const int kOpusDefaultPTime;
-extern const int kOpusDefaultMinPTime;
-extern const int kOpusDefaultSPropStereo;
-extern const int kOpusDefaultStereo;
-extern const int kOpusDefaultUseInbandFec;
-extern const int kOpusDefaultUseDtx;
-extern const int kOpusDefaultMaxPlaybackRate;
+inline constexpr int kOpusDefaultMaxPTime = 120;
+inline constexpr int kOpusDefaultPTime = 20;
+inline constexpr int kOpusDefaultMinPTime = 3;
+inline constexpr int kOpusDefaultSPropStereo = 0;
+inline constexpr int kOpusDefaultStereo = 0;
+inline constexpr int kOpusDefaultUseInbandFec = 0;
+inline constexpr int kOpusDefaultUseDtx = 0;
+inline constexpr int kOpusDefaultMaxPlaybackRate = 48000;
 
 // Prefered values in this code base. Note that they may differ from the default
 // values in http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03
 // Only frames larger or equal to 10 ms are currently supported in this code
 // base.
-extern const int kPreferredMaxPTime;
-extern const int kPreferredMinPTime;
-extern const int kPreferredSPropStereo;
-extern const int kPreferredStereo;
-extern const int kPreferredUseInbandFec;
+inline constexpr int kPreferredMaxPTime = 120;
+inline constexpr int kPreferredMinPTime = 10;
+inline constexpr int kPreferredSPropStereo = 0;
+inline constexpr int kPreferredStereo = 0;
+inline constexpr int kPreferredUseInbandFec = 0;
 
-extern const char kPacketizationParamRaw[];
+inline constexpr absl::string_view kPacketizationParamRaw = "raw";
 
 // rtcp-fb message in its first experimental stages. Documentation pending.
-extern const char kRtcpFbParamLntf[];
+inline constexpr absl::string_view kRtcpFbParamLntf = "goog-lntf";
 // rtcp-fb messages according to RFC 4585
-extern const char kRtcpFbParamNack[];
-extern const char kRtcpFbNackParamPli[];
+inline constexpr absl::string_view kRtcpFbParamNack = "nack";
+inline constexpr absl::string_view kRtcpFbNackParamPli = "pli";
 // rtcp-fb messages according to
 // http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-00
-extern const char kRtcpFbParamRemb[];
+inline constexpr absl::string_view kRtcpFbParamRemb = "goog-remb";
 // rtcp-fb messages according to
 // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01
-extern const char kRtcpFbParamTransportCc[];
+inline constexpr absl::string_view kRtcpFbParamTransportCc = "transport-cc";
 // ccm submessages according to RFC 5104
-extern const char kRtcpFbParamCcm[];
-extern const char kRtcpFbCcmParamFir[];
+inline constexpr absl::string_view kRtcpFbParamCcm = "ccm";
+inline constexpr absl::string_view kRtcpFbCcmParamFir = "fir";
 // Receiver reference time report
 // https://tools.ietf.org/html/rfc3611 section 4.4
-extern const char kRtcpFbParamRrtr[];
+inline constexpr absl::string_view kRtcpFbParamRrtr = "rrtr";
 // Google specific parameters
 extern const char kCodecParamMaxBitrate[];
 extern const char kCodecParamMinBitrate[];
 extern const char kCodecParamStartBitrate[];
-extern const char kCodecParamMaxQuantization[];
+inline constexpr absl::string_view kCodecParamMaxQuantization =
+    "x-google-max-quantization";
 
 extern const char kComfortNoiseCodecName[];
 
@@ -130,10 +134,13 @@
 RTC_EXPORT extern const char kH264FmtpProfileLevelId[];
 RTC_EXPORT extern const char kH264FmtpLevelAsymmetryAllowed[];
 RTC_EXPORT extern const char kH264FmtpPacketizationMode[];
-extern const char kH264FmtpSpropParameterSets[];
-extern const char kH264FmtpSpsPpsIdrInKeyframe[];
-extern const char kH264ProfileLevelConstrainedBaseline[];
-extern const char kH264ProfileLevelConstrainedHigh[];
+inline constexpr absl::string_view kH264FmtpSpropParameterSets =
+    "sprop-parameter-sets";
+inline constexpr absl::string_view kH264FmtpSpsPpsIdrInKeyframe =
+    "sps-pps-idr-in-keyframe";
+inline constexpr absl::string_view kH264ProfileLevelConstrainedBaseline =
+    "42e01f";
+inline constexpr absl::string_view kH264ProfileLevelConstrainedHigh = "640c1f";
 
 // RFC 7798 RTP Payload Format for H.265 video.
 // According to RFC 7742, the sprop parameters MUST NOT be included
@@ -149,24 +156,25 @@
 RTC_EXPORT extern const char kH265FmtpTxMode[];
 
 // draft-ietf-payload-vp9
-extern const char kVP9ProfileId[];
+inline constexpr absl::string_view kVP9ProfileId = "profile-id";
 
 // https://aomediacodec.github.io/av1-rtp-spec/
-extern const char kAv1FmtpProfile[];
-extern const char kAv1FmtpLevelIdx[];
-extern const char kAv1FmtpTier[];
+inline constexpr absl::string_view kAv1FmtpProfile = "profile";
+inline constexpr absl::string_view kAv1FmtpLevelIdx = "level-idx";
+inline constexpr absl::string_view kAv1FmtpTier = "tier";
 
-extern const int kDefaultVideoMaxFramerate;
-extern const int kDefaultVideoMaxQpVpx;
-extern const int kDefaultVideoMaxQpAv1;
-extern const int kDefaultVideoMaxQpH26x;
+inline constexpr int kDefaultVideoMaxFramerate = 60;
+inline constexpr int kDefaultVideoMaxQpVpx = 56;
+inline constexpr int kDefaultVideoMaxQpAv1 = 52;
+inline constexpr int kDefaultVideoMaxQpH26x = 51;
 
-extern const size_t kConferenceMaxNumSpatialLayers;
-extern const size_t kConferenceMaxNumTemporalLayers;
-extern const size_t kConferenceDefaultNumTemporalLayers;
+inline constexpr size_t kConferenceMaxNumSpatialLayers = 3;
+inline constexpr size_t kConferenceMaxNumTemporalLayers = 3;
+inline constexpr size_t kConferenceDefaultNumTemporalLayers = 3;
 
-extern const char kApplicationSpecificBandwidth[];
-extern const char kTransportSpecificBandwidth[];
+inline constexpr absl::string_view kApplicationSpecificBandwidth = "AS";
+inline constexpr absl::string_view kTransportSpecificBandwidth = "TIAS";
+
 }  //  namespace webrtc
 
 
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index f813f18..9ec661a 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -163,7 +163,8 @@
     // is microseconds.) This parameter MUST be present in the SDP, but
     // we never use the actual value anywhere in our code however.
     // TODO(brandtr): Consider honouring this value in the sender and receiver.
-    flexfec_format.parameters = {{kFlexfecFmtpRepairWindow, "10000000"}};
+    flexfec_format.parameters = {
+        {std::string(kFlexfecFmtpRepairWindow), "10000000"}};
     supported_formats.push_back(flexfec_format);
   }
   return supported_formats;
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index 41d9e30..bf23d05 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -2623,7 +2623,7 @@
   // TODO(pbos): Set up the quality scaler so that both senders reliably start
   // at QVGA, then verify that instead.
   Codec codec = GetEngineCodec("VP8");
-  codec.params[kCodecParamStartBitrate] = "1000000";
+  codec.SetParam(kCodecParamStartBitrate, "1000000");
   TwoStreamsSendAndReceive(codec);
 }
 
@@ -2890,9 +2890,9 @@
     auto& codecs = send_parameters_.codecs;
     codecs.clear();
     codecs.push_back(GetEngineCodec("VP8"));
-    codecs[0].params[kCodecParamMinBitrate] = min_bitrate_kbps;
-    codecs[0].params[kCodecParamStartBitrate] = start_bitrate_kbps;
-    codecs[0].params[kCodecParamMaxBitrate] = max_bitrate_kbps;
+    codecs[0].SetParam(kCodecParamMinBitrate, min_bitrate_kbps);
+    codecs[0].SetParam(kCodecParamStartBitrate, start_bitrate_kbps);
+    codecs[0].SetParam(kCodecParamMaxBitrate, max_bitrate_kbps);
     EXPECT_TRUE(send_channel_->SetSenderParameters(send_parameters_));
   }
 
@@ -4946,8 +4946,8 @@
 }
 
 TEST_F(WebRtcVideoChannelTest, SetSendCodecsRejectsMaxLessThanMinBitrate) {
-  send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "300";
-  send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "200";
+  send_parameters_.codecs[0].SetParam(kCodecParamMinBitrate, "300");
+  send_parameters_.codecs[0].SetParam(kCodecParamMaxBitrate, "200");
   EXPECT_FALSE(send_channel_->SetSenderParameters(send_parameters_));
 }
 
@@ -4986,9 +4986,9 @@
 // Test that when both the codec-specific bitrate params and max_bandwidth_bps
 // are present in the same send parameters, the settings are combined correctly.
 TEST_F(WebRtcVideoChannelTest, SetSendCodecsWithBitratesAndMaxSendBandwidth) {
-  send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "100";
-  send_parameters_.codecs[0].params[kCodecParamStartBitrate] = "200";
-  send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "300";
+  send_parameters_.codecs[0].SetParam(kCodecParamMinBitrate, "100");
+  send_parameters_.codecs[0].SetParam(kCodecParamStartBitrate, "200");
+  send_parameters_.codecs[0].SetParam(kCodecParamMaxBitrate, "300");
   send_parameters_.max_bandwidth_bps = 400000;
   // We expect max_bandwidth_bps to take priority, if set.
   ExpectSetBitrateParameters(100000, 200000, 400000);
@@ -5001,13 +5001,13 @@
   EXPECT_TRUE(send_channel_->SetSenderParameters(send_parameters_));
 
   // Now try again with the values flipped around.
-  send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "400";
+  send_parameters_.codecs[0].SetParam(kCodecParamMaxBitrate, "400");
   send_parameters_.max_bandwidth_bps = 300000;
   ExpectSetBitrateParameters(100000, 200000, 300000);
   EXPECT_TRUE(send_channel_->SetSenderParameters(send_parameters_));
 
   // If we change the codec max, max_bandwidth_bps should still apply.
-  send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "350";
+  send_parameters_.codecs[0].SetParam(kCodecParamMaxBitrate, "350");
   ExpectSetBitrateParameters(100000, 200000, 300000);
   EXPECT_TRUE(send_channel_->SetSenderParameters(send_parameters_));
 }
@@ -5053,9 +5053,9 @@
 // appropriately.
 TEST_F(WebRtcVideoChannelTest,
        MaxBitratePrioritizesVideoSendParametersOverCodecMaxBitrate) {
-  send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "100";
-  send_parameters_.codecs[0].params[kCodecParamStartBitrate] = "200";
-  send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "300";
+  send_parameters_.codecs[0].SetParam(kCodecParamMinBitrate, "100");
+  send_parameters_.codecs[0].SetParam(kCodecParamStartBitrate, "200");
+  send_parameters_.codecs[0].SetParam(kCodecParamMaxBitrate, "300");
   send_parameters_.max_bandwidth_bps = -1;
   AddSendStream();
   ExpectSetMaxBitrate(300000);
@@ -5082,9 +5082,9 @@
 // appropriately.
 TEST_F(WebRtcVideoChannelTest,
        MaxBitratePrioritizesRtpParametersOverCodecMaxBitrate) {
-  send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "100";
-  send_parameters_.codecs[0].params[kCodecParamStartBitrate] = "200";
-  send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "300";
+  send_parameters_.codecs[0].SetParam(kCodecParamMinBitrate, "100");
+  send_parameters_.codecs[0].SetParam(kCodecParamStartBitrate, "200");
+  send_parameters_.codecs[0].SetParam(kCodecParamMaxBitrate, "300");
   send_parameters_.max_bandwidth_bps = -1;
   AddSendStream();
   ExpectSetMaxBitrate(300000);
@@ -5194,14 +5194,16 @@
   static const char* kMaxQuantization = "21";
   VideoSenderParameters parameters;
   parameters.codecs.push_back(GetEngineCodec("VP8"));
-  parameters.codecs[0].params[kCodecParamMaxQuantization] = kMaxQuantization;
+  parameters.codecs[0].SetParam(kCodecParamMaxQuantization, kMaxQuantization);
   EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
   EXPECT_EQ(atoi(kMaxQuantization),
             AddSendStream()->GetVideoStreams().back().max_qp);
 
   std::optional<Codec> codec = send_channel_->GetSendCodec();
   ASSERT_TRUE(codec);
-  EXPECT_EQ(kMaxQuantization, codec->params[kCodecParamMaxQuantization]);
+  std::string max_quantization;
+  EXPECT_TRUE(codec->GetParam(kCodecParamMaxQuantization, &max_quantization));
+  EXPECT_EQ(kMaxQuantization, max_quantization);
 }
 
 TEST_F(WebRtcVideoChannelTest, SetSendCodecsRejectBadPayloadTypes) {
@@ -9569,15 +9571,15 @@
   ASSERT_EQ(2u, cfg.decoders.size());
   EXPECT_EQ(101, cfg.decoders[0].payload_type);
   EXPECT_EQ("H264", cfg.decoders[0].video_format.name);
-  const auto it0 =
-      cfg.decoders[0].video_format.parameters.find(kH264FmtpSpropParameterSets);
+  const auto it0 = cfg.decoders[0].video_format.parameters.find(
+      std::string(kH264FmtpSpropParameterSets));
   ASSERT_TRUE(it0 != cfg.decoders[0].video_format.parameters.end());
   EXPECT_EQ("uvw", it0->second);
 
   EXPECT_EQ(102, cfg.decoders[1].payload_type);
   EXPECT_EQ("H264", cfg.decoders[1].video_format.name);
-  const auto it1 =
-      cfg.decoders[1].video_format.parameters.find(kH264FmtpSpropParameterSets);
+  const auto it1 = cfg.decoders[1].video_format.parameters.find(
+      std::string(kH264FmtpSpropParameterSets));
   ASSERT_TRUE(it1 != cfg.decoders[1].video_format.parameters.end());
   EXPECT_EQ("xyz", it1->second);
 }
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index c53252b..349f5d5 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -185,7 +185,7 @@
   return ss.Release();
 }
 
-bool IsCodec(const Codec& codec, const char* ref_name) {
+bool IsCodec(const Codec& codec, absl::string_view ref_name) {
   return absl::EqualsIgnoreCase(codec.name, ref_name);
 }
 
@@ -348,7 +348,8 @@
 
   // Check the FMTP line for the empty parameter which should match
   // <primary codec>/<primary codec>[/...]
-  auto red_parameters = red_codec.params.find(kCodecParamNotInNameValueFormat);
+  auto red_parameters =
+      red_codec.params.find(std::string(kCodecParamNotInNameValueFormat));
   if (red_parameters == red_codec.params.end()) {
     RTC_LOG(LS_WARNING) << "audio/RED missing fmtp parameters.";
     return false;
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index 020583f..f43d098 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -563,9 +563,9 @@
     auto& codecs = send_parameters_.codecs;
     codecs.clear();
     codecs.push_back(kOpusCodec);
-    codecs[0].params[kCodecParamMinBitrate] = min_bitrate_kbps;
-    codecs[0].params[kCodecParamStartBitrate] = start_bitrate_kbps;
-    codecs[0].params[kCodecParamMaxBitrate] = max_bitrate_kbps;
+    codecs[0].SetParam(kCodecParamMinBitrate, min_bitrate_kbps);
+    codecs[0].SetParam(kCodecParamStartBitrate, start_bitrate_kbps);
+    codecs[0].SetParam(kCodecParamMaxBitrate, max_bitrate_kbps);
     EXPECT_CALL(*call_.GetMockTransportControllerSend(),
                 SetSdpBitrateParameters(
                     AllOf(Field(&BitrateConstraints::min_bitrate_bps,
diff --git a/pc/codec_vendor.cc b/pc/codec_vendor.cc
index 8fd3922..80f622d 100644
--- a/pc/codec_vendor.cc
+++ b/pc/codec_vendor.cc
@@ -527,7 +527,7 @@
         }
         sb << matching_codec->id;
       }
-      red_codec.params[kCodecParamNotInNameValueFormat] = sb.Release();
+      red_codec.SetParam(kCodecParamNotInNameValueFormat, sb.Release());
       RTCErrorOr<PayloadType> suggestion = pt_suggester.SuggestPayloadType(
           mid, red_codec, pick_from_top_of_range);
       if (!suggestion.ok()) {
@@ -603,7 +603,8 @@
               // For RED, do not insert the codec again if it was already
               // inserted. audio/red for opus gets enabled by having RED before
               // the primary codec.
-              auto fmtp = codec.params.find(kCodecParamNotInNameValueFormat);
+              auto fmtp = codec.params.find(
+                  std::string(kCodecParamNotInNameValueFormat));
               if (fmtp != codec.params.end()) {
                 std::vector<absl::string_view> redundant_payloads =
                     split(fmtp->second, '/');
@@ -693,8 +694,8 @@
 
           if (it != supported_h265_profiles.end() &&
               filtered_ptl->level != it->second) {
-            filtered_codec.params[kH265FmtpLevelId] =
-                H265LevelToString(it->second);
+            filtered_codec.SetParam(kH265FmtpLevelId,
+                                    H265LevelToString(it->second));
           }
         }
       }
@@ -724,14 +725,15 @@
       negotiated.IntersectFeedbackParams(*theirs);
       if (negotiated.GetResiliencyType() == Codec::ResiliencyType::kRtx) {
         // We support parsing the declarative rtx-time parameter.
-        const auto rtx_time_it = theirs->params.find(kCodecParamRtxTime);
+        const auto rtx_time_it =
+            theirs->params.find(std::string(kCodecParamRtxTime));
         if (rtx_time_it != theirs->params.end()) {
           negotiated.SetParam(kCodecParamRtxTime, rtx_time_it->second);
         }
       } else if (negotiated.GetResiliencyType() ==
                  Codec::ResiliencyType::kRed) {
         const auto red_it =
-            theirs->params.find(kCodecParamNotInNameValueFormat);
+            theirs->params.find(std::string(kCodecParamNotInNameValueFormat));
         if (red_it != theirs->params.end()) {
           negotiated.SetParam(kCodecParamNotInNameValueFormat, red_it->second);
         }
diff --git a/pc/codec_vendor_unittest.cc b/pc/codec_vendor_unittest.cc
index 9b25593..5e79f1a 100644
--- a/pc/codec_vendor_unittest.cc
+++ b/pc/codec_vendor_unittest.cc
@@ -352,7 +352,7 @@
   reference_codecs.push_back(some_codec);
   Codec red_codec = CreateAudioCodec(101, "red", 8000, 1);
   ASSERT_EQ(red_codec.GetResiliencyType(), Codec::ResiliencyType::kRed);
-  red_codec.params[kCodecParamNotInNameValueFormat] = "102/102";
+  red_codec.SetParam(kCodecParamNotInNameValueFormat, "102/102");
   reference_codecs.push_back(red_codec);
   // Merging should add the RED codec with parameter 100/100
   RTCError error =
@@ -382,10 +382,10 @@
   reference_codecs.push_back(some_codec);
   Codec red_codec = CreateAudioCodec(101, "red", 8000, 1);
   ASSERT_EQ(red_codec.GetResiliencyType(), Codec::ResiliencyType::kRed);
-  red_codec.params[kCodecParamNotInNameValueFormat] = "102/102";
+  red_codec.SetParam(kCodecParamNotInNameValueFormat, "102/102");
   reference_codecs.push_back(red_codec);
   // Push the same red codec into `merged_codecs` with the 100 id
-  red_codec.params[kCodecParamNotInNameValueFormat] = "100/100";
+  red_codec.SetParam(kCodecParamNotInNameValueFormat, "100/100");
   merged_codecs.push_back(red_codec);
   // Merging should note the duplication and not add another codec.
   RTCError error =
@@ -411,7 +411,7 @@
   Codec some_codec = CreateAudioCodec(100, "foo", 8000, 1);
   Codec red_codec = CreateAudioCodec(101, "red", 8000, 1);
   // Adds a RED codec that refers to codec 102, which does not exist.
-  red_codec.params[kCodecParamNotInNameValueFormat] = "100/102";
+  red_codec.SetParam(kCodecParamNotInNameValueFormat, "100/102");
   reference_codecs.push_back(some_codec);
   reference_codecs.push_back(red_codec);
   // The bogus RED codec should result in an error return.
diff --git a/pc/media_session_unittest.cc b/pc/media_session_unittest.cc
index 183ddc0..1c2ecbc 100644
--- a/pc/media_session_unittest.cc
+++ b/pc/media_session_unittest.cc
@@ -3698,8 +3698,9 @@
   int new_h264_pl_type = updated_vcd->codecs()[0].id;
   EXPECT_NE(used_pl_type, new_h264_pl_type);
   Codec rtx = updated_vcd->codecs()[1];
-  int pt_referenced_by_rtx =
-      FromString<int>(rtx.params[kCodecParamAssociatedPayloadType]);
+  int pt_referenced_by_rtx;
+  EXPECT_TRUE(
+      rtx.GetParam(kCodecParamAssociatedPayloadType, &pt_referenced_by_rtx));
   EXPECT_EQ(new_h264_pl_type, pt_referenced_by_rtx);
 }
 
@@ -5145,11 +5146,11 @@
   // Create two H264 codecs with the same profile level ID and different
   // packetization modes.
   Codec h264_pm0 = CreateVideoCodec(96, "H264");
-  h264_pm0.params[kH264FmtpProfileLevelId] = "42c01f";
-  h264_pm0.params[kH264FmtpPacketizationMode] = "0";
+  h264_pm0.SetParam(kH264FmtpProfileLevelId, "42c01f");
+  h264_pm0.SetParam(kH264FmtpPacketizationMode, "0");
   Codec h264_pm1 = CreateVideoCodec(97, "H264");
-  h264_pm1.params[kH264FmtpProfileLevelId] = "42c01f";
-  h264_pm1.params[kH264FmtpPacketizationMode] = "1";
+  h264_pm1.SetParam(kH264FmtpProfileLevelId, "42c01f");
+  h264_pm1.SetParam(kH264FmtpPacketizationMode, "1");
 
   // Offerer will send both codecs, answerer should choose the one with matching
   // packetization mode (and not the first one it sees).
diff --git a/pc/session_description.h b/pc/session_description.h
index fbc1e50..6c9e0e9 100644
--- a/pc/session_description.h
+++ b/pc/session_description.h
@@ -353,7 +353,7 @@
   bool remote_estimate_ = false;
   bool rtcp_fb_ack_ccfb_ = false;
   int bandwidth_ = kAutoBandwidth;
-  std::string bandwidth_type_ = kApplicationSpecificBandwidth;
+  std::string bandwidth_type_{kApplicationSpecificBandwidth};
 
   std::vector<RtpExtension> rtp_header_extensions_;
   StreamParamsVec send_streams_;
diff --git a/pc/typed_codec_vendor.cc b/pc/typed_codec_vendor.cc
index 6620699..618d9b6 100644
--- a/pc/typed_codec_vendor.cc
+++ b/pc/typed_codec_vendor.cc
@@ -31,7 +31,6 @@
 #include "media/base/media_engine.h"
 #include "pc/codec_configuration.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/containers/flat_map.h"
 #include "rtc_base/containers/flat_set.h"
 #include "rtc_base/logging.h"
 
@@ -220,7 +219,8 @@
   for (const auto& config : configurations) {
     out.push_back(config.codec);
     if (type == MediaType::AUDIO) {
-      if (config.resiliency.red && shared_added.insert(kRedCodecName).second) {
+      if (config.resiliency.red &&
+          shared_added.insert(std::string(kRedCodecName)).second) {
         out.push_back(CreateAudioCodec({kRedCodecName, 48000, 2}));
       }
     } else {
diff --git a/sdk/android/native_api/jni/java_types.h b/sdk/android/native_api/jni/java_types.h
index c736af3..4901f48 100644
--- a/sdk/android/native_api/jni/java_types.h
+++ b/sdk/android/native_api/jni/java_types.h
@@ -21,6 +21,7 @@
 
 #include <cstddef>
 #include <cstdint>
+#include <functional>
 #include <map>
 #include <optional>
 #include <span>
@@ -183,11 +184,15 @@
   return native_list;
 }
 
-template <typename Key, typename T, typename Convert>
-std::map<Key, T> JavaToNativeMap(JNIEnv* env,
-                                 const jni_zero::JavaRef<jobject>& j_map,
-                                 Convert convert) {
-  std::map<Key, T> container;
+template <typename Key,
+          typename T,
+          typename Compare = std::less<Key>,
+          typename Convert>
+std::map<Key, T, Compare> JavaToNativeMap(
+    JNIEnv* env,
+    const jni_zero::JavaRef<jobject>& j_map,
+    Convert convert) {
+  std::map<Key, T, Compare> container;
   for (auto const& j_entry : GetJavaMapEntrySet(env, j_map)) {
     container.emplace(convert(env, GetJavaMapEntryKey(env, j_entry),
                               GetJavaMapEntryValue(env, j_entry)));
diff --git a/sdk/android/src/jni/h264_utils.cc b/sdk/android/src/jni/h264_utils.cc
index c0177ac..688cf7b 100644
--- a/sdk/android/src/jni/h264_utils.cc
+++ b/sdk/android/src/jni/h264_utils.cc
@@ -22,8 +22,10 @@
     JNIEnv* env,
     const jni_zero::JavaRef<jobject>& params1,
     const jni_zero::JavaRef<jobject>& params2) {
-  return H264IsSameProfile(JavaToNativeStringMap(env, params1),
-                           JavaToNativeStringMap(env, params2));
+  auto p1 = JavaToNativeStringMap(env, params1);
+  auto p2 = JavaToNativeStringMap(env, params2);
+  return H264IsSameProfile(CodecParameterMap(p1.begin(), p1.end()),
+                           CodecParameterMap(p2.begin(), p2.end()));
 }
 
 }  // namespace jni
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 1bcb47a..f228fc4 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -399,7 +399,7 @@
     const CodecParameterMap& codec_params,
     bool raw_payload) {
   RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
-  if (codec_params.count(kH264FmtpSpsPpsIdrInKeyframe) > 0 ||
+  if (codec_params.count(std::string(kH264FmtpSpsPpsIdrInKeyframe)) > 0 ||
       env_.field_trials().IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
     packet_buffer_.ForceSpsPpsIdrIsH264Keyframe();
     sps_pps_idr_is_h264_keyframe_ = true;
@@ -1410,7 +1410,7 @@
 
   H264SpropParameterSets sprop_decoder;
   auto sprop_base64_it =
-      codec_params_it->second.find(kH264FmtpSpropParameterSets);
+      codec_params_it->second.find(std::string(kH264FmtpSpropParameterSets));
 
   if (sprop_base64_it == codec_params_it->second.end())
     return;
diff --git a/video/rtp_video_stream_receiver2_unittest.cc b/video/rtp_video_stream_receiver2_unittest.cc
index b5a7bb1..d7f50ec 100644
--- a/video/rtp_video_stream_receiver2_unittest.cc
+++ b/video/rtp_video_stream_receiver2_unittest.cc
@@ -930,7 +930,7 @@
   CodecParameterMap codec_params;
   // Example parameter sets from https://tools.ietf.org/html/rfc3984#section-8.2
   // .
-  codec_params.insert({kH264FmtpSpropParameterSets, "Z0IACpZTBYmI,aMljiA=="});
+  codec_params.emplace(kH264FmtpSpropParameterSets, "Z0IACpZTBYmI,aMljiA==");
   rtp_video_stream_receiver_->AddReceiveCodec(kH264PayloadType, kVideoCodecH264,
                                               codec_params,
                                               /*raw_payload=*/false);
@@ -977,7 +977,7 @@
   CodecParameterMap codec_params;
   // Forcing can be done either with field trial or codec_params.
   if (!env_.field_trials().IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
-    codec_params.insert({kH264FmtpSpsPpsIdrInKeyframe, ""});
+    codec_params.emplace(kH264FmtpSpsPpsIdrInKeyframe, "");
   }
   rtp_video_stream_receiver_->AddReceiveCodec(kPayloadType, kVideoCodecH264,
                                               codec_params,