Introduce api/crypto/BUILD.gn.

No-Try: True
Bug: webrtc:8733
Change-Id: I8679735be1e5069e371a9f1115a54e897e09964b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152622
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29186}
diff --git a/BUILD.gn b/BUILD.gn
index 9207a1d..baedb39 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -400,7 +400,9 @@
     deps = [
       ":webrtc_common",
       "api:libjingle_peerconnection_api",
+      "api:rtc_error",
       "api:transport_api",
+      "api/crypto",
       "api/rtc_event_log:rtc_event_log_factory",
       "audio",
       "call",
diff --git a/api/BUILD.gn b/api/BUILD.gn
index ee384c8..71226e9 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -107,10 +107,6 @@
     "candidate.cc",
     "candidate.h",
     "congestion_control_interface.h",
-    "crypto/crypto_options.cc",
-    "crypto/crypto_options.h",
-    "crypto/frame_decryptor_interface.h",
-    "crypto/frame_encryptor_interface.h",
     "crypto_params.h",
     "data_channel_interface.cc",
     "data_channel_interface.h",
@@ -169,6 +165,9 @@
     ":scoped_refptr",
     "audio:audio_mixer_api",
     "audio_codecs:audio_codecs_api",
+    "crypto:frame_decryptor_interface",
+    "crypto:frame_encryptor_interface",
+    "crypto:options",
     "rtc_event_log",
     "task_queue",
     "transport:bitrate_settings",
@@ -726,6 +725,7 @@
       # For api/crypto/frame_encryptor_interface.h
       ":libjingle_peerconnection_api",
       "../test:test_support",
+      "crypto:frame_encryptor_interface",
     ]
   }
 
@@ -738,6 +738,7 @@
     deps = [
       ":libjingle_peerconnection_api",
       "../test:test_support",
+      "crypto:frame_decryptor_interface",
     ]
   }
 
@@ -754,6 +755,7 @@
       "..:webrtc_common",
       "../rtc_base:checks",
       "../rtc_base:rtc_base_approved",
+      "crypto:frame_encryptor_interface",
     ]
   }
 
@@ -770,6 +772,7 @@
       "..:webrtc_common",
       "../rtc_base:checks",
       "../rtc_base:rtc_base_approved",
+      "crypto:frame_decryptor_interface",
     ]
   }
 
diff --git a/api/crypto/BUILD.gn b/api/crypto/BUILD.gn
new file mode 100644
index 0000000..a9bd479
--- /dev/null
+++ b/api/crypto/BUILD.gn
@@ -0,0 +1,52 @@
+# Copyright (c) 2019 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.
+
+import("../../webrtc.gni")
+
+group("crypto") {
+  deps = [
+    ":frame_decryptor_interface",
+    ":frame_encryptor_interface",
+    ":options",
+  ]
+}
+
+rtc_source_set("options") {
+  visibility = [ "*" ]
+  sources = [
+    "crypto_options.cc",
+    "crypto_options.h",
+  ]
+  deps = [
+    "../../rtc_base:rtc_base",
+  ]
+}
+
+rtc_source_set("frame_decryptor_interface") {
+  visibility = [ "*" ]
+  sources = [
+    "frame_decryptor_interface.h",
+  ]
+  deps = [
+    "..:array_view",
+    "..:rtp_parameters",
+    "../../rtc_base:refcount",
+  ]
+}
+
+rtc_source_set("frame_encryptor_interface") {
+  visibility = [ "*" ]
+  sources = [
+    "frame_encryptor_interface.h",
+  ]
+  deps = [
+    "..:array_view",
+    "..:rtp_parameters",
+    "../../rtc_base:refcount",
+  ]
+}
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index dba7b58..bf8e253 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -41,9 +41,6 @@
     "../api:array_view",
     "../api:call_api",
     "../api:function_view",
-
-    # For api/crypto/crypto_options.h
-    "../api:libjingle_peerconnection_api",
     "../api:rtp_headers",
     "../api:rtp_parameters",
     "../api:scoped_refptr",
@@ -52,6 +49,9 @@
     "../api/audio:audio_frame_api",
     "../api/audio:audio_mixer_api",
     "../api/audio_codecs:audio_codecs_api",
+    "../api/crypto:frame_decryptor_interface",
+    "../api/crypto:frame_encryptor_interface",
+    "../api/crypto:options",
     "../api/rtc_event_log",
     "../api/task_queue",
     "../api/transport/media:media_transport_interface",
diff --git a/call/BUILD.gn b/call/BUILD.gn
index f35c1f0..6c2141b 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -31,17 +31,18 @@
     ":rtp_interfaces",
     ":video_stream_api",
     "../api:fec_controller_api",
-    "../api:rtc_error",
-
-    # For api/crypto/crypto_options.h
-    "../api:libjingle_peerconnection_api",
+    "../api:libjingle_peerconnection_api",  # For api/bitrate_constraints.h
     "../api:network_state_predictor_api",
+    "../api:rtc_error",
     "../api:rtp_headers",
     "../api:rtp_parameters",
     "../api:scoped_refptr",
     "../api:transport_api",
     "../api/audio:audio_mixer_api",
     "../api/audio_codecs:audio_codecs_api",
+    "../api/crypto:frame_decryptor_interface",
+    "../api/crypto:frame_encryptor_interface",
+    "../api/crypto:options",
     "../api/task_queue",
     "../api/transport:network_control",
     "../api/transport/media:media_transport_interface",
