Export symbols needed by the Chromium component build (part 3).

This CL uses RTC_EXPORT (defined in rtc_base/system/rtc_export.h)
to mark WebRTC symbols as visible from a shared library, this doesn't
mean these symbols are part of the public API (please continue to refer
to [1] for info about what is considered public WebRTC API).

Bug: webrtc:9419
Change-Id: I4d4e2ae52ee01de68147fd0f2cfe4c92d600ad94
Reviewed-on: https://webrtc-review.googlesource.com/c/106343
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25207}
diff --git a/api/audio/echo_canceller3_config_json.h b/api/audio/echo_canceller3_config_json.h
index b315bf0..3c8b975 100644
--- a/api/audio/echo_canceller3_config_json.h
+++ b/api/audio/echo_canceller3_config_json.h
@@ -15,13 +15,15 @@
 
 #include "absl/strings/string_view.h"
 #include "api/audio/echo_canceller3_config.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 // Parses a JSON-encoded string into an Aec3 config. Fields corresponds to
 // substruct names, with the addition that there must be a top-level node
 // "aec3". Returns default config values for anything that cannot be parsed from
 // the string.
-EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string);
+RTC_EXPORT EchoCanceller3Config
+Aec3ConfigFromJsonString(absl::string_view json_string);
 
 // Encodes an Aec3 config in JSON format. Fields corresponds to substruct names,
 // with the addition that the top-level node is named "aec3".
diff --git a/api/audio_codecs/isac/BUILD.gn b/api/audio_codecs/isac/BUILD.gn
index e1bed07..9025360 100644
--- a/api/audio_codecs/isac/BUILD.gn
+++ b/api/audio_codecs/isac/BUILD.gn
@@ -114,6 +114,7 @@
     "../../..:webrtc_common",
     "../../../modules/audio_coding:isac",
     "../../../rtc_base:rtc_base_approved",
+    "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/memory",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
diff --git a/api/audio_codecs/isac/audio_encoder_isac_float.h b/api/audio_codecs/isac/audio_encoder_isac_float.h
index 5df2dd3..81b5c2e 100644
--- a/api/audio_codecs/isac/audio_encoder_isac_float.h
+++ b/api/audio_codecs/isac/audio_encoder_isac_float.h
@@ -18,6 +18,7 @@
 #include "api/audio_codecs/audio_codec_pair_id.h"
 #include "api/audio_codecs/audio_encoder.h"
 #include "api/audio_codecs/audio_format.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -25,7 +26,7 @@
 // parameter to CreateAudioEncoderFactory<...>().
 //
 // NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderIsacFloat {
