Use source_sets in component builds and static_library in release builds.

Static libraries don't guarantee that an exported symbol gets linked
into a shared library (and in order to support Chromium's component
build mode, WebRTC needs to be linked as a shared library).

Source sets always pass all the object files to the linker.

On the flip side, source_sets link more object files in release builds
and to avoid this, this CL introduces a the GN template "rtc_library" that
expands to static_library during release builds and to source_set during
component builds.

See: https://gn.googlesource.com/gn/+/master/docs/reference.md#func_source_set

Bug: webrtc:9419
Change-Id: I4667e820c2b3fcec417becbd2034acc13e4f04fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157168
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#29525}
diff --git a/video/BUILD.gn b/video/BUILD.gn
index b1d1b9d..4f4ad96 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -8,7 +8,7 @@
 
 import("../webrtc.gni")
 
-rtc_static_library("video") {
+rtc_library("video") {
   sources = [
     "buffered_frame_decryptor.cc",
     "buffered_frame_decryptor.h",
@@ -128,7 +128,7 @@
   }
 }
 
-rtc_source_set("video_stream_decoder_impl") {
+rtc_library("video_stream_decoder_impl") {
   visibility = [ "*" ]
 
   sources = [
@@ -151,7 +151,7 @@
   ]
 }
 
-rtc_source_set("frame_dumping_decoder") {
+rtc_library("frame_dumping_decoder") {
   visibility = [ "*" ]
 
   sources = [
@@ -171,7 +171,7 @@
   ]
 }
 
-rtc_source_set("video_stream_encoder_impl") {
+rtc_library("video_stream_encoder_impl") {
   visibility = [ "*" ]
 
   # visibility = [ "../api/video:video_stream_encoder_create" ]
@@ -232,7 +232,7 @@
 }
 
 if (rtc_include_tests) {
-  rtc_source_set("video_mocks") {
+  rtc_library("video_mocks") {
     testonly = true
     sources = [
       "test/mock_video_stream_encoder.h",
@@ -242,7 +242,7 @@
       "../test:test_support",
     ]
   }
-  rtc_source_set("video_quality_test") {
+  rtc_library("video_quality_test") {
     testonly = true
 
     # Only targets in this file and api/ can depend on this.
@@ -314,7 +314,7 @@
     }
   }
 
-  rtc_source_set("video_full_stack_tests") {
+  rtc_library("video_full_stack_tests") {
     testonly = true
 
     sources = [
@@ -341,7 +341,7 @@
     ]
   }
 
-  rtc_source_set("video_pc_full_stack_tests") {
+  rtc_library("video_pc_full_stack_tests") {
     testonly = true
 
     sources = [
@@ -364,7 +364,7 @@
     ]
   }
 
-  rtc_static_library("video_loopback_lib") {
+  rtc_library("video_loopback_lib") {
     testonly = true
     sources = [
       "video_loopback.cc",
@@ -508,7 +508,7 @@
   }
 
   # TODO(pbos): Rename test suite.
-  rtc_source_set("video_tests") {
+  rtc_library("video_tests") {
     testonly = true
 
     defines = []