1# Copyright 2016 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import("../webrtc.gni")
10if (is_ios) {
11  import("//build/config/ios/ios_sdk.gni")
12  import("//build/config/ios/rules.gni")
13}
14if (is_mac) {
15  import("//build/config/mac/rules.gni")
16}
17
18group("sdk") {
19  public_deps = []
20  if (!build_with_chromium) {
21    if (is_android) {
22      public_deps += [ "android" ]
23    }
24    if (is_ios) {
25      public_deps += [ ":framework_objc" ]
26    }
27  }
28}
29
30rtc_library("media_constraints") {
31  sources = [
32    "media_constraints.cc",
33    "media_constraints.h",
34  ]
35  deps = [
36    "../api:audio_options_api",
37    "../api:libjingle_peerconnection_api",
38  ]
39  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
40}
41
42rtc_library("sdk_tests") {
43  testonly = true
44  sources = [ "media_constraints_unittest.cc" ]
45  deps = [
46    ":media_constraints",
47    "../test:test_support",
48  ]
49}
50
51if (is_ios || is_mac) {
52  config("common_config_objc") {
53    include_dirs = [
54      "objc",
55
56      # This is needed so that framework headers can include base headers
57      # without pathname (so it works from within the framework module).
58      "objc/base",
59
60      # This is here for backward compatiblity reasons.
61      "objc/Framework/Headers",  # TODO(bugs.webrtc.org/9627): Remove this.
62    ]
63    cflags = [
64      "-Wimplicit-retain-self",
65      "-Wstrict-overflow",
66      "-Wmissing-field-initializers",
67    ]
68
69    if (use_clang_coverage) {
70      configs = [ "//build/config/coverage:default_coverage" ]
71    }
72  }
73
74  config("used_from_extension") {
75    if (is_ios && rtc_apprtcmobile_broadcast_extension) {
76      cflags = [ "-fapplication-extension" ]
77    }
78  }
79
80  # TODO(bugs.webrtc.org/9627): Remove this when unused. Targets should depend on base_objc
81  # or helpers_objc directly instead.
82  rtc_library("common_objc") {
83    visibility = [ "*" ]
84
85    sources = [ "objc/helpers/noop.mm" ]
86
87    public_configs = [ ":common_config_objc" ]
88
89    deps = [
90      ":base_objc",
91      ":helpers_objc",
92    ]
93  }
94
95  rtc_library("base_objc") {
96    visibility = [ "*" ]
97    sources = [
98      "objc/base/RTCCodecSpecificInfo.h",
99      "objc/base/RTCEncodedImage.h",
100      "objc/base/RTCEncodedImage.m",
101      "objc/base/RTCI420Buffer.h",
102      "objc/base/RTCLogging.h",
103      "objc/base/RTCLogging.mm",
104      "objc/base/RTCMacros.h",
105      "objc/base/RTCMutableI420Buffer.h",
106      "objc/base/RTCMutableYUVPlanarBuffer.h",
107      "objc/base/RTCRtpFragmentationHeader.h",
108      "objc/base/RTCRtpFragmentationHeader.m",
109      "objc/base/RTCVideoCapturer.h",
110      "objc/base/RTCVideoCapturer.m",
111      "objc/base/RTCVideoCodecInfo.h",
112      "objc/base/RTCVideoCodecInfo.m",
113      "objc/base/RTCVideoDecoder.h",
114      "objc/base/RTCVideoDecoderFactory.h",
115      "objc/base/RTCVideoEncoder.h",
116      "objc/base/RTCVideoEncoderFactory.h",
117      "objc/base/RTCVideoEncoderQpThresholds.h",
118      "objc/base/RTCVideoEncoderQpThresholds.m",
119      "objc/base/RTCVideoEncoderSettings.h",
120      "objc/base/RTCVideoEncoderSettings.m",
121      "objc/base/RTCVideoFrame.h",
122      "objc/base/RTCVideoFrame.mm",
123      "objc/base/RTCVideoFrameBuffer.h",
124      "objc/base/RTCVideoRenderer.h",
125      "objc/base/RTCYUVPlanarBuffer.h",
126    ]
127
128    deps = [
129      "../rtc_base",
130      "../rtc_base:checks",
131    ]
132    configs += [
133      "..:common_objc",
134      ":used_from_extension",
135    ]
136
137    public_configs = [ ":common_config_objc" ]
138  }
139
140  rtc_library("helpers_objc") {
141    sources = [
142      "objc/helpers/AVCaptureSession+DevicePosition.h",
143      "objc/helpers/AVCaptureSession+DevicePosition.mm",
144      "objc/helpers/NSString+StdString.h",
145      "objc/helpers/NSString+StdString.mm",
146      "objc/helpers/RTCDispatcher+Private.h",
147      "objc/helpers/RTCDispatcher.h",
148      "objc/helpers/RTCDispatcher.m",
149      "objc/helpers/scoped_cftyperef.h",
150    ]
151
152    deps = [
153      ":base_objc",
154      "../rtc_base:checks",
155    ]
156
157    frameworks = [
158      "AVFoundation.framework",
159      "CoreMedia.framework",
160    ]
161
162    configs += [
163      "..:common_objc",
164      ":used_from_extension",
165    ]
166
167    public_configs = [ ":common_config_objc" ]
168
169    if (is_ios) {
170      sources += [
171        "objc/helpers/RTCCameraPreviewView.h",
172        "objc/helpers/RTCCameraPreviewView.m",
173        "objc/helpers/UIDevice+RTCDevice.h",
174        "objc/helpers/UIDevice+RTCDevice.mm",
175      ]
176    }
177  }
178
179  if (!build_with_chromium) {
180    rtc_library("callback_logger_objc") {
181      sources = [
182        "objc/api/logging/RTCCallbackLogger.h",
183        "objc/api/logging/RTCCallbackLogger.mm",
184      ]
185
186      deps = [
187        ":base_objc",
188        "../rtc_base",
189        "../rtc_base:checks",
190        "../rtc_base:logging",
191      ]
192
193      configs += [
194        "..:common_objc",
195        ":used_from_extension",
196      ]
197    }
198
199    rtc_library("file_logger_objc") {
200      sources = [
201        "objc/api/peerconnection/RTCFileLogger.h",
202        "objc/api/peerconnection/RTCFileLogger.mm",
203      ]
204
205      deps = [
206        ":base_objc",
207        "../rtc_base",
208        "../rtc_base:checks",
209        "../rtc_base:logging",
210      ]
211
212      configs += [
213        "..:common_objc",
214        ":used_from_extension",
215      ]
216    }
217  }
218
219  if (!build_with_chromium) {
220    if (is_ios) {
221      rtc_library("native_api_audio_device_module") {
222        visibility = [ "*" ]
223
224        sources = [
225          "objc/native/api/audio_device_module.h",
226          "objc/native/api/audio_device_module.mm",
227        ]
228
229        deps = [
230          ":audio_device",
231          "../modules/audio_device:audio_device_api",
232          "../modules/audio_device:audio_device_generic",
233          "../rtc_base:checks",
234          "../rtc_base:rtc_base_approved",
235          "../system_wrappers",
236        ]
237      }
238
239      rtc_source_set("audio_session_observer") {
240        visibility = [ ":*" ]
241
242        sources = [ "objc/native/src/audio/audio_session_observer.h" ]
243
244        deps = [ "../rtc_base" ]
245      }
246
247      rtc_library("audio_device") {
248        visibility = [ "*" ]
249
250        sources = [
251          "objc/native/src/audio/audio_device_ios.h",
252          "objc/native/src/audio/audio_device_ios.mm",
253          "objc/native/src/audio/audio_device_module_ios.h",
254          "objc/native/src/audio/audio_device_module_ios.mm",
255          "objc/native/src/audio/helpers.h",
256          "objc/native/src/audio/helpers.mm",
257          "objc/native/src/audio/voice_processing_audio_unit.h",
258          "objc/native/src/audio/voice_processing_audio_unit.mm",
259        ]
260
261        deps = [
262          ":audio_objc",
263          ":audio_session_observer",
264          ":base_objc",
265          "../api:array_view",
266          "../api/task_queue",
267          "../api/task_queue:default_task_queue_factory",
268          "../modules/audio_device:audio_device_api",
269          "../modules/audio_device:audio_device_buffer",
270          "../modules/audio_device:audio_device_generic",
271          "../rtc_base",
272          "../rtc_base:checks",
273          "../system_wrappers:field_trial",
274          "../system_wrappers:metrics",
275        ]
276        absl_deps = [ "//third_party/abseil-cpp/absl/base:core_headers" ]
277
278        frameworks = [ "AudioToolbox.framework" ]
279      }
280
281      # This target exists to expose :audio_session_objc and
282      # :audio_session_delegate_adapter_objc for backward compatibility,
283      # and should be deprecated.
284      group("audio_objc") {
285        public_deps = [  # no-presubmit-check TODO(webrtc:11238)
286          ":audio_session_delegate_adapter_objc",
287          ":audio_session_objc",
288        ]
289      }
290
291      rtc_library("audio_session_delegate_adapter_objc") {
292        sources = [
293          "objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h",
294          "objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm",
295        ]
296
297        configs += [
298          "..:common_objc",
299          ":used_from_extension",
300        ]
301
302        public_configs = [ ":common_config_objc" ]
303
304        deps = [
305          ":audio_session_objc",
306          ":audio_session_observer",
307          ":base_objc",
308        ]
309      }
310
311      rtc_library("audio_session_objc") {
312        visibility = [ "*" ]
313
314        sources = [
315          "objc/components/audio/RTCAudioSession+Configuration.mm",
316          "objc/components/audio/RTCAudioSession+Private.h",
317          "objc/components/audio/RTCAudioSession.h",
318          "objc/components/audio/RTCAudioSession.mm",
319          "objc/components/audio/RTCAudioSessionConfiguration.h",
320          "objc/components/audio/RTCAudioSessionConfiguration.m",
321        ]
322
323        configs += [
324          "..:common_objc",
325          ":used_from_extension",
326        ]
327
328        public_configs = [ ":common_config_objc" ]
329
330        frameworks = [ "AVFoundation.framework" ]
331
332        deps = [
333          ":base_objc",
334          ":helpers_objc",
335          "../rtc_base",
336          "../rtc_base:checks",
337          "../rtc_base:rtc_base_approved",
338        ]
339      }
340    }
341
342    rtc_library("videosource_objc") {
343      sources = [
344        "objc/api/peerconnection/RTCVideoSource+Private.h",
345        "objc/api/peerconnection/RTCVideoSource.h",
346        "objc/api/peerconnection/RTCVideoSource.mm",
347      ]
348
349      deps = [
350        ":base_objc",
351        ":mediasource_objc",
352        ":native_video",
353        ":videoframebuffer_objc",
354        "../api:libjingle_peerconnection_api",
355        "../api:media_stream_interface",
356        "../api/video:video_frame",
357        "../api/video:video_frame_i420",
358        "../api/video:video_rtp_headers",
359        "../common_video",
360        "../media:rtc_media_base",
361        "../rtc_base",
362        "../rtc_base:checks",
363        "//third_party/libyuv",
364      ]
365
366      configs += [
367        "..:common_objc",
368        ":used_from_extension",
369      ]
370    }
371
372    rtc_library("videoframebuffer_objc") {
373      visibility = [ "*" ]
374      sources = [
375        "objc/api/video_frame_buffer/RTCNativeI420Buffer+Private.h",
376        "objc/api/video_frame_buffer/RTCNativeI420Buffer.h",
377        "objc/api/video_frame_buffer/RTCNativeI420Buffer.mm",
378        "objc/api/video_frame_buffer/RTCNativeMutableI420Buffer.h",
379        "objc/api/video_frame_buffer/RTCNativeMutableI420Buffer.mm",
380        "objc/components/video_frame_buffer/RTCCVPixelBuffer.h",
381        "objc/components/video_frame_buffer/RTCCVPixelBuffer.mm",
382      ]
383      deps = [
384        ":base_objc",
385        "//api/video:video_frame",
386        "//api/video:video_frame_i420",
387        "//api/video:video_rtp_headers",
388        "//common_video",
389        "//rtc_base:checks",
390        "//rtc_base:rtc_base_approved",
391        "//third_party/libyuv",
392      ]
393      configs += [
394        "..:common_objc",
395        ":used_from_extension",
396      ]
397      frameworks = [
398        "VideoToolbox.framework",
399        "CoreGraphics.framework",
400        "CoreVideo.framework",
401      ]
402    }
403
404    rtc_library("video_objc") {
405      sources = [
406        "objc/components/renderer/opengl/RTCDefaultShader.h",
407        "objc/components/renderer/opengl/RTCDefaultShader.mm",
408        "objc/components/renderer/opengl/RTCI420TextureCache.h",
409        "objc/components/renderer/opengl/RTCI420TextureCache.mm",
410        "objc/components/renderer/opengl/RTCOpenGLDefines.h",
411        "objc/components/renderer/opengl/RTCShader.h",
412        "objc/components/renderer/opengl/RTCShader.mm",
413        "objc/components/renderer/opengl/RTCVideoViewShading.h",
414      ]
415      frameworks = [ "CoreVideo.framework" ]
416      if (is_ios) {
417        sources += [
418          "objc/components/renderer/opengl/RTCNV12TextureCache.h",
419          "objc/components/renderer/opengl/RTCNV12TextureCache.m",
420        ]
421        frameworks += [
422          "GLKit.framework",
423          "OpenGLES.framework",
424          "QuartzCore.framework",
425        ]
426      } else if (is_mac) {
427        frameworks += [
428          "CoreMedia.framework",
429          "OpenGL.framework",
430        ]
431      }
432
433      deps = [
434        ":base_objc",
435        ":helpers_objc",
436        ":mediaconstraints_objc",
437        ":native_video",
438        ":videoframebuffer_objc",
439        ":videosource_objc",
440        "../api:libjingle_peerconnection_api",
441        "../api/video:video_frame",
442        "../api/video:video_rtp_headers",
443        "../common_video",
444        "../media:rtc_media_base",
445        "../rtc_base",
446        "../rtc_base:checks",
447      ]
448      absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
449
450      configs += [
451        "..:common_objc",
452        ":used_from_extension",
453      ]
454    }
455
456    rtc_library("ui_objc") {
457      visibility = [ "*" ]
458      allow_poison = [ "audio_codecs" ]  # TODO(bugs.webrtc.org/8396): Remove.
459      if (is_ios) {
460        sources = [
461          "objc/components/renderer/opengl/RTCDisplayLinkTimer.h",
462          "objc/components/renderer/opengl/RTCDisplayLinkTimer.m",
463          "objc/components/renderer/opengl/RTCEAGLVideoView.h",
464          "objc/components/renderer/opengl/RTCEAGLVideoView.m",
465        ]
466      }
467      if (is_mac) {
468        sources = [
469          "objc/components/renderer/opengl/RTCNSGLVideoView.h",
470          "objc/components/renderer/opengl/RTCNSGLVideoView.m",
471        ]
472      }
473      configs += [ "..:common_objc" ]
474      deps = [
475        ":base_objc",
476        ":helpers_objc",
477        ":video_objc",
478        ":videocapture_objc",
479        ":videoframebuffer_objc",
480      ]
481    }
482
483    if (rtc_use_metal_rendering) {
484      rtc_library("metal_objc") {
485        visibility = [ "*" ]
486        allow_poison = [
487          "audio_codecs",  # TODO(bugs.webrtc.org/8396): Remove.
488          "default_task_queue",
489        ]
490        sources = [
491          "objc/components/renderer/metal/RTCMTLI420Renderer.h",
492          "objc/components/renderer/metal/RTCMTLI420Renderer.mm",
493          "objc/components/renderer/metal/RTCMTLRenderer+Private.h",
494          "objc/components/renderer/metal/RTCMTLRenderer.h",
495          "objc/components/renderer/metal/RTCMTLRenderer.mm",
496        ]
497        if (is_ios) {
498          sources += [
499            "objc/components/renderer/metal/RTCMTLNV12Renderer.h",
500            "objc/components/renderer/metal/RTCMTLNV12Renderer.mm",
501            "objc/components/renderer/metal/RTCMTLRGBRenderer.h",
502            "objc/components/renderer/metal/RTCMTLRGBRenderer.mm",
503            "objc/components/renderer/metal/RTCMTLVideoView.h",
504            "objc/components/renderer/metal/RTCMTLVideoView.m",
505          ]
506        }
507        frameworks = [
508          "CoreVideo.framework",
509          "Metal.framework",
510          "MetalKit.framework",
511        ]
512        if (is_mac) {
513          sources += [
514            "objc/components/renderer/metal/RTCMTLNSVideoView.h",
515            "objc/components/renderer/metal/RTCMTLNSVideoView.m",
516          ]
517          frameworks += [ "AppKit.framework" ]
518        }
519        deps = [
520          ":base_objc",
521          ":peerconnectionfactory_base_objc",
522          ":video_objc",
523          ":videoframebuffer_objc",
524          "../api/video:video_frame",
525          "../api/video:video_rtp_headers",
526          "../rtc_base:checks",
527          "../rtc_base:rtc_base_approved",
528        ]
529        configs += [ "..:common_objc" ]
530        public_configs = [ ":common_config_objc" ]
531      }
532    }
533
534    # TODO(bugs.webrtc.org/9627): Remove this target.
535    rtc_library("videocapturebase_objc") {
536      visibility = [ "*" ]
537      sources = [ "objc/helpers/noop.mm" ]
538
539      configs += [ "..:common_objc" ]
540
541      public_configs = [ ":common_config_objc" ]
542
543      deps = [
544        ":base_objc",
545        ":videoframebuffer_objc",
546      ]
547    }
548
549    rtc_library("videocapture_objc") {
550      visibility = [ "*" ]
551      allow_poison = [ "audio_codecs" ]  # TODO(bugs.webrtc.org/8396): Remove.
552      sources = [
553        "objc/components/capturer/RTCCameraVideoCapturer.h",
554        "objc/components/capturer/RTCCameraVideoCapturer.m",
555      ]
556      if (is_ios) {
557        sources += [
558          "objc/components/capturer/RTCFileVideoCapturer.h",
559          "objc/components/capturer/RTCFileVideoCapturer.m",
560        ]
561      }
562      frameworks = [
563        "AVFoundation.framework",
564        "CoreVideo.framework",
565      ]
566
567      configs += [ "..:common_objc" ]
568
569      public_configs = [ ":common_config_objc" ]
570
571      deps = [
572        ":base_objc",
573        ":helpers_objc",
574        ":video_objc",
575        ":videoframebuffer_objc",
576        "../rtc_base/system:gcd_helpers",
577      ]
578    }
579
580    rtc_library("videocodec_objc") {
581      visibility = [ "*" ]
582      configs += [ "..:no_global_constructors" ]
583      sources = [
584        "objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h",
585        "objc/components/video_codec/RTCCodecSpecificInfoH264.h",
586        "objc/components/video_codec/RTCCodecSpecificInfoH264.mm",
587        "objc/components/video_codec/RTCH264ProfileLevelId.h",
588        "objc/components/video_codec/RTCH264ProfileLevelId.mm",
589      ]
590      if (is_ios) {
591        sources += [
592          "objc/components/video_codec/UIDevice+H264Profile.h",
593          "objc/components/video_codec/UIDevice+H264Profile.mm",
594        ]
595      }
596
597      public_configs = [ ":common_config_objc" ]
598      deps = [
599        ":base_objc",
600        ":helpers_objc",
601        "../api/video_codecs:video_codecs_api",
602        "../common_video",
603        "../media:rtc_h264_profile_id",
604        "../media:rtc_media_base",
605        "../modules:module_api",
606        "../modules/video_coding:video_codec_interface",
607        "../rtc_base:checks",
608        "../rtc_base:rtc_base_approved",
609      ]
610    }
611
612    rtc_library("default_codec_factory_objc") {
613      sources = [
614        "objc/components/video_codec/RTCDefaultVideoDecoderFactory.h",
615        "objc/components/video_codec/RTCDefaultVideoDecoderFactory.m",
616        "objc/components/video_codec/RTCDefaultVideoEncoderFactory.h",
617        "objc/components/video_codec/RTCDefaultVideoEncoderFactory.m",
618      ]
619
620      deps = [
621        ":base_objc",
622        ":native_video",
623        ":videocodec_objc",
624        ":videotoolbox_objc",
625        ":vp8",
626        ":vp9",
627        ":vpx_codec_constants",
628      ]
629    }
630
631    rtc_library("vpx_codec_constants") {
632      configs += [ "..:no_global_constructors" ]
633      sources = [
634        "objc/api/video_codec/RTCVideoCodecConstants.h",
635        "objc/api/video_codec/RTCVideoCodecConstants.mm",
636      ]
637
638      deps = [
639        ":base_objc",
640        "../media:rtc_media_base",
641      ]
642    }
643
644    rtc_library("vp8") {
645      visibility = [ "*" ]
646      allow_poison = [ "software_video_codecs" ]
647      sources = [
648        "objc/api/video_codec/RTCVideoDecoderVP8.h",
649        "objc/api/video_codec/RTCVideoDecoderVP8.mm",
650        "objc/api/video_codec/RTCVideoEncoderVP8.h",
651        "objc/api/video_codec/RTCVideoEncoderVP8.mm",
652      ]
653
654      deps = [
655        ":base_objc",
656        ":wrapped_native_codec_objc",
657        "../modules/video_coding:webrtc_vp8",
658      ]
659    }
660
661    rtc_library("vp9") {
662      visibility = [ "*" ]
663      allow_poison = [ "software_video_codecs" ]
664      sources = [
665        "objc/api/video_codec/RTCVideoDecoderVP9.h",
666        "objc/api/video_codec/RTCVideoDecoderVP9.mm",
667        "objc/api/video_codec/RTCVideoEncoderVP9.h",
668        "objc/api/video_codec/RTCVideoEncoderVP9.mm",
669      ]
670
671      deps = [
672        ":base_objc",
673        ":wrapped_native_codec_objc",
674        "../media:rtc_media_base",
675        "../modules/video_coding:webrtc_vp9",
676      ]
677    }
678
679    # Build the PeerConnectionFactory without audio/video support.
680    # This target depends on the objc_peeerconnectionfactory_base which still
681    # includes some audio/video related objects such as RTCAudioSource because
682    # these objects are just thin wrappers of native C++ interfaces required
683    # when implementing webrtc::PeerConnectionFactoryInterface and
684    # webrtc::PeerConnectionInterface.
685    # The applications which only use WebRTC DataChannel can depend on this.
686    rtc_library("peerconnectionfactory_no_media_objc") {
687      visibility = [ "*" ]
688      allow_poison = [
689        "audio_codecs",  # TODO(bugs.webrtc.org/8396): Remove.
690        "default_task_queue",
691      ]
692      defines = [ "HAVE_NO_MEDIA" ]
693
694      sources = [ "objc/helpers/noop.mm" ]
695
696      public_configs = [ ":common_config_objc" ]
697
698      deps = [
699        ":native_api",
700        ":native_video",
701        ":peerconnectionfactory_base_objc",
702        "../api:libjingle_peerconnection_api",
703        "../rtc_base",
704      ]
705    }
706
707    rtc_library("mediaconstraints_objc") {
708      configs += [ "..:no_global_constructors" ]
709      sources = [
710        "objc/api/peerconnection/RTCMediaConstraints+Private.h",
711        "objc/api/peerconnection/RTCMediaConstraints.h",
712        "objc/api/peerconnection/RTCMediaConstraints.mm",
713      ]
714
715      public_configs = [ ":common_config_objc" ]
716      deps = [
717        ":base_objc",
718        ":helpers_objc",
719        ":media_constraints",
720      ]
721    }
722
723    # TODO(bugs.webrtc.org/9627): Remove, targets should depend on base_objc.
724    rtc_library("videorenderer_objc") {
725      visibility = [ "*" ]
726      sources = [ "objc/helpers/noop.mm" ]
727
728      configs += [ "..:common_objc" ]
729      public_configs = [ ":common_config_objc" ]
730
731      deps = [ ":base_objc" ]
732    }
733
734    rtc_library("videorendereradapter_objc") {
735      visibility = [ "*" ]
736      allow_poison = [ "audio_codecs" ]  # TODO(bugs.webrtc.org/8396): Remove.
737      sources = [
738        "objc/api/RTCVideoRendererAdapter+Private.h",
739        "objc/api/RTCVideoRendererAdapter.h",
740        "objc/api/RTCVideoRendererAdapter.mm",
741      ]
742
743      configs += [ "..:common_objc" ]
744      public_configs = [ ":common_config_objc" ]
745
746      deps = [
747        ":base_objc",
748        ":native_api",
749        ":videoframebuffer_objc",
750        "../api:libjingle_peerconnection_api",
751        "../api:media_stream_interface",
752      ]
753    }
754
755    rtc_library("mediasource_objc") {
756      sources = [
757        "objc/api/peerconnection/RTCMediaSource+Private.h",
758        "objc/api/peerconnection/RTCMediaSource.h",
759        "objc/api/peerconnection/RTCMediaSource.mm",
760      ]
761
762      configs += [
763        "..:common_objc",
764        ":used_from_extension",
765      ]
766      public_configs = [ ":common_config_objc" ]
767
768      deps = [
769        ":base_objc",
770        "../api:media_stream_interface",
771        "../rtc_base:checks",
772      ]
773    }
774
775    rtc_library("base_native_additions_objc") {
776      sources = [
777        "objc/api/peerconnection/RTCEncodedImage+Private.h",
778        "objc/api/peerconnection/RTCEncodedImage+Private.mm",
779        "objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h",
780        "objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm",
781        "objc/api/peerconnection/RTCVideoCodecInfo+Private.h",
782        "objc/api/peerconnection/RTCVideoCodecInfo+Private.mm",
783        "objc/api/peerconnection/RTCVideoEncoderSettings+Private.h",
784        "objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm",
785      ]
786
787      configs += [ "..:common_objc" ]
788
789      public_configs = [ ":common_config_objc" ]
790
791      deps = [
792        ":base_objc",
793        ":helpers_objc",
794        "../api/video:encoded_image",
795        "../api/video_codecs:video_codecs_api",
796        "../modules:module_api",
797        "../modules/video_coding:video_codec_interface",
798        "../rtc_base",
799      ]
800    }
801
802    rtc_library("peerconnectionfactory_base_objc") {
803      visibility = [ "*" ]
804      allow_poison = [
805        "audio_codecs",  # TODO(bugs.webrtc.org/8396): Remove.
806        "default_task_queue",
807      ]
808      configs += [
809        "..:no_exit_time_destructors",
810        "..:no_global_constructors",
811      ]
812      sources = [
813        "objc/api/peerconnection/RTCAudioSource+Private.h",
814        "objc/api/peerconnection/RTCAudioSource.h",
815        "objc/api/peerconnection/RTCAudioSource.mm",
816        "objc/api/peerconnection/RTCAudioTrack+Private.h",
817        "objc/api/peerconnection/RTCAudioTrack.h",
818        "objc/api/peerconnection/RTCAudioTrack.mm",
819        "objc/api/peerconnection/RTCCertificate.h",
820        "objc/api/peerconnection/RTCCertificate.mm",
821        "objc/api/peerconnection/RTCConfiguration+Native.h",
822        "objc/api/peerconnection/RTCConfiguration+Private.h",
823        "objc/api/peerconnection/RTCConfiguration.h",
824        "objc/api/peerconnection/RTCConfiguration.mm",
825        "objc/api/peerconnection/RTCCryptoOptions.h",
826        "objc/api/peerconnection/RTCCryptoOptions.mm",
827        "objc/api/peerconnection/RTCDataChannel+Private.h",
828        "objc/api/peerconnection/RTCDataChannel.h",
829        "objc/api/peerconnection/RTCDataChannel.mm",
830        "objc/api/peerconnection/RTCDataChannelConfiguration+Private.h",
831        "objc/api/peerconnection/RTCDataChannelConfiguration.h",
832        "objc/api/peerconnection/RTCDataChannelConfiguration.mm",
833        "objc/api/peerconnection/RTCDtmfSender+Private.h",
834        "objc/api/peerconnection/RTCDtmfSender.h",
835        "objc/api/peerconnection/RTCDtmfSender.mm",
836        "objc/api/peerconnection/RTCFieldTrials.h",
837        "objc/api/peerconnection/RTCFieldTrials.mm",
838        "objc/api/peerconnection/RTCIceCandidate+Private.h",
839        "objc/api/peerconnection/RTCIceCandidate.h",
840        "objc/api/peerconnection/RTCIceCandidate.mm",
841        "objc/api/peerconnection/RTCIceServer+Private.h",
842        "objc/api/peerconnection/RTCIceServer.h",
843        "objc/api/peerconnection/RTCIceServer.mm",
844        "objc/api/peerconnection/RTCLegacyStatsReport+Private.h",
845        "objc/api/peerconnection/RTCLegacyStatsReport.h",
846        "objc/api/peerconnection/RTCLegacyStatsReport.mm",
847        "objc/api/peerconnection/RTCMediaStream+Private.h",
848        "objc/api/peerconnection/RTCMediaStream.h",
849        "objc/api/peerconnection/RTCMediaStream.mm",
850        "objc/api/peerconnection/RTCMediaStreamTrack+Private.h",
851        "objc/api/peerconnection/RTCMediaStreamTrack.h",
852        "objc/api/peerconnection/RTCMediaStreamTrack.mm",
853        "objc/api/peerconnection/RTCMetrics.h",
854        "objc/api/peerconnection/RTCMetrics.mm",
855        "objc/api/peerconnection/RTCMetricsSampleInfo+Private.h",
856        "objc/api/peerconnection/RTCMetricsSampleInfo.h",
857        "objc/api/peerconnection/RTCMetricsSampleInfo.mm",
858        "objc/api/peerconnection/RTCPeerConnection+DataChannel.mm",
859        "objc/api/peerconnection/RTCPeerConnection+Private.h",
860        "objc/api/peerconnection/RTCPeerConnection+Stats.mm",
861        "objc/api/peerconnection/RTCPeerConnection.h",
862        "objc/api/peerconnection/RTCPeerConnection.mm",
863        "objc/api/peerconnection/RTCPeerConnectionFactory+Native.h",
864        "objc/api/peerconnection/RTCPeerConnectionFactory+Private.h",
865        "objc/api/peerconnection/RTCPeerConnectionFactory.h",
866        "objc/api/peerconnection/RTCPeerConnectionFactory.mm",
867        "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h",
868        "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm",
869        "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h",
870        "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.mm",
871        "objc/api/peerconnection/RTCPeerConnectionFactoryOptions+Private.h",
872        "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h",
873        "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.mm",
874        "objc/api/peerconnection/RTCRtcpParameters+Private.h",
875        "objc/api/peerconnection/RTCRtcpParameters.h",
876        "objc/api/peerconnection/RTCRtcpParameters.mm",
877        "objc/api/peerconnection/RTCRtpCodecParameters+Private.h",
878        "objc/api/peerconnection/RTCRtpCodecParameters.h",
879        "objc/api/peerconnection/RTCRtpCodecParameters.mm",
880        "objc/api/peerconnection/RTCRtpEncodingParameters+Private.h",
881        "objc/api/peerconnection/RTCRtpEncodingParameters.h",
882        "objc/api/peerconnection/RTCRtpEncodingParameters.mm",
883        "objc/api/peerconnection/RTCRtpHeaderExtension+Private.h",
884        "objc/api/peerconnection/RTCRtpHeaderExtension.h",
885        "objc/api/peerconnection/RTCRtpHeaderExtension.mm",
886        "objc/api/peerconnection/RTCRtpParameters+Private.h",
887        "objc/api/peerconnection/RTCRtpParameters.h",
888        "objc/api/peerconnection/RTCRtpParameters.mm",
889        "objc/api/peerconnection/RTCRtpReceiver+Native.h",
890        "objc/api/peerconnection/RTCRtpReceiver+Private.h",
891        "objc/api/peerconnection/RTCRtpReceiver.h",
892        "objc/api/peerconnection/RTCRtpReceiver.mm",
893        "objc/api/peerconnection/RTCRtpSender+Native.h",
894        "objc/api/peerconnection/RTCRtpSender+Private.h",
895        "objc/api/peerconnection/RTCRtpSender.h",
896        "objc/api/peerconnection/RTCRtpSender.mm",
897        "objc/api/peerconnection/RTCRtpTransceiver+Private.h",
898        "objc/api/peerconnection/RTCRtpTransceiver.h",
899        "objc/api/peerconnection/RTCRtpTransceiver.mm",
900        "objc/api/peerconnection/RTCSSLAdapter.h",
901        "objc/api/peerconnection/RTCSSLAdapter.mm",
902        "objc/api/peerconnection/RTCSessionDescription+Private.h",
903        "objc/api/peerconnection/RTCSessionDescription.h",
904        "objc/api/peerconnection/RTCSessionDescription.mm",
905        "objc/api/peerconnection/RTCStatisticsReport+Private.h",
906        "objc/api/peerconnection/RTCStatisticsReport.h",
907        "objc/api/peerconnection/RTCStatisticsReport.mm",
908        "objc/api/peerconnection/RTCTracing.h",
909        "objc/api/peerconnection/RTCTracing.mm",
910        "objc/api/peerconnection/RTCVideoTrack+Private.h",
911        "objc/api/peerconnection/RTCVideoTrack.h",
912        "objc/api/peerconnection/RTCVideoTrack.mm",
913      ]
914
915      configs += [
916        "..:common_objc",
917        ":used_from_extension",
918      ]
919      public_configs = [ ":common_config_objc" ]
920
921      deps = [
922        ":base_native_additions_objc",
923        ":base_objc",
924        ":file_logger_objc",
925        ":helpers_objc",
926        ":legacy_header_paths",
927        ":mediaconstraints_objc",
928        ":mediasource_objc",
929        ":native_api",
930        ":native_video",
931        ":video_objc",
932        ":videoframebuffer_objc",
933        ":videorendereradapter_objc",
934        ":videosource_objc",
935        ":videotoolbox_objc",
936        "../api:libjingle_peerconnection_api",
937        "../api:media_stream_interface",
938        "../api:rtc_event_log_output_file",
939        "../api:rtc_stats_api",
940        "../api:rtp_parameters",
941        "../api:scoped_refptr",
942        "../api/audio_codecs:audio_codecs_api",
943        "../api/audio_codecs:builtin_audio_decoder_factory",
944        "../api/audio_codecs:builtin_audio_encoder_factory",
945        "../api/crypto:frame_decryptor_interface",
946        "../api/crypto:frame_encryptor_interface",
947        "../api/rtc_event_log:rtc_event_log_factory",
948        "../api/task_queue:default_task_queue_factory",
949        "../api/video:video_frame",
950        "../api/video:video_rtp_headers",
951        "../api/video_codecs:video_codecs_api",
952        "../common_video",
953        "../media:rtc_media_base",
954        "../modules:module_api",
955        "../modules/audio_device:audio_device_api",
956        "../modules/audio_processing",
957        "../modules/audio_processing:api",
958        "../modules/video_coding:video_codec_interface",
959        "../pc:peerconnection",
960        "../rtc_base",
961        "../rtc_base:checks",
962        "../system_wrappers:field_trial",
963        "../system_wrappers:metrics",
964      ]
965
966      if (is_ios) {
967        deps += [ ":native_api_audio_device_module" ]
968      }
969    }
970
971    # TODO(bugs.webrtc.org/9627): Remove this target.
972    rtc_source_set("legacy_header_paths") {
973      sources = [
974        "objc/Framework/Classes/Common/NSString+StdString.h",
975        "objc/Framework/Classes/Common/scoped_cftyperef.h",
976        "objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h",
977        "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h",
978        "objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h",
979        "objc/Framework/Classes/Video/RTCDefaultShader.h",
980        "objc/Framework/Classes/Video/RTCNV12TextureCache.h",
981        "objc/Framework/Classes/VideoToolbox/nalu_rewriter.h",
982        "objc/Framework/Headers/WebRTC/RTCAudioSession.h",
983        "objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h",
984        "objc/Framework/Headers/WebRTC/RTCAudioSource.h",
985        "objc/Framework/Headers/WebRTC/RTCAudioTrack.h",
986        "objc/Framework/Headers/WebRTC/RTCCVPixelBuffer.h",
987        "objc/Framework/Headers/WebRTC/RTCCallbackLogger.h",
988        "objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h",
989        "objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h",
990        "objc/Framework/Headers/WebRTC/RTCCertificate.h",
991        "objc/Framework/Headers/WebRTC/RTCConfiguration.h",
992        "objc/Framework/Headers/WebRTC/RTCDataChannel.h",
993        "objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h",
994        "objc/Framework/Headers/WebRTC/RTCDefaultVideoDecoderFactory.h",
995        "objc/Framework/Headers/WebRTC/RTCDefaultVideoEncoderFactory.h",
996        "objc/Framework/Headers/WebRTC/RTCDispatcher.h",
997        "objc/Framework/Headers/WebRTC/RTCDtmfSender.h",
998        "objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h",
999        "objc/Framework/Headers/WebRTC/RTCFieldTrials.h",
1000        "objc/Framework/Headers/WebRTC/RTCFileLogger.h",
1001        "objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h",
1002        "objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h",
1003        "objc/Framework/Headers/WebRTC/RTCIceCandidate.h",
1004        "objc/Framework/Headers/WebRTC/RTCIceServer.h",
1005        "objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h",
1006        "objc/Framework/Headers/WebRTC/RTCLogging.h",
1007        "objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h",
1008        "objc/Framework/Headers/WebRTC/RTCMTLVideoView.h",
1009        "objc/Framework/Headers/WebRTC/RTCMacros.h",
1010        "objc/Framework/Headers/WebRTC/RTCMediaConstraints.h",
1011        "objc/Framework/Headers/WebRTC/RTCMediaSource.h",
1012        "objc/Framework/Headers/WebRTC/RTCMediaStream.h",
1013        "objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h",
1014        "objc/Framework/Headers/WebRTC/RTCMetrics.h",
1015        "objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h",
1016        "objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h",
1017        "objc/Framework/Headers/WebRTC/RTCPeerConnection.h",
1018        "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h",
1019        "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h",
1020        "objc/Framework/Headers/WebRTC/RTCRtcpParameters.h",
1021        "objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h",
1022        "objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h",
1023        "objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h",
1024        "objc/Framework/Headers/WebRTC/RTCRtpParameters.h",
1025        "objc/Framework/Headers/WebRTC/RTCRtpReceiver.h",
1026        "objc/Framework/Headers/WebRTC/RTCRtpSender.h",
1027        "objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h",
1028        "objc/Framework/Headers/WebRTC/RTCSSLAdapter.h",
1029        "objc/Framework/Headers/WebRTC/RTCSessionDescription.h",
1030        "objc/Framework/Headers/WebRTC/RTCTracing.h",
1031        "objc/Framework/Headers/WebRTC/RTCVideoCapturer.h",
1032        "objc/Framework/Headers/WebRTC/RTCVideoCodec.h",
1033        "objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h",
1034        "objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h",
1035        "objc/Framework/Headers/WebRTC/RTCVideoCodecInfo.h",
1036        "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h",
1037        "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h",
1038        "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h",
1039        "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h",
1040        "objc/Framework/Headers/WebRTC/RTCVideoFrame.h",
1041        "objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h",
1042        "objc/Framework/Headers/WebRTC/RTCVideoRenderer.h",
1043        "objc/Framework/Headers/WebRTC/RTCVideoSource.h",
1044        "objc/Framework/Headers/WebRTC/RTCVideoTrack.h",
1045        "objc/Framework/Headers/WebRTC/RTCVideoViewShading.h",
1046        "objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h",
1047        "objc/Framework/Native/api/audio_device_module.h",
1048        "objc/Framework/Native/api/video_decoder_factory.h",
1049        "objc/Framework/Native/api/video_encoder_factory.h",
1050        "objc/Framework/Native/api/video_frame_buffer.h",
1051        "objc/Framework/Native/src/objc_video_decoder_factory.h",
1052        "objc/Framework/Native/src/objc_video_encoder_factory.h",
1053      ]
1054    }
1055
1056    if (rtc_include_tests) {
1057      if (is_ios) {
1058        rtc_library("sdk_unittests_sources") {
1059          testonly = true
1060          include_dirs = [ "objc/" ]
1061
1062          sources = [
1063            "objc/unittests/ObjCVideoTrackSource_xctest.mm",
1064            "objc/unittests/RTCCVPixelBuffer_xctest.mm",
1065            "objc/unittests/RTCCallbackLogger_xctest.m",
1066            "objc/unittests/RTCEncodedImage_xctest.mm",
1067            "objc/unittests/RTCFileVideoCapturer_xctest.mm",
1068            "objc/unittests/RTCH264ProfileLevelId_xctest.m",
1069            "objc/unittests/RTCNV12TextureCache_xctest.m",
1070            "objc/unittests/RTCPeerConnectionFactory_xctest.m",
1071            "objc/unittests/frame_buffer_helpers.h",
1072            "objc/unittests/frame_buffer_helpers.mm",
1073            "objc/unittests/nalu_rewriter_xctest.mm",
1074          ]
1075
1076          # TODO(peterhanspers): Reenable these tests on simulator.
1077          # See bugs.webrtc.org/7812
1078          if (!use_ios_simulator) {
1079            sources += [
1080              "objc/unittests/RTCAudioDeviceModule_xctest.mm",
1081              "objc/unittests/RTCAudioDevice_xctest.mm",
1082            ]
1083          }
1084
1085          deps = [
1086            ":audio_device",
1087            ":audio_session_objc",
1088            ":base_native_additions_objc",
1089            ":base_objc",
1090            ":callback_logger_objc",
1091            ":framework_objc",
1092            ":mediaconstraints_objc",
1093            ":native_api",
1094            ":native_api_audio_device_module",
1095            ":native_video",
1096            ":peerconnectionfactory_base_objc",
1097            ":video_objc",
1098            ":video_toolbox_cc",
1099            ":videocapture_objc",
1100            ":videocodec_objc",
1101            ":videoframebuffer_objc",
1102            ":videosource_objc",
1103            ":videotoolbox_objc",
1104            "../api:scoped_refptr",
1105            "../api/task_queue:default_task_queue_factory",
1106            "../api/video:video_frame_i420",
1107            "../common_video",
1108            "../media:rtc_media_base",
1109            "../media:rtc_media_tests_utils",
1110            "../modules:module_api",
1111            "../rtc_base",
1112            "../rtc_base:gunit_helpers",
1113            "../system_wrappers",
1114            "//third_party/libyuv",
1115          ]
1116
1117          if (rtc_use_metal_rendering) {
1118            sources += [ "objc/unittests/RTCMTLVideoView_xctest.m" ]
1119            deps += [ ":metal_objc" ]
1120          }
1121
1122          public_deps = [
1123            "//build/config/ios:xctest",
1124            "//third_party/ocmock",
1125          ]
1126        }
1127
1128        bundle_data("sdk_unittests_bundle_data") {
1129          sources = [
1130            "objc/unittests/audio_short16.pcm",
1131            "objc/unittests/audio_short44.pcm",
1132            "objc/unittests/audio_short48.pcm",
1133
1134            # Sample video taken from https://media.xiph.org/video/derf/
1135            "objc/unittests/foreman.mp4",
1136          ]
1137          outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
1138        }
1139
1140        # These tests use static linking.
1141        rtc_ios_xctest_test("sdk_unittests") {
1142          info_plist = "//test/ios/Info.plist"
1143          sources = [ "objc/unittests/main.mm" ]
1144
1145          extra_substitutions = [ "GTEST_BUNDLE_ID_SUFFIX=generic-unit-test" ]
1146          deps = [
1147            ":peerconnectionfactory_base_objc",
1148            ":sdk_unittests_bundle_data",
1149            ":sdk_unittests_sources",
1150            "../rtc_base",
1151            "//test:test_support",
1152          ]
1153          ldflags = [ "-all_load" ]
1154        }
1155
1156        # These tests link to the framework.
1157        rtc_ios_xctest_test("sdk_framework_unittests") {
1158          info_plist = "//test/ios/Info.plist"
1159          sources = [
1160            "objc/unittests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m",
1161            "objc/unittests/main.mm",
1162          ]
1163
1164          extra_substitutions = [ "GTEST_BUNDLE_ID_SUFFIX=generic-unit-test" ]
1165          deps = [
1166            ":framework_objc+link",
1167            ":ios_framework_bundle",
1168            "../rtc_base",
1169            "//test:test_support",
1170          ]
1171        }
1172      }
1173
1174      # TODO(denicija): once all tests are migrated to xctest remove this source set.
1175      rtc_library("rtc_unittests_objc") {
1176        testonly = true
1177
1178        sources = [
1179          "objc/unittests/RTCCertificateTest.mm",
1180          "objc/unittests/RTCConfigurationTest.mm",
1181          "objc/unittests/RTCDataChannelConfigurationTest.mm",
1182          "objc/unittests/RTCIceCandidateTest.mm",
1183          "objc/unittests/RTCIceServerTest.mm",
1184          "objc/unittests/RTCMediaConstraintsTest.mm",
1185          "objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm",
1186          "objc/unittests/RTCPeerConnectionTest.mm",
1187          "objc/unittests/RTCSessionDescriptionTest.mm",
1188          "objc/unittests/RTCTracingTest.mm",
1189          "objc/unittests/objc_video_decoder_factory_tests.mm",
1190          "objc/unittests/objc_video_encoder_factory_tests.mm",
1191          "objc/unittests/scoped_cftyperef_tests.mm",
1192        ]
1193        if (is_ios) {
1194          sources += [ "objc/unittests/RTCCameraVideoCapturerTests.mm" ]
1195        }
1196
1197        # |-ObjC| flag needed to make sure category method implementations
1198        # are included:
1199        # https://developer.apple.com/library/mac/qa/qa1490/_index.html
1200        ldflags = [ "-ObjC" ]
1201
1202        deps = [
1203          ":base_objc",
1204          ":helpers_objc",
1205          ":mediaconstraints_objc",
1206          ":native_api",
1207          ":native_video",
1208          ":peerconnectionfactory_base_objc",
1209          ":video_objc",
1210          ":videocapture_objc",
1211          ":videocodec_objc",
1212          ":videoframebuffer_objc",
1213          ":videosource_objc",
1214          ":videotoolbox_objc",
1215          "../api:libjingle_peerconnection_api",
1216          "../api/audio_codecs:audio_codecs_api",
1217          "../api/audio_codecs:builtin_audio_decoder_factory",
1218          "../api/audio_codecs:builtin_audio_encoder_factory",
1219          "../api/video_codecs:video_codecs_api",
1220          "../media:rtc_media_base",
1221          "../modules:module_api",
1222          "../modules/audio_device:audio_device_api",
1223          "../modules/audio_processing",
1224          "../modules/audio_processing:api",
1225          "../modules/video_coding:video_codec_interface",
1226          "../rtc_base:gunit_helpers",
1227          "../rtc_base/system:unused",
1228          "../test:test_support",
1229          "//third_party/ocmock",
1230        ]
1231
1232        if (is_ios) {
1233          sources += [ "objc/unittests/RTCAudioSessionTest.mm" ]
1234          deps += [ ":audio_session_objc" ]
1235        }
1236      }
1237    }
1238
1239    if (is_ios) {
1240      ios_framework_bundle_with_umbrella_header("framework_objc") {
1241        info_plist = "objc/Info.plist"
1242        output_name = "WebRTC"
1243
1244        common_objc_headers = [
1245          "objc/base/RTCCodecSpecificInfo.h",
1246          "objc/base/RTCEncodedImage.h",
1247          "objc/base/RTCI420Buffer.h",
1248          "objc/base/RTCLogging.h",
1249          "objc/base/RTCMacros.h",
1250          "objc/base/RTCMutableI420Buffer.h",
1251          "objc/base/RTCMutableYUVPlanarBuffer.h",
1252          "objc/base/RTCRtpFragmentationHeader.h",
1253          "objc/base/RTCVideoCapturer.h",
1254          "objc/base/RTCVideoCodecInfo.h",
1255          "objc/base/RTCVideoDecoder.h",
1256          "objc/base/RTCVideoDecoderFactory.h",
1257          "objc/base/RTCVideoEncoder.h",
1258          "objc/base/RTCVideoEncoderFactory.h",
1259          "objc/base/RTCVideoEncoderQpThresholds.h",
1260          "objc/base/RTCVideoEncoderSettings.h",
1261          "objc/base/RTCVideoFrame.h",
1262          "objc/base/RTCVideoFrameBuffer.h",
1263          "objc/base/RTCVideoRenderer.h",
1264          "objc/base/RTCYUVPlanarBuffer.h",
1265          "objc/components/audio/RTCAudioSession.h",
1266          "objc/components/audio/RTCAudioSessionConfiguration.h",
1267          "objc/components/capturer/RTCCameraVideoCapturer.h",
1268          "objc/components/capturer/RTCFileVideoCapturer.h",
1269          "objc/components/renderer/metal/RTCMTLVideoView.h",
1270          "objc/components/renderer/opengl/RTCEAGLVideoView.h",
1271          "objc/components/renderer/opengl/RTCVideoViewShading.h",
1272          "objc/components/video_codec/RTCCodecSpecificInfoH264.h",
1273          "objc/components/video_codec/RTCDefaultVideoDecoderFactory.h",
1274          "objc/components/video_codec/RTCDefaultVideoEncoderFactory.h",
1275          "objc/components/video_codec/RTCH264ProfileLevelId.h",
1276          "objc/components/video_codec/RTCVideoDecoderFactoryH264.h",
1277          "objc/components/video_codec/RTCVideoDecoderH264.h",
1278          "objc/components/video_codec/RTCVideoEncoderFactoryH264.h",
1279          "objc/components/video_codec/RTCVideoEncoderH264.h",
1280          "objc/components/video_frame_buffer/RTCCVPixelBuffer.h",
1281          "objc/helpers/RTCCameraPreviewView.h",
1282          "objc/helpers/RTCDispatcher.h",
1283          "objc/helpers/UIDevice+RTCDevice.h",
1284          "objc/api/peerconnection/RTCAudioSource.h",
1285          "objc/api/peerconnection/RTCAudioTrack.h",
1286          "objc/api/peerconnection/RTCConfiguration.h",
1287          "objc/api/peerconnection/RTCDataChannel.h",
1288          "objc/api/peerconnection/RTCDataChannelConfiguration.h",
1289          "objc/api/peerconnection/RTCFieldTrials.h",
1290          "objc/api/peerconnection/RTCIceCandidate.h",
1291          "objc/api/peerconnection/RTCIceServer.h",
1292          "objc/api/peerconnection/RTCLegacyStatsReport.h",
1293          "objc/api/peerconnection/RTCMediaConstraints.h",
1294          "objc/api/peerconnection/RTCMediaSource.h",
1295          "objc/api/peerconnection/RTCMediaStream.h",
1296          "objc/api/peerconnection/RTCMediaStreamTrack.h",
1297          "objc/api/peerconnection/RTCMetrics.h",
1298          "objc/api/peerconnection/RTCMetricsSampleInfo.h",
1299          "objc/api/peerconnection/RTCPeerConnection.h",
1300          "objc/api/peerconnection/RTCPeerConnectionFactory.h",
1301          "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h",
1302          "objc/api/peerconnection/RTCRtcpParameters.h",
1303          "objc/api/peerconnection/RTCRtpCodecParameters.h",
1304          "objc/api/peerconnection/RTCRtpEncodingParameters.h",
1305          "objc/api/peerconnection/RTCRtpHeaderExtension.h",
1306          "objc/api/peerconnection/RTCRtpParameters.h",
1307          "objc/api/peerconnection/RTCRtpReceiver.h",
1308          "objc/api/peerconnection/RTCRtpSender.h",
1309          "objc/api/peerconnection/RTCRtpTransceiver.h",
1310          "objc/api/peerconnection/RTCDtmfSender.h",
1311          "objc/api/peerconnection/RTCSSLAdapter.h",
1312          "objc/api/peerconnection/RTCSessionDescription.h",
1313          "objc/api/peerconnection/RTCStatisticsReport.h",
1314          "objc/api/peerconnection/RTCTracing.h",
1315          "objc/api/peerconnection/RTCCertificate.h",
1316          "objc/api/peerconnection/RTCCryptoOptions.h",
1317          "objc/api/peerconnection/RTCVideoSource.h",
1318          "objc/api/peerconnection/RTCVideoTrack.h",
1319          "objc/api/video_codec/RTCVideoCodecConstants.h",
1320          "objc/api/video_codec/RTCVideoDecoderVP8.h",
1321          "objc/api/video_codec/RTCVideoDecoderVP9.h",
1322          "objc/api/video_codec/RTCVideoEncoderVP8.h",
1323          "objc/api/video_codec/RTCVideoEncoderVP9.h",
1324          "objc/api/video_frame_buffer/RTCNativeI420Buffer.h",
1325          "objc/api/video_frame_buffer/RTCNativeMutableI420Buffer.h",
1326        ]
1327
1328        if (!build_with_chromium) {
1329          common_objc_headers += [
1330            "objc/api/logging/RTCCallbackLogger.h",
1331            "objc/api/peerconnection/RTCFileLogger.h",
1332          ]
1333        }
1334
1335        sources = common_objc_headers
1336        public_headers = common_objc_headers
1337
1338        ldflags = [
1339          "-all_load",
1340          "-install_name",
1341          "@rpath/$output_name.framework/$output_name",
1342        ]
1343
1344        deps = [
1345          ":audio_objc",
1346          ":base_objc",
1347          ":default_codec_factory_objc",
1348          ":native_api",
1349          ":native_video",
1350          ":peerconnectionfactory_base_objc",
1351          ":ui_objc",
1352          ":videocapture_objc",
1353          ":videocodec_objc",
1354          ":videotoolbox_objc",
1355          "../rtc_base:rtc_base_approved",
1356        ]
1357        if (rtc_use_metal_rendering) {
1358          deps += [ ":metal_objc" ]
1359        }
1360        if (!build_with_chromium) {
1361          deps += [
1362            ":callback_logger_objc",
1363            ":file_logger_objc",
1364          ]
1365        }
1366
1367        frameworks = [
1368          "AVFoundation.framework",
1369          "CoreGraphics.framework",
1370          "CoreMedia.framework",
1371          "GLKit.framework",
1372        ]
1373
1374        configs += [
1375          "..:common_objc",
1376          ":used_from_extension",
1377        ]
1378
1379        public_configs = [ ":common_config_objc" ]
1380      }
1381
1382      bundle_data("ios_framework_bundle") {
1383        deps = [ "../sdk:framework_objc" ]
1384        sources = [ "$root_build_dir/WebRTC.framework" ]
1385        outputs = [ "{{bundle_resources_dir}}/Frameworks/{{source_file_part}}" ]
1386      }
1387    }
1388
1389    if (is_mac) {
1390      mac_framework_bundle_with_umbrella_header("mac_framework_objc") {
1391        info_plist = "objc/Info.plist"
1392        output_name = "WebRTC"
1393
1394        sources = [
1395          "objc/api/peerconnection/RTCAudioSource.h",
1396          "objc/api/peerconnection/RTCAudioTrack.h",
1397          "objc/api/peerconnection/RTCCertificate.h",
1398          "objc/api/peerconnection/RTCConfiguration.h",
1399          "objc/api/peerconnection/RTCCryptoOptions.h",
1400          "objc/api/peerconnection/RTCDataChannel.h",
1401          "objc/api/peerconnection/RTCDataChannelConfiguration.h",
1402          "objc/api/peerconnection/RTCDtmfSender.h",
1403          "objc/api/peerconnection/RTCFieldTrials.h",
1404          "objc/api/peerconnection/RTCIceCandidate.h",
1405          "objc/api/peerconnection/RTCIceServer.h",
1406          "objc/api/peerconnection/RTCLegacyStatsReport.h",
1407          "objc/api/peerconnection/RTCMediaConstraints.h",
1408          "objc/api/peerconnection/RTCMediaSource.h",
1409          "objc/api/peerconnection/RTCMediaStream.h",
1410          "objc/api/peerconnection/RTCMediaStreamTrack.h",
1411          "objc/api/peerconnection/RTCMetrics.h",
1412          "objc/api/peerconnection/RTCMetricsSampleInfo.h",
1413          "objc/api/peerconnection/RTCPeerConnection.h",
1414          "objc/api/peerconnection/RTCPeerConnectionFactory.h",
1415          "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h",
1416          "objc/api/peerconnection/RTCRtcpParameters.h",
1417          "objc/api/peerconnection/RTCRtpCodecParameters.h",
1418          "objc/api/peerconnection/RTCRtpEncodingParameters.h",
1419          "objc/api/peerconnection/RTCRtpHeaderExtension.h",
1420          "objc/api/peerconnection/RTCRtpParameters.h",
1421          "objc/api/peerconnection/RTCRtpReceiver.h",
1422          "objc/api/peerconnection/RTCRtpSender.h",
1423          "objc/api/peerconnection/RTCRtpTransceiver.h",
1424          "objc/api/peerconnection/RTCSSLAdapter.h",
1425          "objc/api/peerconnection/RTCSessionDescription.h",
1426          "objc/api/peerconnection/RTCTracing.h",
1427          "objc/api/peerconnection/RTCVideoSource.h",
1428          "objc/api/peerconnection/RTCVideoTrack.h",
1429          "objc/api/video_codec/RTCVideoDecoderVP8.h",
1430          "objc/api/video_codec/RTCVideoDecoderVP9.h",
1431          "objc/api/video_codec/RTCVideoEncoderVP8.h",
1432          "objc/api/video_codec/RTCVideoEncoderVP9.h",
1433          "objc/api/video_frame_buffer/RTCNativeI420Buffer.h",
1434          "objc/api/video_frame_buffer/RTCNativeMutableI420Buffer.h",
1435          "objc/base/RTCCodecSpecificInfo.h",
1436          "objc/base/RTCEncodedImage.h",
1437          "objc/base/RTCI420Buffer.h",
1438          "objc/base/RTCLogging.h",
1439          "objc/base/RTCMacros.h",
1440          "objc/base/RTCMutableI420Buffer.h",
1441          "objc/base/RTCMutableYUVPlanarBuffer.h",
1442          "objc/base/RTCRtpFragmentationHeader.h",
1443          "objc/base/RTCVideoCapturer.h",
1444          "objc/base/RTCVideoCodecInfo.h",
1445          "objc/base/RTCVideoDecoder.h",
1446          "objc/base/RTCVideoDecoderFactory.h",
1447          "objc/base/RTCVideoEncoder.h",
1448          "objc/base/RTCVideoEncoderFactory.h",
1449          "objc/base/RTCVideoEncoderQpThresholds.h",
1450          "objc/base/RTCVideoEncoderSettings.h",
1451          "objc/base/RTCVideoFrame.h",
1452          "objc/base/RTCVideoFrameBuffer.h",
1453          "objc/base/RTCVideoRenderer.h",
1454          "objc/base/RTCYUVPlanarBuffer.h",
1455          "objc/components/capturer/RTCCameraVideoCapturer.h",
1456          "objc/components/capturer/RTCFileVideoCapturer.h",
1457          "objc/components/renderer/metal/RTCMTLNSVideoView.h",
1458          "objc/components/renderer/opengl/RTCNSGLVideoView.h",
1459          "objc/components/renderer/opengl/RTCVideoViewShading.h",
1460          "objc/components/video_codec/RTCCodecSpecificInfoH264.h",
1461          "objc/components/video_codec/RTCDefaultVideoDecoderFactory.h",
1462          "objc/components/video_codec/RTCDefaultVideoEncoderFactory.h",
1463          "objc/components/video_codec/RTCH264ProfileLevelId.h",
1464          "objc/components/video_codec/RTCVideoDecoderFactoryH264.h",
1465          "objc/components/video_codec/RTCVideoDecoderH264.h",
1466          "objc/components/video_codec/RTCVideoEncoderFactoryH264.h",
1467          "objc/components/video_codec/RTCVideoEncoderH264.h",
1468          "objc/components/video_frame_buffer/RTCCVPixelBuffer.h",
1469          "objc/helpers/RTCDispatcher.h",
1470        ]
1471        if (!build_with_chromium) {
1472          sources += [
1473            "objc/api/logging/RTCCallbackLogger.h",
1474            "objc/api/peerconnection/RTCFileLogger.h",
1475          ]
1476        }
1477
1478        deps = [
1479          ":base_objc",
1480          ":default_codec_factory_objc",
1481          ":native_api",
1482          ":native_video",
1483          ":peerconnectionfactory_base_objc",
1484          ":ui_objc",
1485          ":videocapture_objc",
1486          ":videocodec_objc",
1487          ":videotoolbox_objc",
1488          "../rtc_base:rtc_base_approved",
1489        ]
1490        if (rtc_use_metal_rendering) {
1491          deps += [ ":metal_objc" ]
1492        }
1493        if (!build_with_chromium) {
1494          deps += [
1495            ":callback_logger_objc",
1496            ":file_logger_objc",
1497          ]
1498        }
1499
1500        frameworks = [
1501          "AVFoundation.framework",
1502          "CoreGraphics.framework",
1503          "CoreMedia.framework",
1504          "OpenGL.framework",
1505        ]
1506
1507        configs = [ "..:common_objc" ]
1508
1509        public_configs = [ ":common_config_objc" ]
1510      }
1511
1512      bundle_data("mac_framework_bundle") {
1513        deps = [ "../sdk:mac_framework_objc" ]
1514        sources = [ "$root_build_dir/WebRTC.framework" ]
1515        outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
1516      }
1517    }
1518
1519    rtc_library("wrapped_native_codec_objc") {
1520      sources = [
1521        "objc/api/video_codec/RTCWrappedNativeVideoDecoder.h",
1522        "objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm",
1523        "objc/api/video_codec/RTCWrappedNativeVideoEncoder.h",
1524        "objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm",
1525      ]
1526
1527      configs += [ "..:common_objc" ]
1528      public_configs = [ ":common_config_objc" ]
1529
1530      deps = [
1531        ":base_objc",
1532        ":helpers_objc",
1533        "../api/video_codecs:video_codecs_api",
1534        "../media:rtc_media_base",
1535      ]
1536    }
1537
1538    # The native API is currently experimental and may change without notice.
1539    rtc_library("native_api") {
1540      visibility = [ "*" ]
1541      allow_poison = [ "audio_codecs" ]  # TODO(bugs.webrtc.org/8396): Remove.
1542      sources = [
1543        "objc/native/api/video_capturer.h",
1544        "objc/native/api/video_capturer.mm",
1545        "objc/native/api/video_decoder_factory.h",
1546        "objc/native/api/video_decoder_factory.mm",
1547        "objc/native/api/video_encoder_factory.h",
1548        "objc/native/api/video_encoder_factory.mm",
1549        "objc/native/api/video_frame.h",
1550        "objc/native/api/video_frame.mm",
1551        "objc/native/api/video_frame_buffer.h",
1552        "objc/native/api/video_frame_buffer.mm",
1553        "objc/native/api/video_renderer.h",
1554        "objc/native/api/video_renderer.mm",
1555      ]
1556
1557      configs += [ "..:common_objc" ]
1558
1559      public_configs = [ ":common_config_objc" ]
1560
1561      deps = [
1562        ":base_objc",
1563        ":native_video",
1564        ":videoframebuffer_objc",
1565        "../api:libjingle_peerconnection_api",
1566        "../api:media_stream_interface",
1567        "../api:scoped_refptr",
1568        "../api/video:video_frame",
1569        "../api/video:video_rtp_headers",
1570        "../api/video_codecs:video_codecs_api",
1571        "../common_video",
1572        "../rtc_base",
1573      ]
1574      absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
1575    }
1576
1577    rtc_library("native_video") {
1578      sources = [
1579        "objc/native/src/objc_frame_buffer.h",
1580        "objc/native/src/objc_frame_buffer.mm",
1581        "objc/native/src/objc_video_decoder_factory.h",
1582        "objc/native/src/objc_video_decoder_factory.mm",
1583        "objc/native/src/objc_video_encoder_factory.h",
1584        "objc/native/src/objc_video_encoder_factory.mm",
1585        "objc/native/src/objc_video_frame.h",
1586        "objc/native/src/objc_video_frame.mm",
1587        "objc/native/src/objc_video_renderer.h",
1588        "objc/native/src/objc_video_renderer.mm",
1589        "objc/native/src/objc_video_track_source.h",
1590        "objc/native/src/objc_video_track_source.mm",
1591      ]
1592
1593      configs += [ "..:common_objc" ]
1594
1595      public_configs = [ ":common_config_objc" ]
1596
1597      deps = [
1598        ":base_native_additions_objc",
1599        ":base_objc",
1600        ":helpers_objc",
1601        ":videocodec_objc",
1602        ":videoframebuffer_objc",
1603        ":vpx_codec_constants",
1604        ":wrapped_native_codec_objc",
1605        "../api/video:video_frame",
1606        "../api/video:video_frame_i420",
1607        "../api/video:video_rtp_headers",
1608        "../api/video_codecs:video_codecs_api",
1609        "../common_video",
1610        "../media:rtc_audio_video",
1611        "../media:rtc_media_base",
1612        "../modules:module_api",
1613        "../modules/video_coding:video_codec_interface",
1614        "../rtc_base",
1615        "../rtc_base:checks",
1616      ]
1617    }
1618
1619    rtc_library("video_toolbox_cc") {
1620      visibility = [
1621        ":videotoolbox_objc",
1622        ":sdk_unittests_sources",
1623      ]
1624      sources = [
1625        "objc/components/video_codec/helpers.cc",
1626        "objc/components/video_codec/helpers.h",
1627        "objc/components/video_codec/nalu_rewriter.cc",
1628        "objc/components/video_codec/nalu_rewriter.h",
1629      ]
1630      deps = [
1631        "../common_video",
1632        "../modules:module_api",
1633        "../modules/video_coding:webrtc_h264",
1634        "../rtc_base:checks",
1635        "../rtc_base:rtc_base_approved",
1636      ]
1637    }
1638
1639    rtc_library("videotoolbox_objc") {
1640      visibility = [ "*" ]
1641      allow_poison = [ "audio_codecs" ]  # TODO(bugs.webrtc.org/8396): Remove.
1642      sources = [
1643        "objc/components/video_codec/RTCVideoDecoderFactoryH264.h",
1644        "objc/components/video_codec/RTCVideoDecoderFactoryH264.m",
1645        "objc/components/video_codec/RTCVideoDecoderH264.h",
1646        "objc/components/video_codec/RTCVideoDecoderH264.mm",
1647        "objc/components/video_codec/RTCVideoEncoderFactoryH264.h",
1648        "objc/components/video_codec/RTCVideoEncoderFactoryH264.m",
1649        "objc/components/video_codec/RTCVideoEncoderH264.h",
1650        "objc/components/video_codec/RTCVideoEncoderH264.mm",
1651      ]
1652
1653      configs += [
1654        "..:common_objc",
1655        ":used_from_extension",
1656      ]
1657
1658      if (is_ios && rtc_apprtcmobile_broadcast_extension) {
1659        defines = [ "RTC_APPRTCMOBILE_BROADCAST_EXTENSION" ]
1660      }
1661
1662      deps = [
1663        ":base_native_additions_objc",
1664        ":base_objc",
1665        ":helpers_objc",
1666        ":video_toolbox_cc",
1667        ":videocodec_objc",
1668        ":videoframebuffer_objc",
1669        "../common_video",
1670        "../modules:module_api",
1671        "../modules/video_coding:video_codec_interface",
1672        "../rtc_base:checks",
1673        "../rtc_base:rtc_base_approved",
1674        "//third_party/libyuv",
1675      ]
1676
1677      frameworks = [
1678        "CoreFoundation.framework",
1679        "CoreMedia.framework",
1680        "CoreVideo.framework",
1681        "VideoToolbox.framework",
1682      ]
1683    }
1684  }
1685}
1686