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

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: I6f27003001548ea9d54412fdf62d5dd7a39cfd46
Reviewed-on: https://webrtc-review.googlesource.com/c/106022
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25187}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index ac3e308..babc260 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -128,6 +128,7 @@
     "../rtc_base:rtc_base",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:stringutils",
+    "../rtc_base/system:rtc_export",
   ]
 
   if (is_nacl) {
@@ -250,6 +251,7 @@
   deps = [
     "../rtc_base:checks",
     "../rtc_base:rtc_base_approved",
+    "../rtc_base/system:rtc_export",
   ]
 }
 
diff --git a/api/audio_codecs/L16/BUILD.gn b/api/audio_codecs/L16/BUILD.gn
index e362067..a7d56d0 100644
--- a/api/audio_codecs/L16/BUILD.gn
+++ b/api/audio_codecs/L16/BUILD.gn
@@ -43,6 +43,7 @@
     "../../..:webrtc_common",
     "../../../modules/audio_coding:pcm16b",
     "../../../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/L16/audio_decoder_L16.h b/api/audio_codecs/L16/audio_decoder_L16.h
index 184ec24..b38627d 100644
--- a/api/audio_codecs/L16/audio_decoder_L16.h
+++ b/api/audio_codecs/L16/audio_decoder_L16.h
@@ -18,6 +18,7 @@
 #include "api/audio_codecs/audio_codec_pair_id.h"
 #include "api/audio_codecs/audio_decoder.h"
 #include "api/audio_codecs/audio_format.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -25,7 +26,7 @@
 // CreateAudioDecoderFactory<...>().
 //
 // NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderL16 {
