sdp: backfill default codec parameters for H265

with default values for level-id and tx-mode defined in
  https://datatracker.ietf.org/doc/html/draft-aboba-avtcore-hevc-webrtc

BUG=webrtc:15703

Change-Id: I07d77d69c6376313e693e8ddda1cc0135033549a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338620
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#41732}
diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc
index 6b63eb8..ea43358 100644
--- a/pc/webrtc_sdp.cc
+++ b/pc/webrtc_sdp.cc
@@ -2608,6 +2608,14 @@
       if (!codec.GetParam(cricket::kAv1FmtpTier, &unused_value)) {
         codec.SetParam(cricket::kAv1FmtpTier, "0");
       }
+    } else if (absl::EqualsIgnoreCase(cricket::kH265CodecName, codec.name)) {
+      // https://datatracker.ietf.org/doc/html/draft-aboba-avtcore-hevc-webrtc
+      if (!codec.GetParam(cricket::kH265FmtpLevelId, &unused_value)) {
+        codec.SetParam(cricket::kH265FmtpLevelId, "93");
+      }
+      if (!codec.GetParam(cricket::kH265FmtpTxMode, &unused_value)) {
+        codec.SetParam(cricket::kH265FmtpTxMode, "SRST");
+      }
     }
   }
 }
diff --git a/pc/webrtc_sdp_unittest.cc b/pc/webrtc_sdp_unittest.cc
index 6811381..a31aa2a 100644
--- a/pc/webrtc_sdp_unittest.cc
+++ b/pc/webrtc_sdp_unittest.cc
@@ -5061,7 +5061,7 @@
       "a=setup:actpass\r\n"
       "a=ice-ufrag:ETEn\r\n"
       "a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n"
-      "m=video 9 UDP/TLS/RTP/SAVPF 96 97 98\r\n"
+      "m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99\r\n"
       "c=IN IP4 0.0.0.0\r\n"
       "a=rtcp-mux\r\n"
       "a=sendonly\r\n"
@@ -5069,6 +5069,7 @@
       "a=rtpmap:96 H264/90000\r\n"
       "a=rtpmap:97 VP9/90000\r\n"
       "a=rtpmap:98 AV1/90000\r\n"
+      "a=rtpmap:99 H265/90000\r\n"
       "a=ssrc:1234 cname:test\r\n";
   JsepSessionDescription jdesc(kDummyType);
   EXPECT_TRUE(SdpDeserialize(sdp, &jdesc));
@@ -5077,7 +5078,7 @@
   const auto* description = content.media_description();
   ASSERT_NE(description, nullptr);
   const std::vector<cricket::Codec> codecs = description->codecs();
-  ASSERT_EQ(codecs.size(), 3u);
+  ASSERT_EQ(codecs.size(), 4u);
   std::string value;
 
   EXPECT_EQ(codecs[0].name, "H264");
@@ -5095,5 +5096,10 @@
   EXPECT_EQ(value, "5");
   EXPECT_TRUE(codecs[2].GetParam("tier", &value));
   EXPECT_EQ(value, "0");
-  RTC_LOG(LS_ERROR) << sdp;
+
+  EXPECT_EQ(codecs[3].name, "H265");
+  EXPECT_TRUE(codecs[3].GetParam("level-id", &value));
+  EXPECT_EQ(value, "93");
+  EXPECT_TRUE(codecs[3].GetParam("tx-mode", &value));
+  EXPECT_EQ(value, "SRST");
 }