Refactor encoder-complexity param in VideoCodec w/backward compatibility

Move complexity parameter to the main VideoCodec class to enable
additional video codecs to use the parameter without creating a new
codec-specific structure.

Bug: webrtc:13694
Change-Id: Icb7cf640b178875d799f39ade8b5084e3222bb1c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251921
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Michael Horowitz <mhoro@google.com>
Cr-Commit-Position: refs/heads/main@{#36040}
diff --git a/api/video_codecs/video_codec.h b/api/video_codecs/video_codec.h
index 1e6e21c..f00176d 100644
--- a/api/video_codecs/video_codec.h
+++ b/api/video_codecs/video_codec.h
@@ -109,6 +109,9 @@
     scalability_mode_ = std::string(scalability_mode);
   }
 
+  VideoCodecComplexity GetVideoEncoderComplexity() const;
+  void SetVideoEncoderComplexity(VideoCodecComplexity complexity_setting);
+
   // Public variables. TODO(hta): Make them private with accessors.
   VideoCodecType codecType;
 
@@ -169,6 +172,9 @@
   // This will allow removing the VideoCodec* types from this file.
   VideoCodecUnion codec_specific_;
   std::string scalability_mode_;
+  // 'complexity_' indicates the CPU capability of the client. It's used to
+  // determine encoder CPU complexity (e.g., cpu_used for VP8, VP9. and AV1).
+  absl::optional<VideoCodecComplexity> complexity_;
 };
 
 }  // namespace webrtc