@@ -80,11 +81,10 @@
   deps = [
     "../api:array_view",
     "../api:fec_controller_api",
-
-    # For api/crypto/crypto_options.h
-    "../api:libjingle_peerconnection_api",
+    "../api:libjingle_peerconnection_api",  # For api/bitrate_constraints.h
     "../api:rtp_headers",
     "../api:rtp_parameters",
+    "../api/crypto:options",
     "../api/rtc_event_log",
     "../api/transport:bitrate_settings",
     "../api/units:timestamp",
@@ -283,10 +283,12 @@
   ]
   deps = [
     ":rtp_interfaces",
-    "../api:libjingle_peerconnection_api",
     "../api:rtp_headers",
     "../api:rtp_parameters",
     "../api:transport_api",
+    "../api/crypto:frame_decryptor_interface",
+    "../api/crypto:frame_encryptor_interface",
+    "../api/crypto:options",
     "../api/transport/media:media_transport_interface",
     "../api/transport/rtp:rtp_source",
     "../api/video:video_frame",
@@ -488,6 +490,8 @@
     deps = [
       ":rtp_interfaces",
       "../api:libjingle_peerconnection_api",
+      "../api/crypto:frame_encryptor_interface",
+      "../api/crypto:options",
       "../modules/pacing",
       "../rtc_base",
       "../rtc_base:rate_limiter",
diff --git a/media/BUILD.gn b/media/BUILD.gn
index be5b2b3..8de518d 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -79,6 +79,9 @@
     "../api:rtp_parameters",
     "../api:scoped_refptr",
     "../api/audio_codecs:audio_codecs_api",
+    "../api/crypto:frame_decryptor_interface",
+    "../api/crypto:frame_encryptor_interface",
+    "../api/crypto:options",
     "../api/transport/media:media_transport_interface",
     "../api/transport/rtp:rtp_source",
     "../api/video:video_bitrate_allocation",
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index eac4c08..c0b35cf 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -225,6 +225,7 @@
     "../../api:scoped_refptr",
     "../../api:transport_api",
     "../../api/audio_codecs:audio_codecs_api",
+    "../../api/crypto:frame_encryptor_interface",
     "../../api/rtc_event_log",
     "../../api/transport:field_trial_based_config",
     "../../api/transport:webrtc_key_value_config",
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index 6a9438d..130d340 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -102,6 +102,7 @@
     "../api:packet_socket_factory",
     "../api:rtc_error",
     "../api:scoped_refptr",
+    "../api/crypto:options",
     "../api/rtc_event_log",
     "../api/transport:enums",
     "../logging:ice_log",
@@ -174,6 +175,7 @@
       ":stun_types",
       "../api:libjingle_peerconnection_api",
       "../api:packet_socket_factory",
+      "../api/crypto:options",
       "../rtc_base",
       "../rtc_base:gunit_helpers",
       "../rtc_base:rtc_base_approved",
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index e75188d..4434139 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -87,6 +87,7 @@
     "../api:rtp_parameters",
     "../api:rtp_parameters",
     "../api:scoped_refptr",
+    "../api/crypto:options",
     "../api/rtc_event_log",
     "../api/transport:datagram_transport_interface",
     "../api/transport/media:media_transport_interface",
@@ -227,6 +228,7 @@
     "../api:rtc_stats_api",
     "../api:rtp_parameters",
     "../api:scoped_refptr",
+    "../api/crypto:frame_decryptor_interface",
     "../api/rtc_event_log",
     "../api/task_queue",
     "../api/transport:datagram_transport_interface",
@@ -549,6 +551,9 @@
       "../api:rtc_error",
       "../api:scoped_refptr",
       "../api/audio:audio_mixer_api",
+      "../api/crypto:frame_decryptor_interface",
+      "../api/crypto:frame_encryptor_interface",
+      "../api/crypto:options",
       "../api/rtc_event_log",
       "../api/rtc_event_log:rtc_event_log_factory",
       "../api/task_queue:default_task_queue_factory",
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 125c6cb..6fa4971 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -927,6 +927,8 @@
         "../api/audio_codecs:audio_codecs_api",
         "../api/audio_codecs:builtin_audio_decoder_factory",
         "../api/audio_codecs:builtin_audio_encoder_factory",
+        "../api/crypto:frame_decryptor_interface",
+        "../api/crypto:frame_encryptor_interface",
         "../api/rtc_event_log:rtc_event_log_factory",
         "../api/task_queue:default_task_queue_factory",
         "../api/transport/media:media_transport_interface",
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 5b0a7fe..d94bfe5 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -761,6 +761,7 @@
       "../../api:libjingle_peerconnection_api",
       "../../api:rtc_event_log_output_file",
       "../../api:rtp_parameters",
+      "../../api/crypto:options",
       "../../api/rtc_event_log:rtc_event_log_factory",
       "../../api/task_queue:default_task_queue_factory",
       "../../api/video_codecs:video_codecs_api",
diff --git a/video/BUILD.gn b/video/BUILD.gn
index af34436..09ea987 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -58,6 +58,8 @@
     "../api:rtp_parameters",
     "../api:scoped_refptr",
     "../api:transport_api",
+    "../api/crypto:frame_decryptor_interface",
+    "../api/crypto:options",
     "../api/rtc_event_log",
     "../api/task_queue",
     "../api/transport/media:media_transport_interface",
@@ -574,6 +576,7 @@
       "../api:rtp_parameters",
       "../api:scoped_refptr",
       "../api:simulated_network_api",
+      "../api/crypto:options",
       "../api/rtc_event_log",
       "../api/task_queue:default_task_queue_factory",
       "../api/test/video:function_video_factory",