Obj-C SDK Cleanup

This CL separates the files under sdk/objc into logical directories, replacing
the previous file layout under Framework/.

A long term goal is to have some system set up to generate the files under
sdk/objc/api (the PeerConnection API wrappers) from the C++ code. In the shorter
term the goal is to abstract out shared concepts from these classes in order to
make them as uniform as possible.

The separation into base/, components/, and helpers/ are to differentiate between
the base layer's common protocols, various utilities and the actual platform
specific components.

The old directory layout that resembled a framework's internal layout is not
necessary, since it is generated by the framework target when building it.

Bug: webrtc:9627
Change-Id: Ib084fd83f050ae980649ca99e841f4fb0580bd8f
Reviewed-on: https://webrtc-review.googlesource.com/94142
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24493}
diff --git a/sdk/objc/native/api/audio_device_module.h b/sdk/objc/native/api/audio_device_module.h
new file mode 100644
index 0000000..08e48ff
--- /dev/null
+++ b/sdk/objc/native/api/audio_device_module.h
@@ -0,0 +1,24 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_AUDIO_DEVICE_MODULE_H_
+#define SDK_OBJC_NATIVE_API_AUDIO_DEVICE_MODULE_H_
+
+#include <memory>
+
+#include "modules/audio_device/include/audio_device.h"
+
+namespace webrtc {
+
+rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceModule();
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_AUDIO_DEVICE_MODULE_H_
diff --git a/sdk/objc/native/api/audio_device_module.mm b/sdk/objc/native/api/audio_device_module.mm
new file mode 100644
index 0000000..893aaec
--- /dev/null
+++ b/sdk/objc/native/api/audio_device_module.mm
@@ -0,0 +1,30 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "audio_device_module.h"
+
+#include "rtc_base/logging.h"
+#include "rtc_base/refcountedobject.h"
+
+#include "sdk/objc/native/src/audio/audio_device_module_ios.h"
+
+namespace webrtc {
+
+rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceModule() {
+  RTC_LOG(INFO) << __FUNCTION__;
+#if defined(WEBRTC_IOS)
+  return new rtc::RefCountedObject<ios_adm::AudioDeviceModuleIOS>();
+#else
+  RTC_LOG(LERROR)
+      << "current platform is not supported => this module will self destruct!";
+  return nullptr;
+#endif
+}
+}
diff --git a/sdk/objc/native/api/video_capturer.h b/sdk/objc/native/api/video_capturer.h
new file mode 100644
index 0000000..5b6f3f9
--- /dev/null
+++ b/sdk/objc/native/api/video_capturer.h
@@ -0,0 +1,28 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_VIDEO_CAPTURER_H_
+#define SDK_OBJC_NATIVE_API_VIDEO_CAPTURER_H_
+
+#import "base/RTCVideoCapturer.h"
+
+#include "api/mediastreaminterface.h"
+#include "rtc_base/scoped_ref_ptr.h"
+
+namespace webrtc {
+
+rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> ObjCToNativeVideoCapturer(
+    RTCVideoCapturer* objc_video_capturer,
+    rtc::Thread* signaling_thread,
+    rtc::Thread* worker_thread);
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_VIDEO_CAPTURER_H_
diff --git a/sdk/objc/native/api/video_capturer.mm b/sdk/objc/native/api/video_capturer.mm
new file mode 100644
index 0000000..3bad998
--- /dev/null
+++ b/sdk/objc/native/api/video_capturer.mm
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "sdk/objc/native/api/video_capturer.h"
+
+#include "absl/memory/memory.h"
+#include "api/videosourceproxy.h"
+#include "sdk/objc/native/src/objc_video_track_source.h"
+
+namespace webrtc {
+
+rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> ObjCToNativeVideoCapturer(
+    RTCVideoCapturer *objc_video_capturer,
+    rtc::Thread *signaling_thread,
+    rtc::Thread *worker_thread) {
+  RTCObjCVideoSourceAdapter *adapter = [[RTCObjCVideoSourceAdapter alloc] init];
+  rtc::scoped_refptr<webrtc::ObjCVideoTrackSource> objc_video_track_source(
+      new rtc::RefCountedObject<webrtc::ObjCVideoTrackSource>(adapter));
+  rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> video_source =
+      webrtc::VideoTrackSourceProxy::Create(
+          signaling_thread, worker_thread, objc_video_track_source);
+
+  objc_video_capturer.delegate = adapter;
+
+  return video_source;
+}
+
+}  // namespace webrtc
diff --git a/sdk/objc/native/api/video_decoder_factory.h b/sdk/objc/native/api/video_decoder_factory.h
new file mode 100644
index 0000000..710bb6e
--- /dev/null
+++ b/sdk/objc/native/api/video_decoder_factory.h
@@ -0,0 +1,27 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_VIDEO_DECODER_FACTORY_H_
+#define SDK_OBJC_NATIVE_API_VIDEO_DECODER_FACTORY_H_
+
+#include <memory>
+
+#import "base/RTCVideoDecoderFactory.h"
+
+#include "api/video_codecs/video_decoder_factory.h"
+
+namespace webrtc {
+
+std::unique_ptr<VideoDecoderFactory> ObjCToNativeVideoDecoderFactory(
+    id<RTCVideoDecoderFactory> objc_video_decoder_factory);
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_VIDEO_DECODER_FACTORY_H_
diff --git a/sdk/objc/native/api/video_decoder_factory.mm b/sdk/objc/native/api/video_decoder_factory.mm
new file mode 100644
index 0000000..a4f9a20
--- /dev/null
+++ b/sdk/objc/native/api/video_decoder_factory.mm
@@ -0,0 +1,23 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "sdk/objc/native/api/video_decoder_factory.h"
+
+#include "absl/memory/memory.h"
+#include "sdk/objc/native/src/objc_video_decoder_factory.h"
+
+namespace webrtc {
+
+std::unique_ptr<VideoDecoderFactory> ObjCToNativeVideoDecoderFactory(
+    id<RTCVideoDecoderFactory> objc_video_decoder_factory) {
+  return absl::make_unique<ObjCVideoDecoderFactory>(objc_video_decoder_factory);
+}
+
+}  // namespace webrtc
diff --git a/sdk/objc/native/api/video_encoder_factory.h b/sdk/objc/native/api/video_encoder_factory.h
new file mode 100644
index 0000000..8dab48c
--- /dev/null
+++ b/sdk/objc/native/api/video_encoder_factory.h
@@ -0,0 +1,27 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_VIDEO_ENCODER_FACTORY_H_
+#define SDK_OBJC_NATIVE_API_VIDEO_ENCODER_FACTORY_H_
+
+#include <memory>
+
+#import "base/RTCVideoEncoderFactory.h"
+
+#include "api/video_codecs/video_encoder_factory.h"
+
+namespace webrtc {
+
+std::unique_ptr<VideoEncoderFactory> ObjCToNativeVideoEncoderFactory(
+    id<RTCVideoEncoderFactory> objc_video_encoder_factory);
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_VIDEO_ENCODER_FACTORY_H_
diff --git a/sdk/objc/native/api/video_encoder_factory.mm b/sdk/objc/native/api/video_encoder_factory.mm
new file mode 100644
index 0000000..0f4a57c
--- /dev/null
+++ b/sdk/objc/native/api/video_encoder_factory.mm
@@ -0,0 +1,23 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "sdk/objc/native/api/video_encoder_factory.h"
+
+#include "absl/memory/memory.h"
+#include "sdk/objc/native/src/objc_video_encoder_factory.h"
+
+namespace webrtc {
+
+std::unique_ptr<VideoEncoderFactory> ObjCToNativeVideoEncoderFactory(
+    id<RTCVideoEncoderFactory> objc_video_encoder_factory) {
+  return absl::make_unique<ObjCVideoEncoderFactory>(objc_video_encoder_factory);
+}
+
+}  // namespace webrtc
diff --git a/sdk/objc/native/api/video_frame.h b/sdk/objc/native/api/video_frame.h
new file mode 100644
index 0000000..f8dd568
--- /dev/null
+++ b/sdk/objc/native/api/video_frame.h
@@ -0,0 +1,24 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_VIDEO_FRAME_H_
+#define SDK_OBJC_NATIVE_API_VIDEO_FRAME_H_
+
+#import "base/RTCVideoFrame.h"
+
+#include "api/video/video_frame.h"
+
+namespace webrtc {
+
+RTCVideoFrame* NativeToObjCVideoFrame(const VideoFrame& frame);
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_VIDEO_FRAME_H_
diff --git a/sdk/objc/native/api/video_frame.mm b/sdk/objc/native/api/video_frame.mm
new file mode 100644
index 0000000..02dd830
--- /dev/null
+++ b/sdk/objc/native/api/video_frame.mm
@@ -0,0 +1,21 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "sdk/objc/native/api/video_frame.h"
+
+#include "sdk/objc/native/src/objc_video_frame.h"
+
+namespace webrtc {
+
+RTCVideoFrame* NativeToObjCVideoFrame(const VideoFrame& frame) {
+  return ToObjCVideoFrame(frame);
+}
+
+}  // namespace webrtc
diff --git a/sdk/objc/native/api/video_frame_buffer.h b/sdk/objc/native/api/video_frame_buffer.h
new file mode 100644
index 0000000..232e00a
--- /dev/null
+++ b/sdk/objc/native/api/video_frame_buffer.h
@@ -0,0 +1,29 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_VIDEO_FRAME_BUFFER_H_
+#define SDK_OBJC_NATIVE_API_VIDEO_FRAME_BUFFER_H_
+
+#import "base/RTCVideoFrameBuffer.h"
+
+#include "common_video/include/video_frame_buffer.h"
+#include "rtc_base/scoped_ref_ptr.h"
+
+namespace webrtc {
+
+rtc::scoped_refptr<VideoFrameBuffer> ObjCToNativeVideoFrameBuffer(
+    id<RTCVideoFrameBuffer> objc_video_frame_buffer);
+
+id<RTCVideoFrameBuffer> NativeToObjCVideoFrameBuffer(
+    const rtc::scoped_refptr<VideoFrameBuffer>& buffer);
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_VIDEO_FRAME_BUFFER_H_
diff --git a/sdk/objc/native/api/video_frame_buffer.mm b/sdk/objc/native/api/video_frame_buffer.mm
new file mode 100644
index 0000000..2abda42
--- /dev/null
+++ b/sdk/objc/native/api/video_frame_buffer.mm
@@ -0,0 +1,27 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "sdk/objc/native/api/video_frame_buffer.h"
+
+#include "sdk/objc/native/src/objc_frame_buffer.h"
+
+namespace webrtc {
+
+rtc::scoped_refptr<VideoFrameBuffer> ObjCToNativeVideoFrameBuffer(
+    id<RTCVideoFrameBuffer> objc_video_frame_buffer) {
+  return new rtc::RefCountedObject<ObjCFrameBuffer>(objc_video_frame_buffer);
+}
+
+id<RTCVideoFrameBuffer> NativeToObjCVideoFrameBuffer(
+    const rtc::scoped_refptr<VideoFrameBuffer> &buffer) {
+  return ToObjCVideoFrameBuffer(buffer);
+}
+
+}  // namespace webrtc
diff --git a/sdk/objc/native/api/video_renderer.h b/sdk/objc/native/api/video_renderer.h
new file mode 100644
index 0000000..afa6543
--- /dev/null
+++ b/sdk/objc/native/api/video_renderer.h
@@ -0,0 +1,28 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#ifndef SDK_OBJC_NATIVE_API_VIDEO_RENDERER_H_
+#define SDK_OBJC_NATIVE_API_VIDEO_RENDERER_H_
+
+#import "base/RTCVideoRenderer.h"
+
+#include <memory>
+
+#include "api/video/video_frame.h"
+#include "api/video/video_sink_interface.h"
+
+namespace webrtc {
+
+std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> ObjCToNativeVideoRenderer(
+    id<RTCVideoRenderer> objc_video_renderer);
+
+}  // namespace webrtc
+
+#endif  // SDK_OBJC_NATIVE_API_VIDEO_RENDERER_H_
diff --git a/sdk/objc/native/api/video_renderer.mm b/sdk/objc/native/api/video_renderer.mm
new file mode 100644
index 0000000..ce36c34
--- /dev/null
+++ b/sdk/objc/native/api/video_renderer.mm
@@ -0,0 +1,23 @@
+/*
+ *  Copyright 2018 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.
+ */
+
+#include "sdk/objc/native/api/video_renderer.h"
+
+#include "absl/memory/memory.h"
+#include "sdk/objc/native/src/objc_video_renderer.h"
+
+namespace webrtc {
+
+std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> ObjCToNativeVideoRenderer(
+    id<RTCVideoRenderer> objc_video_renderer) {
+  return absl::make_unique<ObjCVideoRenderer>(objc_video_renderer);
+}
+
+}  // namespace webrtc