+struct RTC_EXPORT AudioDecoderL16 {
   struct Config {
     bool IsOk() const {
       return (sample_rate_hz == 8000 || sample_rate_hz == 16000 ||
diff --git a/api/audio_codecs/g711/BUILD.gn b/api/audio_codecs/g711/BUILD.gn
index 860ba3d..ebd0b32 100644
--- a/api/audio_codecs/g711/BUILD.gn
+++ b/api/audio_codecs/g711/BUILD.gn
@@ -43,6 +43,7 @@
     "../../..:webrtc_common",
     "../../../modules/audio_coding:g711",
     "../../../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/g711/audio_decoder_g711.h b/api/audio_codecs/g711/audio_decoder_g711.h
index 8275a8c..0c67e5e 100644
--- a/api/audio_codecs/g711/audio_decoder_g711.h
+++ b/api/audio_codecs/g711/audio_decoder_g711.h
@@ -18,6 +18,7 @@
 #include "api/audio_codecs/audio_codec_pair_id.h"
 #include "api/audio_codecs/audio_decoder.h"
 #include "api/audio_codecs/audio_format.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -25,7 +26,7 @@
 // CreateAudioDecoderFactory<...>().
 //
 // NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderG711 {
+struct RTC_EXPORT AudioDecoderG711 {
   struct Config {
     enum class Type { kPcmU, kPcmA };
     bool IsOk() const {
diff --git a/api/audio_codecs/g722/BUILD.gn b/api/audio_codecs/g722/BUILD.gn
index d69596b..101c7a9 100644
--- a/api/audio_codecs/g722/BUILD.gn
+++ b/api/audio_codecs/g722/BUILD.gn
@@ -51,6 +51,7 @@
     "../../..:webrtc_common",
     "../../../modules/audio_coding:g722",
     "../../../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/g722/audio_decoder_g722.h b/api/audio_codecs/g722/audio_decoder_g722.h
index b7bb089..7601b3c 100644
--- a/api/audio_codecs/g722/audio_decoder_g722.h
+++ b/api/audio_codecs/g722/audio_decoder_g722.h
@@ -18,6 +18,7 @@
 #include "api/audio_codecs/audio_codec_pair_id.h"
 #include "api/audio_codecs/audio_decoder.h"
 #include "api/audio_codecs/audio_format.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
@@ -25,7 +26,7 @@
 // CreateAudioDecoderFactory<...>().
 //
 // NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderG722 {
+struct RTC_EXPORT AudioDecoderG722 {
   struct Config {
     bool IsOk() const { return num_channels == 1 || num_channels == 2; }
     int num_channels;
diff --git a/api/audio_codecs/opus/BUILD.gn b/api/audio_codecs/opus/BUILD.gn
index 9c9bf33..af3cd7f 100644
--- a/api/audio_codecs/opus/BUILD.gn
+++ b/api/audio_codecs/opus/BUILD.gn
@@ -20,6 +20,7 @@
   ]
   deps = [
     "../../../rtc_base:rtc_base_approved",
+    "../../../rtc_base/system:rtc_export",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
   defines = []
diff --git a/api/audio_codecs/opus/audio_encoder_opus_config.h b/api/audio_codecs/opus/audio_encoder_opus_config.h
index c7067bb..98a6ef5 100644
--- a/api/audio_codecs/opus/audio_encoder_opus_config.h
+++ b/api/audio_codecs/opus/audio_encoder_opus_config.h
@@ -16,11 +16,12 @@
 #include <vector>
 
 #include "absl/types/optional.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
 // NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderOpusConfig {
+struct RTC_EXPORT AudioEncoderOpusConfig {
   static constexpr int kDefaultFrameSizeMs = 20;
 
   // Opus API allows a min bitrate of 500bps, but Opus documentation suggests
diff --git a/api/candidate.h b/api/candidate.h
index 0a84591..4c650d9 100644
--- a/api/candidate.h
+++ b/api/candidate.h
@@ -20,13 +20,14 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/network_constants.h"
 #include "rtc_base/socketaddress.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace cricket {
 
 // Candidate for ICE based connection discovery.
 // TODO(phoglund): remove things in here that are not needed in the public API.
 
-class Candidate {
+class RTC_EXPORT Candidate {
  public:
   Candidate();
   // TODO(pthatcher): Match the ordering and param list as per RFC 5245
diff --git a/api/jsep.h b/api/jsep.h
index 4d4bcc0..03ce6d7 100644
--- a/api/jsep.h
+++ b/api/jsep.h
@@ -29,6 +29,7 @@
 #include "absl/types/optional.h"
 #include "api/rtcerror.h"
 #include "rtc_base/refcount.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace cricket {
 class Candidate;
@@ -73,13 +74,13 @@
 // Creates a IceCandidateInterface based on SDP string.
 // Returns null if the sdp string can't be parsed.
 // |error| may be null.
-IceCandidateInterface* CreateIceCandidate(const std::string& sdp_mid,
-                                          int sdp_mline_index,
-                                          const std::string& sdp,
-                                          SdpParseError* error);
+RTC_EXPORT IceCandidateInterface* CreateIceCandidate(const std::string& sdp_mid,
+                                                     int sdp_mline_index,
+                                                     const std::string& sdp,
+                                                     SdpParseError* error);
 
 // Creates an IceCandidateInterface based on a parsed candidate structure.
-std::unique_ptr<IceCandidateInterface> CreateIceCandidate(
+RTC_EXPORT std::unique_ptr<IceCandidateInterface> CreateIceCandidate(
     const std::string& sdp_mid,
     int sdp_mline_index,
     const cricket::Candidate& candidate);
@@ -121,7 +122,7 @@
 // and is therefore not expected to be thread safe.
 //
 // An instance can be created by CreateSessionDescription.
-class SessionDescriptionInterface {
+class RTC_EXPORT SessionDescriptionInterface {
  public:
   // String representations of the supported SDP types.
   static const char kOffer[];
@@ -181,21 +182,21 @@
 // |error| may be null.
 // TODO(steveanton): This function is deprecated. Please use the functions below
 // which take an SdpType enum instead. Remove this once it is no longer used.
-SessionDescriptionInterface* CreateSessionDescription(const std::string& type,
-                                                      const std::string& sdp,
-                                                      SdpParseError* error);
+RTC_EXPORT SessionDescriptionInterface* CreateSessionDescription(
+    const std::string& type,
+    const std::string& sdp,
+    SdpParseError* error);
 
 // Creates a SessionDescriptionInterface based on the SDP string and the type.
 // Returns null if the SDP string cannot be parsed.
 // If using the signature with |error_out|, details of the parsing error may be
 // written to |error_out| if it is not null.
-std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
-    SdpType type,
-    const std::string& sdp);
-std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
-    SdpType type,
-    const std::string& sdp,
-    SdpParseError* error_out);
+RTC_EXPORT std::unique_ptr<SessionDescriptionInterface>
+CreateSessionDescription(SdpType type, const std::string& sdp);
+RTC_EXPORT std::unique_ptr<SessionDescriptionInterface>
+CreateSessionDescription(SdpType type,
+                         const std::string& sdp,
+                         SdpParseError* error_out);
 
 // Creates a SessionDescriptionInterface based on a parsed SDP structure and the
 // given type, ID and version.
diff --git a/api/stats/rtcstatsreport.h b/api/stats/rtcstatsreport.h
index f7410b3..8bf1cb5 100644
--- a/api/stats/rtcstatsreport.h
+++ b/api/stats/rtcstatsreport.h
@@ -20,12 +20,13 @@
 #include "rtc_base/refcount.h"
 #include "rtc_base/refcountedobject.h"
 #include "rtc_base/scoped_ref_ptr.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace webrtc {
 
 // A collection of stats.
 // This is accessible as a map from |RTCStats::id| to |RTCStats|.
-class RTCStatsReport : public rtc::RefCountInterface {
+class RTC_EXPORT RTCStatsReport : public rtc::RefCountInterface {
  public:
   typedef std::map<std::string, std::unique_ptr<const RTCStats>> StatsMap;
 
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index f1466d7..389f31b 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -95,6 +95,7 @@
     "../rtc_base:safe_minmax",
     "../rtc_base:stringutils",
     "../rtc_base:weak_ptr",
+    "../rtc_base/system:rtc_export",
     "../rtc_base/third_party/base64",
     "../rtc_base/third_party/sigslot",
     "../system_wrappers:field_trial",
diff --git a/p2p/base/packetsocketfactory.h b/p2p/base/packetsocketfactory.h
index 4667bb1..c903df0 100644
--- a/p2p/base/packetsocketfactory.h
+++ b/p2p/base/packetsocketfactory.h
@@ -17,6 +17,7 @@
 #include "rtc_base/constructormagic.h"
 #include "rtc_base/proxyinfo.h"
 #include "rtc_base/sslcertificate.h"
+#include "rtc_base/system/rtc_export.h"
 
 namespace rtc {
 
@@ -36,7 +37,7 @@
 class AsyncPacketSocket;
 class AsyncResolverInterface;
 
-class PacketSocketFactory {
+class RTC_EXPORT PacketSocketFactory {
  public:
   enum Options {
     OPT_STUN = 0x04,
diff --git a/p2p/base/portallocator.h b/p2p/base/portallocator.h
index 988447c..7026f2b 100644
--- a/p2p/base/portallocator.h
+++ b/p2p/base/portallocator.h
@@ -21,6 +21,7 @@
 #include "rtc_base/helpers.h"
 #include "rtc_base/proxyinfo.h"
 #include "rtc_base/sslcertificate.h"
+#include "rtc_base/system/rtc_export.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
 #include "rtc_base/thread.h"
 #include "rtc_base/thread_checker.h"
@@ -146,7 +147,7 @@
 
 typedef std::vector<ProtocolAddress> PortList;
 // TODO(deadbeef): Rename to TurnServerConfig.
-struct RelayServerConfig {
+struct RTC_EXPORT RelayServerConfig {
   explicit RelayServerConfig(RelayType type);
   RelayServerConfig(const rtc::SocketAddress& address,
                     const std::string& username,
@@ -183,7 +184,7 @@
   rtc::SSLCertificateVerifier* tls_cert_verifier = nullptr;
 };
 
-class PortAllocatorSession : public sigslot::has_slots<> {
+class RTC_EXPORT PortAllocatorSession : public sigslot::has_slots<> {
  public:
   // Content name passed in mostly for logging and debugging.
   PortAllocatorSession(const std::string& content_name,
@@ -330,7 +331,7 @@
 //
 // This allows a PortAllocator subclass to be constructed and configured on one
 // thread, and passed into an object that uses it on a different thread.
-class PortAllocator : public sigslot::has_slots<> {
+class RTC_EXPORT PortAllocator : public sigslot::has_slots<> {
  public:
   PortAllocator();
   ~PortAllocator() override;
diff --git a/p2p/client/basicportallocator.h b/p2p/client/basicportallocator.h
index 8b951ca..fd47bbb 100644
--- a/p2p/client/basicportallocator.h
+++ b/p2p/client/basicportallocator.h
@@ -22,11 +22,12 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/messagequeue.h"
 #include "rtc_base/network.h"
+#include "rtc_base/system/rtc_export.h"
 #include "rtc_base/thread.h"
 
 namespace cricket {
 
-class BasicPortAllocator : public PortAllocator {
+class RTC_EXPORT BasicPortAllocator : public PortAllocator {
  public:
   // note: The (optional) relay_port_factory is owned by caller
   // and must have a life time that exceeds that of BasicPortAllocator.
@@ -110,8 +111,8 @@
               // process will be started.
 };
 
-class BasicPortAllocatorSession : public PortAllocatorSession,
-                                  public rtc::MessageHandler {
+class RTC_EXPORT BasicPortAllocatorSession : public PortAllocatorSession,
+                                             public rtc::MessageHandler {
  public:
   BasicPortAllocatorSession(BasicPortAllocator* allocator,
                             const std::string& content_name,
@@ -274,7 +275,7 @@
 
 // Records configuration information useful in creating ports.
 // TODO(deadbeef): Rename "relay" to "turn_server" in this struct.
-struct PortConfiguration : public rtc::MessageData {
+struct RTC_EXPORT PortConfiguration : public rtc::MessageData {
   // TODO(jiayl): remove |stun_address| when Chrome is updated.
   rtc::SocketAddress stun_address;
   ServerAddresses stun_servers;
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 37bd504..c9d3fa4 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -203,6 +203,7 @@
     "../rtc_base:rtc_base_approved",
     "../rtc_base:stringutils",
     "../rtc_base/experiments:congestion_controller_experiment",
+    "../rtc_base/system:rtc_export",
     "../rtc_base/third_party/base64",
     "../rtc_base/third_party/sigslot",
     "../stats",
diff --git a/pc/videotracksource.h b/pc/videotracksource.h
index 50488dd..cedb75b 100644
--- a/pc/videotracksource.h
+++ b/pc/videotracksource.h
@@ -15,13 +15,14 @@
 #include "api/notifier.h"
 #include "api/video/video_sink_interface.h"
 #include "media/base/mediachannel.h"
+#include "rtc_base/system/rtc_export.h"
 #include "rtc_base/thread_checker.h"
 
 namespace webrtc {
 
 // VideoTrackSource is a convenience base class for implementations of
 // VideoTrackSourceInterface.
-class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
+class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
  public:
   explicit VideoTrackSource(bool remote);
   void SetState(SourceState new_state);