api: Add H.265 support to EncodedFrame::CopyCodecSpecific

R=philipel@webrtc.org, tommi@webrtc.org

Bug: b/523234169
Change-Id: I713ae0a9c82c0449ac3b0b711ed7e2b771d9cc9d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/485320
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Jahdiel Suarez <jahdiels@google.com>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#48125}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 44661dc..65714e5 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -1824,6 +1824,7 @@
       "units:time_delta",
       "units:timestamp",
       "units:units_unittests",
+      "video:encoded_frame_unittest",
       "video:frame_buffer_unittest",
       "video:rtp_video_frame_assembler_unittests",
       "video:video_adapter_unittest",
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index 980cdcb..e1719b8 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -504,6 +504,17 @@
     ]
   }
 
+  rtc_library("encoded_frame_unittest") {
+    testonly = true
+    sources = [ "encoded_frame_unittest.cc" ]
+    deps = [
+      ":encoded_frame",
+      ":video_frame",
+      "../../modules/rtp_rtcp:rtp_video_header",
+      "../../test:test_support",
+    ]
+  }
+
   rtc_library("video_adapter_unittest") {
     testonly = true
     sources = [ "video_adapter_unittest.cc" ]
diff --git a/api/video/encoded_frame.cc b/api/video/encoded_frame.cc
index 01838b7..332b444 100644
--- a/api/video/encoded_frame.cc
+++ b/api/video/encoded_frame.cc
@@ -121,6 +121,10 @@
         _codecSpecificInfo.codecType = kVideoCodecAV1;
         break;
       }
+      case kVideoCodecH265: {
+        _codecSpecificInfo.codecType = kVideoCodecH265;
+        break;
+      }
       default: {
         _codecSpecificInfo.codecType = kVideoCodecGeneric;
         break;
diff --git a/api/video/encoded_frame_unittest.cc b/api/video/encoded_frame_unittest.cc
new file mode 100644
index 0000000..4ba984b
--- /dev/null
+++ b/api/video/encoded_frame_unittest.cc
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (c) 2026 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.
+ */
+
+#include "api/video/encoded_frame.h"
+
+#include "api/video/video_codec_type.h"
+#include "modules/rtp_rtcp/source/rtp_video_header.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+namespace {
+
+class TestEncodedFrame : public EncodedFrame {
+ public:
+  using EncodedFrame::CopyCodecSpecific;
+};
+
+TEST(EncodedFrameTest, CopyCodecSpecificH265) {
+  TestEncodedFrame frame;
+  RTPVideoHeader header;
+  header.codec = kVideoCodecH265;
+
+  frame.CopyCodecSpecific(&header);
+
+  EXPECT_EQ(frame.CodecSpecific()->codecType, kVideoCodecH265);
+}
+
+}  // namespace
+}  // namespace webrtc