+struct RTC_EXPORT AudioEncoderIsacFloat {
   struct Config {
     bool IsOk() const {
       switch (sample_rate_hz) {
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index 141b2c9..8775cf0 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -113,6 +113,7 @@
 #include "rtc_base/socketaddress.h"
 #include "rtc_base/sslcertificate.h"
 #include "rtc_base/sslstreamadapter.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace rtc {
 class SSLIdentity;
@@ -1376,7 +1377,8 @@
 // be created and used.
 // If |network_controller_factory| is provided, it will be used if enabled via
 // field trial.
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
+RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
+CreatePeerConnectionFactory(
     rtc::Thread* network_thread,
     rtc::Thread* worker_thread,
     rtc::Thread* signaling_thread,
diff --git a/api/stats/rtcstats.h b/api/stats/rtcstats.h
index 1705f6ab..f65df28 100644
--- a/api/stats/rtcstats.h
+++ b/api/stats/rtcstats.h
@@ -18,6 +18,7 @@
 #include <vector>
 
 #include "rtc_base/checks.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -47,7 +48,7 @@
 // for (const RTCStatsMemberInterface* member : foo.Members()) {
 //   printf("%s = %s\n", member->name(), member->ValueToString().c_str());
 // }
-class RTCStats {
+class RTC_EXPORT RTCStats {
  public:
   RTCStats(const std::string& id, int64_t timestamp_us)
       : id_(id), timestamp_us_(timestamp_us) {}
@@ -247,7 +248,7 @@
 // (undefined reference to |kType|). The supported types are the ones described
 // by |RTCStatsMemberInterface::Type|.
 template <typename T>
-class RTCStatsMember : public RTCStatsMemberInterface {
+class RTC_EXPORT RTCStatsMember : public RTCStatsMemberInterface {
  public:
   static const Type kType;
 
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index f377809..dc9da72 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -16,6 +16,7 @@
 #include <vector>
 
 #include "api/stats/rtcstats.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -73,7 +74,7 @@
 };
 
 // https://w3c.github.io/webrtc-stats/#certificatestats-dict*
-class RTCCertificateStats final : public RTCStats {
+class RTC_EXPORT RTCCertificateStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -89,7 +90,7 @@
 };
 
 // https://w3c.github.io/webrtc-stats/#codec-dict*
-class RTCCodecStats final : public RTCStats {
+class RTC_EXPORT RTCCodecStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -110,7 +111,7 @@
 };
 
 // https://w3c.github.io/webrtc-stats/#dcstats-dict*
-class RTCDataChannelStats final : public RTCStats {
+class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -132,7 +133,7 @@
 
 // https://w3c.github.io/webrtc-stats/#candidatepair-dict*
 // TODO(hbos): Tracking bug https://bugs.webrtc.org/7062
-class RTCIceCandidatePairStats final : public RTCStats {
+class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -186,7 +187,7 @@
 // crbug.com/632723
 // TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect
 // them in the new PeerConnection::GetStats.
-class RTCIceCandidateStats : public RTCStats {
+class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -221,7 +222,7 @@
 // |kType| need to be different ("RTCStatsType type") in the local/remote case.
 // https://w3c.github.io/webrtc-stats/#rtcstatstype-str*
 // This forces us to have to override copy() and type().
-class RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
+class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
  public:
   static const char kType[];
   RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us);
@@ -230,7 +231,8 @@
   const char* type() const override;
 };
 
-class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats {
+class RTC_EXPORT RTCRemoteIceCandidateStats final
+    : public RTCIceCandidateStats {
  public:
   static const char kType[];
   RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us);
@@ -241,7 +243,7 @@
 
 // https://w3c.github.io/webrtc-stats/#msstats-dict*
 // TODO(hbos): Tracking bug crbug.com/660827
-class RTCMediaStreamStats final : public RTCStats {
+class RTC_EXPORT RTCMediaStreamStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -256,7 +258,7 @@
 
 // https://w3c.github.io/webrtc-stats/#mststats-dict*
 // TODO(hbos): Tracking bug crbug.com/659137
-class RTCMediaStreamTrackStats final : public RTCStats {
+class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -309,7 +311,7 @@
 };
 
 // https://w3c.github.io/webrtc-stats/#pcstats-dict*
-class RTCPeerConnectionStats final : public RTCStats {
+class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -324,7 +326,7 @@
 
 // https://w3c.github.io/webrtc-stats/#streamstats-dict*
 // TODO(hbos): Tracking bug crbug.com/657854
-class RTCRTPStreamStats : public RTCStats {
+class RTC_EXPORT RTCRTPStreamStats : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -362,7 +364,7 @@
 // https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
 // TODO(hbos): Support the remote case |is_remote = true|.
 // https://bugs.webrtc.org/7065
-class RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
+class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -406,7 +408,7 @@
 // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
 // TODO(hbos): Support the remote case |is_remote = true|.
 // https://bugs.webrtc.org/7066
-class RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
+class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
@@ -423,7 +425,7 @@
 };
 
 // https://w3c.github.io/webrtc-stats/#transportstats-dict*
-class RTCTransportStats final : public RTCStats {
+class RTC_EXPORT RTCTransportStats final : public RTCStats {
  public:
   WEBRTC_RTCSTATS_DECL();
 
diff --git a/api/video_codecs/BUILD.gn b/api/video_codecs/BUILD.gn
index 152caaf..6bf1a04 100644
--- a/api/video_codecs/BUILD.gn
+++ b/api/video_codecs/BUILD.gn
@@ -35,6 +35,7 @@
     "../..:webrtc_common",
     "../../rtc_base:checks",
     "../../rtc_base:rtc_base_approved",
+    "../../rtc_base/system:rtc_export",
     "../video:encoded_image",
     "../video:video_bitrate_allocation",
     "../video:video_frame",
diff --git a/api/video_codecs/video_codec.h b/api/video_codecs/video_codec.h
index 5b4ebb2..c5758a4 100644
--- a/api/video_codecs/video_codec.h
+++ b/api/video_codecs/video_codec.h
@@ -14,6 +14,7 @@
 #include <string>
 
 #include "common_types.h"  // NOLINT(build/include)
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -98,7 +99,7 @@
 enum class VideoCodecMode { kRealtimeVideo, kScreensharing };
 
 // Common video codec properties
-class VideoCodec {
+class RTC_EXPORT VideoCodec {
  public:
   VideoCodec();
 
diff --git a/api/video_codecs/video_decoder.h b/api/video_codecs/video_decoder.h
index 569e3cf..83763e2 100644
--- a/api/video_codecs/video_decoder.h
+++ b/api/video_codecs/video_decoder.h
@@ -18,6 +18,7 @@
 #include "api/video/encoded_image.h"
 #include "api/video/video_frame.h"
 #include "api/video_codecs/video_codec.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -47,7 +48,7 @@
   virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId);
 };
 
-class VideoDecoder {
+class RTC_EXPORT VideoDecoder {
  public:
   virtual ~VideoDecoder() {}
 
diff --git a/api/video_codecs/video_encoder.h b/api/video_codecs/video_encoder.h
index 4a4a8b6..8f7d619 100644
--- a/api/video_codecs/video_encoder.h
+++ b/api/video_codecs/video_encoder.h
@@ -21,6 +21,7 @@
 #include "api/video/video_frame.h"
 #include "api/video_codecs/video_codec.h"
 #include "rtc_base/checks.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -73,7 +74,7 @@
   virtual void OnDroppedFrame(DropReason reason) {}
 };
 
-class VideoEncoder {
+class RTC_EXPORT VideoEncoder {
  public:
   struct QpThresholds {
     QpThresholds(int l, int h) : low(l), high(h) {}
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 5b40e86..be3fd37 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -42,6 +42,7 @@
     "..:webrtc_common",
     "../rtc_base:rtc_base",
     "../rtc_base:rtc_base_approved",
+    "../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
 }
@@ -218,6 +219,7 @@
     "../rtc_base:checks",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:sequenced_task_checker",
+    "../rtc_base/system:rtc_export",
     "../system_wrappers",
     "//third_party/abseil-cpp/absl/types:optional",
     "//third_party/libyuv",
@@ -239,6 +241,7 @@
     "../modules/video_coding:video_coding_utility",
     "../rtc_base:audio_format_to_string",
     "../rtc_base:checks",
+    "../rtc_base/system:rtc_export",
     "../rtc_base/third_party/base64",
     "../system_wrappers:field_trial",
     "../system_wrappers:metrics",
diff --git a/media/base/h264_profile_level_id.h b/media/base/h264_profile_level_id.h
index b4ff883..e4ea514 100644
--- a/media/base/h264_profile_level_id.h
+++ b/media/base/h264_profile_level_id.h
@@ -16,6 +16,7 @@
 
 #include "absl/types/optional.h"
 #include "common_types.h"  // NOLINT(build/include)
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 namespace H264 {
@@ -68,7 +69,8 @@
 // given number of frames per second, return the highest H.264 level where it
 // can guarantee that it will be able to support all valid encoded streams that
 // are within that level.
-absl::optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps);
+RTC_EXPORT absl::optional<Level> SupportedLevel(int max_frame_pixel_count,
+                                                float max_fps);
 
 // Returns canonical string representation as three hex bytes of the profile
 // level id, or returns nothing for invalid profile level ids.
diff --git a/media/engine/convert_legacy_video_factory.h b/media/engine/convert_legacy_video_factory.h
index 5bd3580..27383ab 100644
--- a/media/engine/convert_legacy_video_factory.h
+++ b/media/engine/convert_legacy_video_factory.h
@@ -13,6 +13,8 @@
 
 #include <memory>
 
+#include "rtc_base/system/rtc_export.h"
+
 namespace webrtc {
 class VideoEncoderFactory;
 class VideoDecoderFactory;
@@ -27,10 +29,12 @@
 // new type of codec factories. The purpose of these functions is to provide an
 // easy way for clients to migrate to the API with new factory types.
 // TODO(magjed): Remove once old factories are gone, webrtc:7925.
-std::unique_ptr<webrtc::VideoEncoderFactory> ConvertVideoEncoderFactory(
+RTC_EXPORT std::unique_ptr<webrtc::VideoEncoderFactory>
+ConvertVideoEncoderFactory(
     std::unique_ptr<WebRtcVideoEncoderFactory> external_encoder_factory);
 
-std::unique_ptr<webrtc::VideoDecoderFactory> ConvertVideoDecoderFactory(
+RTC_EXPORT std::unique_ptr<webrtc::VideoDecoderFactory>
+ConvertVideoDecoderFactory(
     std::unique_ptr<WebRtcVideoDecoderFactory> external_decoder_factory);
 
 }  // namespace cricket
diff --git a/media/engine/multiplexcodecfactory.h b/media/engine/multiplexcodecfactory.h
index 7a851c8..ae099a4 100644
--- a/media/engine/multiplexcodecfactory.h
+++ b/media/engine/multiplexcodecfactory.h
@@ -16,6 +16,7 @@
 
 #include "api/video_codecs/video_decoder_factory.h"
 #include "api/video_codecs/video_encoder_factory.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 // Multiplex codec is a completely modular/optional codec that allows users to
@@ -36,7 +37,7 @@
 // and decoder instance(s) using these factories.
 // - Use Multiplex*coderFactory classes in CreatePeerConnectionFactory() calls.
 // - Select "multiplex" codec in SDP negotiation.
-class MultiplexEncoderFactory : public VideoEncoderFactory {
+class RTC_EXPORT MultiplexEncoderFactory : public VideoEncoderFactory {
  public:
   // |supports_augmenting_data| defines if the encoder would support augmenting
   // data. If set, the encoder expects to receive video frame buffers of type
@@ -54,7 +55,7 @@
   const bool supports_augmenting_data_;
 };
 
-class MultiplexDecoderFactory : public VideoDecoderFactory {
+class RTC_EXPORT MultiplexDecoderFactory : public VideoDecoderFactory {
  public:
   // |supports_augmenting_data| defines if the decoder would support augmenting
   // data. If set, the decoder is expected to output video frame buffers of type
diff --git a/media/engine/webrtcvideodecoderfactory.h b/media/engine/webrtcvideodecoderfactory.h
index 016cb09..b81ac34 100644
--- a/media/engine/webrtcvideodecoderfactory.h
+++ b/media/engine/webrtcvideodecoderfactory.h
@@ -16,6 +16,7 @@
 #include "common_types.h"  // NOLINT(build/include)
 #include "media/base/codec.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 class VideoDecoder;
@@ -29,7 +30,7 @@
 
 // Deprecated. Use webrtc::VideoDecoderFactory instead.
 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7925
-class WebRtcVideoDecoderFactory {
+class RTC_EXPORT WebRtcVideoDecoderFactory {
  public:
   // Caller takes the ownership of the returned object and it should be released
   // by calling DestroyVideoDecoder().
diff --git a/modules/BUILD.gn b/modules/BUILD.gn
index 1df9865..ef029914 100644
--- a/modules/BUILD.gn
+++ b/modules/BUILD.gn
@@ -54,6 +54,7 @@
     "../api:libjingle_peerconnection_api",
     "../modules/rtp_rtcp:rtp_video_header",
     "../rtc_base:safe_conversions",
+    "../rtc_base/system:rtc_export",
   ]
 }
 
diff --git a/modules/include/module_common_types.h b/modules/include/module_common_types.h
index 98ff767..e058cc8 100644
--- a/modules/include/module_common_types.h
+++ b/modules/include/module_common_types.h
@@ -19,6 +19,7 @@
 #include "modules/include/module_common_types_public.h"
 #include "modules/include/module_fec_types.h"
 #include "modules/rtp_rtcp/source/rtp_video_header.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -33,7 +34,7 @@
   int64_t ntp_time_ms;
 };
 
-class RTPFragmentationHeader {
+class RTC_EXPORT RTPFragmentationHeader {
  public:
   RTPFragmentationHeader();
   RTPFragmentationHeader(const RTPFragmentationHeader&) = delete;
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index afa677d..6ff9bc4 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -303,6 +303,7 @@
     "../../media:rtc_media_base",
     "../../rtc_base:checks",
     "../../rtc_base:rtc_base",
+    "../../rtc_base/system:rtc_export",
     "../../system_wrappers:metrics",
     "//third_party/abseil-cpp/absl/memory",
     "//third_party/libyuv",
diff --git a/modules/video_coding/codecs/h264/include/h264.h b/modules/video_coding/codecs/h264/include/h264.h
index e23818b..f5cebcf 100644
--- a/modules/video_coding/codecs/h264/include/h264.h
+++ b/modules/video_coding/codecs/h264/include/h264.h
@@ -17,6 +17,7 @@
 
 #include "media/base/codec.h"
 #include "modules/video_coding/include/video_codec_interface.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -26,13 +27,13 @@
 // |rtc_use_h264| build flag is true (if false, this function does nothing).
 // This function should only be called before or during WebRTC initialization
 // and is not thread-safe.
-void DisableRtcUseH264();
+RTC_EXPORT void DisableRtcUseH264();
 
 // Returns a vector with all supported internal H264 profiles that we can
 // negotiate in SDP, in order of preference.
 std::vector<SdpVideoFormat> SupportedH264Codecs();
 
-class H264Encoder : public VideoEncoder {
+class RTC_EXPORT H264Encoder : public VideoEncoder {
  public:
   static std::unique_ptr<H264Encoder> Create(const cricket::VideoCodec& codec);
   // If H.264 is supported (any implementation).
@@ -41,7 +42,7 @@
   ~H264Encoder() override {}
 };
 
-class H264Decoder : public VideoDecoder {
+class RTC_EXPORT H264Decoder : public VideoDecoder {
  public:
   static std::unique_ptr<H264Decoder> Create();
   static bool IsSupported();