Moving src/webrtc into src/.
In order to eliminate the WebRTC Subtree mirror in Chromium,
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Original-Commit-Position: refs/heads/master@{#19845}
Cr-Mirrored-From: https://webrtc.googlesource.com/src
Cr-Mirrored-Commit: bb547203bfebcc478b263c4e9ca173c6fd5a0c5d
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index b5abe8e..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,29 +0,0 @@
-# This file is for projects that checkout webrtc/ directly (e.g. Chromium). It
-# is a truncated copy of the .gitignore file in the parent directory.
-*.DS_Store
-*.Makefile
-*.host.mk
-*.ncb
-*.ninja
-*.props
-*.pyc
-*.rules
-*.scons
-*.sdf
-*.sln
-*.suo
-*.target.mk
-*.targets
-*.user
-*.vcproj
-*.vcxproj
-*.vcxproj.filters
-*.vpj
-*.vpw
-*.vpwhistu
-*.vtg
-*.xcodeproj
-*_proto.xml
-*_proto_cpp.xml
-*~
-.*.sw?
diff --git a/BUILD.gn b/BUILD.gn
deleted file mode 100644
index bfdb53b..0000000
--- a/BUILD.gn
+++ /dev/null
@@ -1,542 +0,0 @@
-# Copyright (c) 2014 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.
-
-# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
-
-import("//build/config/linux/pkg_config.gni")
-import("//build/config/sanitizers/sanitizers.gni")
-import("webrtc.gni")
-import("//third_party/protobuf/proto_library.gni")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-# Contains the defines and includes in common.gypi that are duplicated both as
-# target_defaults and direct_dependent_settings.
-config("common_inherited_config") {
- defines = []
- cflags = []
- ldflags = []
- if (build_with_mozilla) {
- defines += [ "WEBRTC_MOZILLA_BUILD" ]
- }
-
- # Some tests need to declare their own trace event handlers. If this define is
- # not set, the first time TRACE_EVENT_* is called it will store the return
- # value for the current handler in an static variable, so that subsequent
- # changes to the handler for that TRACE_EVENT_* will be ignored.
- # So when tests are included, we set this define, making it possible to use
- # different event handlers in different tests.
- if (rtc_include_tests) {
- defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
- } else {
- defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
- }
- if (build_with_chromium) {
- defines += [
- # TODO(kjellander): Cleanup unused ones and move defines closer to
- # the source when webrtc:4256 is completed.
- "FEATURE_ENABLE_VOICEMAIL",
- "GTEST_RELATIVE_PATH",
- "WEBRTC_CHROMIUM_BUILD",
- ]
- include_dirs = [
- # The overrides must be included first as that is the mechanism for
- # selecting the override headers in Chromium.
- "../webrtc_overrides",
-
- # Allow includes to be prefixed with webrtc/ in case it is not an
- # immediate subdirectory of the top-level.
- "..",
- ]
- }
- if (is_posix) {
- defines += [ "WEBRTC_POSIX" ]
- }
- if (is_ios) {
- defines += [
- "WEBRTC_MAC",
- "WEBRTC_IOS",
- ]
- }
- if (is_linux) {
- defines += [ "WEBRTC_LINUX" ]
- }
- if (is_mac) {
- defines += [ "WEBRTC_MAC" ]
- }
- if (is_win) {
- defines += [
- "WEBRTC_WIN",
- "_CRT_SECURE_NO_WARNINGS", # Suppress warnings about _vsnprinf
- ]
- }
- if (is_android) {
- defines += [
- "WEBRTC_LINUX",
- "WEBRTC_ANDROID",
- ]
- }
- if (is_chromeos) {
- defines += [ "CHROMEOS" ]
- }
-
- if (rtc_sanitize_coverage != "") {
- assert(is_clang, "sanitizer coverage requires clang")
- cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
- ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
- }
-
- if (is_ubsan) {
- cflags += [ "-fsanitize=float-cast-overflow" ]
- }
-
- # TODO(GYP): Support these in GN.
- # if (is_bsd) {
- # defines += [ "BSD" ]
- # }
- # if (is_openbsd) {
- # defines += [ "OPENBSD" ]
- # }
- # if (is_freebsd) {
- # defines += [ "FREEBSD" ]
- # }
-}
-
-config("common_config") {
- cflags = []
- cflags_cc = []
- defines = []
-
- if (rtc_enable_protobuf) {
- defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
- } else {
- defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
- }
-
- if (rtc_restrict_logging) {
- defines += [ "WEBRTC_RESTRICT_LOGGING" ]
- }
-
- if (rtc_include_internal_audio_device) {
- defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
- }
-
- if (!rtc_libvpx_build_vp9) {
- defines += [ "RTC_DISABLE_VP9" ]
- }
-
- if (rtc_enable_sctp) {
- defines += [ "HAVE_SCTP" ]
- }
-
- if (rtc_enable_external_auth) {
- defines += [ "ENABLE_EXTERNAL_AUTH" ]
- }
-
- if (build_with_chromium) {
- defines += [
- # NOTICE: Since common_inherited_config is used in public_configs for our
- # targets, there's no point including the defines in that config here.
- # TODO(kjellander): Cleanup unused ones and move defines closer to the
- # source when webrtc:4256 is completed.
- "HAVE_WEBRTC_VIDEO",
- "HAVE_WEBRTC_VOICE",
- "LOGGING_INSIDE_WEBRTC",
- "USE_WEBRTC_DEV_BRANCH",
- ]
- } else {
- if (is_posix) {
- # Enable more warnings: -Wextra is currently disabled in Chromium.
- cflags = [
- "-Wextra",
-
- # Repeat some flags that get overridden by -Wextra.
- "-Wno-unused-parameter",
- "-Wno-missing-field-initializers",
- "-Wno-strict-overflow",
- ]
- cflags_cc = [
- "-Wnon-virtual-dtor",
-
- # This is enabled for clang; enable for gcc as well.
- "-Woverloaded-virtual",
- ]
- }
-
- if (is_clang) {
- cflags += [
- "-Wc++11-narrowing",
- "-Wimplicit-fallthrough",
- "-Wthread-safety",
- "-Winconsistent-missing-override",
- "-Wundef",
- ]
-
- # use_xcode_clang only refers to the iOS toolchain, host binaries use
- # chromium's clang always.
- if (!is_nacl &&
- (!use_xcode_clang || current_toolchain == host_toolchain)) {
- # Flags NaCl (Clang 3.7) and Xcode 7.3 (Clang clang-703.0.31) do not
- # recognize.
- cflags += [ "-Wunused-lambda-capture" ]
- }
- }
- }
-
- if (current_cpu == "arm64") {
- defines += [ "WEBRTC_ARCH_ARM64" ]
- defines += [ "WEBRTC_HAS_NEON" ]
- }
-
- if (current_cpu == "arm") {
- defines += [ "WEBRTC_ARCH_ARM" ]
- if (arm_version >= 7) {
- defines += [ "WEBRTC_ARCH_ARM_V7" ]
- if (arm_use_neon) {
- defines += [ "WEBRTC_HAS_NEON" ]
- }
- }
- }
-
- if (current_cpu == "mipsel") {
- defines += [ "MIPS32_LE" ]
- if (mips_float_abi == "hard") {
- defines += [ "MIPS_FPU_LE" ]
- }
- if (mips_arch_variant == "r2") {
- defines += [ "MIPS32_R2_LE" ]
- }
- if (mips_dsp_rev == 1) {
- defines += [ "MIPS_DSP_R1_LE" ]
- } else if (mips_dsp_rev == 2) {
- defines += [
- "MIPS_DSP_R1_LE",
- "MIPS_DSP_R2_LE",
- ]
- }
- }
-
- if (is_android && !is_clang) {
- # The Android NDK doesn"t provide optimized versions of these
- # functions. Ensure they are disabled for all compilers.
- cflags += [
- "-fno-builtin-cos",
- "-fno-builtin-sin",
- "-fno-builtin-cosf",
- "-fno-builtin-sinf",
- ]
- }
-
- if (use_libfuzzer || use_drfuzz || use_afl) {
- # Used in Chromium's overrides to disable logging
- defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
- }
-}
-
-config("common_objc") {
- libs = [ "Foundation.framework" ]
-}
-
-if (!build_with_chromium) {
- # Target to build all the WebRTC production code.
- rtc_static_library("webrtc") {
- # Only the root target should depend on this.
- visibility = [ "//:default" ]
-
- sources = []
- complete_static_lib = true
- defines = []
-
- deps = [
- ":webrtc_common",
- "api",
- "api:transport_api",
- "audio",
- "call",
- "common_audio",
- "common_video",
- "logging",
- "media",
- "modules",
- "modules/video_capture:video_capture_internal_impl",
- "ortc",
- "p2p",
- "pc",
- "rtc_base",
- "sdk",
- "stats",
- "system_wrappers:system_wrappers_default",
- "video",
- "voice_engine",
- ]
-
- if (rtc_enable_protobuf) {
- defines += [ "ENABLE_RTC_EVENT_LOG" ]
- deps += [ "logging:rtc_event_log_proto" ]
- }
- }
-
- if (rtc_include_tests) {
- # Target to build all the WebRTC tests (but not examples or tools).
- # Executable in order to get a target that links all WebRTC code.
- rtc_executable("webrtc_tests") {
- testonly = true
-
- # Only the root target should depend on this.
- visibility = [ "//:default" ]
-
- deps = [
- ":rtc_unittests",
- ":video_engine_tests",
- ":webrtc_nonparallel_tests",
- ":webrtc_perf_tests",
- "common_audio:common_audio_unittests",
- "common_video:common_video_unittests",
- "media:rtc_media_unittests",
- "modules:modules_tests",
- "modules:modules_unittests",
- "modules/audio_coding:audio_coding_tests",
- "modules/audio_processing:audio_processing_tests",
- "modules/remote_bitrate_estimator:bwe_simulations_tests",
- "modules/rtp_rtcp:test_packet_masks_metrics",
- "modules/video_capture:video_capture_internal_impl",
- "ortc:ortc_unittests",
- "pc:peerconnection_unittests",
- "pc:rtc_pc_unittests",
- "rtc_base:rtc_base_tests_utils",
- "stats:rtc_stats_unittests",
- "system_wrappers:system_wrappers_unittests",
- "test",
- "video:screenshare_loopback",
- "video:video_loopback",
- "voice_engine:voice_engine_unittests",
- ]
- if (is_android) {
- deps += [
- ":android_junit_tests",
- "sdk/android:libjingle_peerconnection_android_unittest",
- ]
- } else {
- deps += [ "modules/video_capture:video_capture_tests" ]
- }
- if (!is_ios) {
- deps += [ "voice_engine:voe_auto_test" ]
- }
- if (rtc_enable_protobuf) {
- deps += [
- "audio:low_bandwidth_audio_test",
- "logging:rtc_event_log2rtp_dump",
- ]
- }
- }
- }
-}
-
-rtc_static_library("webrtc_common") {
- # TODO(mbonadei): Remove (bugs.webrtc.org/7745)
- # Enabling GN check triggers cyclic dependency error:
- # :webrtc_common ->
- # api:video_frame_api ->
- # system_wrappers:system_wrappers ->
- # webrtc_common
- check_includes = false
- sources = [
- "common_types.cc",
- "common_types.h",
- "typedefs.h",
- ]
-
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-}
-
-if (use_libfuzzer || use_drfuzz || use_afl) {
- # This target is only here for gn to discover fuzzer build targets under
- # webrtc/test/fuzzers/.
- group("webrtc_fuzzers_dummy") {
- testonly = true
- deps = [
- "test/fuzzers:webrtc_fuzzer_main",
- ]
- }
-}
-
-if (rtc_include_tests) {
- config("rtc_unittests_config") {
- # GN orders flags on a target before flags from configs. The default config
- # adds -Wall, and this flag have to be after -Wall -- so they need to
- # come from a config and can"t be on the target directly.
- if (is_clang) {
- cflags = [
- "-Wno-sign-compare",
- "-Wno-unused-const-variable",
- ]
- }
- }
-
- rtc_test("rtc_unittests") {
- testonly = true
-
- deps = [
- ":webrtc_common",
- "api:rtc_api_unittests",
- "api/audio_codecs/test:audio_codecs_api_unittests",
- "p2p:libstunprober_unittests",
- "p2p:rtc_p2p_unittests",
- "rtc_base:rtc_base_approved_unittests",
- "rtc_base:rtc_base_tests_main",
- "rtc_base:rtc_base_tests_utils",
- "rtc_base:rtc_base_unittests",
- "rtc_base:rtc_numerics_unittests",
- "rtc_base:rtc_task_queue_unittests",
- "rtc_base:sequenced_task_checker_unittests",
- "rtc_base:weak_ptr_unittests",
- "system_wrappers:metrics_default",
- ]
-
- if (rtc_enable_protobuf) {
- deps += [ "logging:rtc_event_log_tests" ]
- }
-
- if (is_android) {
- deps += [ "//testing/android/native_test:native_test_support" ]
- shard_timeout = 900
- }
-
- if (is_ios || is_mac) {
- deps += [ "sdk:sdk_unittests_objc" ]
- }
- }
-
- # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
- video_engine_tests_resources = [
- "../resources/foreman_cif_short.yuv",
- "../resources/voice_engine/audio_long16.pcm",
- ]
-
- if (is_ios) {
- bundle_data("video_engine_tests_bundle_data") {
- testonly = true
- sources = video_engine_tests_resources
- outputs = [
- "{{bundle_resources_dir}}/{{source_file_part}}",
- ]
- }
- }
-
- rtc_test("video_engine_tests") {
- testonly = true
- deps = [
- "audio:audio_tests",
-
- # TODO(eladalon): call_tests aren't actually video-specific, so we
- # should move them to a more appropriate test suite.
- "call:call_tests",
- "modules/video_capture",
- "rtc_base:rtc_base_tests_utils",
- "test:test_common",
- "test:test_main",
- "test:video_test_common",
- "video:video_tests",
- ]
- data = video_engine_tests_resources
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
- if (is_android) {
- deps += [ "//testing/android/native_test:native_test_native_code" ]
- shard_timeout = 900
- }
- if (is_ios) {
- deps += [ ":video_engine_tests_bundle_data" ]
- }
- }
-
- webrtc_perf_tests_resources = [
- "../resources/audio_coding/speech_mono_16kHz.pcm",
- "../resources/audio_coding/speech_mono_32_48kHz.pcm",
- "../resources/audio_coding/testfile32kHz.pcm",
- "../resources/ConferenceMotion_1280_720_50.yuv",
- "../resources/difficult_photo_1850_1110.yuv",
- "../resources/foreman_cif.yuv",
- "../resources/google-wifi-3mbps.rx",
- "../resources/paris_qcif.yuv",
- "../resources/photo_1850_1110.yuv",
- "../resources/presentation_1850_1110.yuv",
- "../resources/verizon4g-downlink.rx",
- "../resources/voice_engine/audio_long16.pcm",
- "../resources/web_screenshot_1850_1110.yuv",
- ]
-
- if (is_ios) {
- bundle_data("webrtc_perf_tests_bundle_data") {
- testonly = true
- sources = webrtc_perf_tests_resources
- outputs = [
- "{{bundle_resources_dir}}/{{source_file_part}}",
- ]
- }
- }
-
- rtc_test("webrtc_perf_tests") {
- testonly = true
- configs += [ ":rtc_unittests_config" ]
-
- deps = [
- "audio:audio_perf_tests",
- "call:call_perf_tests",
- "modules/audio_coding:audio_coding_perf_tests",
- "modules/audio_processing:audio_processing_perf_tests",
- "modules/remote_bitrate_estimator:remote_bitrate_estimator_perf_tests",
- "test:test_main",
- "video:video_full_stack_tests",
- ]
-
- data = webrtc_perf_tests_resources
- if (is_android) {
- deps += [ "//testing/android/native_test:native_test_native_code" ]
- shard_timeout = 2700
- }
- if (is_ios) {
- deps += [ ":webrtc_perf_tests_bundle_data" ]
- }
- }
-
- rtc_test("webrtc_nonparallel_tests") {
- testonly = true
- deps = [
- "rtc_base:rtc_base_nonparallel_tests",
- ]
- if (is_android) {
- deps += [ "//testing/android/native_test:native_test_support" ]
- shard_timeout = 900
- }
- }
-
- if (is_android) {
- junit_binary("android_junit_tests") {
- java_files = [
- "examples/androidjunit/src/org/appspot/apprtc/BluetoothManagerTest.java",
- "examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
- "examples/androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
- "sdk/android/tests/src/org/webrtc/CameraEnumerationTest.java",
- ]
-
- deps = [
- "examples:AppRTCMobile_javalib",
- "sdk/android:libjingle_peerconnection_java",
- "//base:base_java_test_support",
- ]
- }
- }
-}
diff --git a/DEPS b/DEPS
deleted file mode 100644
index 0459f4c..0000000
--- a/DEPS
+++ /dev/null
@@ -1,34 +0,0 @@
-# Define rules for which include paths are allowed in our source.
-include_rules = [
- # Base is only used to build Android APK tests and may not be referenced by
- # WebRTC production code.
- "-base",
- "-chromium",
- "+external/webrtc/webrtc", # Android platform build.
- "+gflags",
- "+libyuv",
- "-webrtc", # Has to be disabled; otherwise all dirs below will be allowed.
- # Individual headers that will be moved out of here, see webrtc:4243.
- "+webrtc/call/rtp_config.h",
- "+webrtc/common_types.h",
- "+webrtc/transport.h",
- "+webrtc/typedefs.h",
- "+webrtc/voice_engine_configurations.h",
-
- "+WebRTC",
- "+webrtc/api",
- "+webrtc/modules/include",
- "+webrtc/rtc_base",
- "+webrtc/test",
- "+webrtc/rtc_tools",
-]
-
-# The below rules will be removed when webrtc:4243 is fixed.
-specific_include_rules = {
- "video_receive_stream\.h": [
- "+webrtc/call/video_receive_stream.h",
- ],
- "video_send_stream\.h": [
- "+webrtc/call/video_send_stream.h",
- ],
-}
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 4c41b7b..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,29 +0,0 @@
-Copyright (c) 2011, The WebRTC project authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- * Neither the name of Google nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSE_THIRD_PARTY b/LICENSE_THIRD_PARTY
deleted file mode 100644
index af1aa50..0000000
--- a/LICENSE_THIRD_PARTY
+++ /dev/null
@@ -1,458 +0,0 @@
-This source tree contains third party source code which is governed by third
-party licenses. Paths to the files and associated licenses are collected here.
-
-Files governed by third party licenses:
-base/base64.cc
-base/base64.h
-base/md5.cc
-base/md5.h
-base/sha1.cc
-base/sha1.h
-base/sigslot.cc
-base/sigslot.h
-common_audio/fft4g.c
-common_audio/signal_processing/spl_sqrt_floor.c
-common_audio/signal_processing/spl_sqrt_floor_arm.S
-modules/audio_coding/codecs/g711/main/source/g711.c
-modules/audio_coding/codecs/g711/main/source/g711.h
-modules/audio_coding/codecs/g722/main/source/g722_decode.c
-modules/audio_coding/codecs/g722/main/source/g722_enc_dec.h
-modules/audio_coding/codecs/g722/main/source/g722_encode.c
-modules/audio_coding/codecs/isac/main/source/fft.c
-modules/audio_device/mac/portaudio/pa_memorybarrier.h
-modules/audio_device/mac/portaudio/pa_ringbuffer.c
-modules/audio_device/mac/portaudio/pa_ringbuffer.h
-modules/audio_processing/aec/aec_rdft.c
-system_wrappers/source/condition_variable_event_win.cc
-system_wrappers/source/set_thread_name_win.h
-
-Individual licenses for each file:
--------------------------------------------------------------------------------
-Files:
-base/base64.cc
-base/base64.h
-
-License:
-//*********************************************************************
-//* Base64 - a simple base64 encoder and decoder.
-//*
-//* Copyright (c) 1999, Bob Withers - bwit@pobox.com
-//*
-//* This code may be freely used for any purpose, either personal
-//* or commercial, provided the authors copyright notice remains
-//* intact.
-//*
-//* Enhancements by Stanley Yamane:
-//* o reverse lookup table for the decode function
-//* o reserve string buffer space in advance
-//*
-//*********************************************************************
--------------------------------------------------------------------------------
-Files:
-base/md5.cc
-base/md5.h
-
-License:
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
--------------------------------------------------------------------------------
-Files:
-base/sha1.cc
-base/sha1.h
-
-License:
-/*
- * SHA-1 in C
- * By Steve Reid <sreid@sea-to-sky.net>
- * 100% Public Domain
- *
- * -----------------
- * Modified 7/98
- * By James H. Brown <jbrown@burgoyne.com>
- * Still 100% Public Domain
- *
--------------------------------------------------------------------------------
-Files:
-base/sigslot.cc
-base/sigslot.h
-
-License:
-// sigslot.h: Signal/Slot classes
-//
-// Written by Sarah Thompson (sarah@telergy.com) 2002.
-//
-// License: Public domain. You are free to use this code however you like, with
-// the proviso that the author takes on no responsibility or liability for any
-// use.
--------------------------------------------------------------------------------
-Files:
-common_audio/signal_processing/spl_sqrt_floor.c
-common_audio/signal_processing/spl_sqrt_floor_arm.S
-
-License:
-/*
- * Written by Wilco Dijkstra, 1996. The following email exchange establishes the
- * license.
- *
- * From: Wilco Dijkstra <Wilco.Dijkstra@ntlworld.com>
- * Date: Fri, Jun 24, 2011 at 3:20 AM
- * Subject: Re: sqrt routine
- * To: Kevin Ma <kma@google.com>
- * Hi Kevin,
- * Thanks for asking. Those routines are public domain (originally posted to
- * comp.sys.arm a long time ago), so you can use them freely for any purpose.
- * Cheers,
- * Wilco
- *
- * ----- Original Message -----
- * From: "Kevin Ma" <kma@google.com>
- * To: <Wilco.Dijkstra@ntlworld.com>
- * Sent: Thursday, June 23, 2011 11:44 PM
- * Subject: Fwd: sqrt routine
- * Hi Wilco,
- * I saw your sqrt routine from several web sites, including
- * http://www.finesse.demon.co.uk/steven/sqrt.html.
- * Just wonder if there's any copyright information with your Successive
- * approximation routines, or if I can freely use it for any purpose.
- * Thanks.
- * Kevin
- */
--------------------------------------------------------------------------------
-Files:
-modules/audio_coding/codecs/g711/main/source/g711.c
-modules/audio_coding/codecs/g711/main/source/g711.h
-
-License:
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g711.h - In line A-law and u-law conversion routines
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2001 Steve Underwood
- *
- * Despite my general liking of the GPL, I place this code in the
- * public domain for the benefit of all mankind - even the slimy
- * ones who might try to proprietize my work and use it to my
- * detriment.
- */
--------------------------------------------------------------------------------
-Files:
-modules/audio_coding/codecs/g722/main/source/g722_decode.c
-modules/audio_coding/codecs/g722/main/source/g722_enc_dec.h
-modules/audio_coding/codecs/g722/main/source/g722_encode.c
-
-License:
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g722_decode.c - The ITU G.722 codec, decode part.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2005 Steve Underwood
- *
- * Despite my general liking of the GPL, I place my own contributions
- * to this code in the public domain for the benefit of all mankind -
- * even the slimy ones who might try to proprietize my work and use it
- * to my detriment.
- *
- * Based in part on a single channel G.722 codec which is:
- *
- * Copyright (c) CMU 1993
- * Computer Science, Speech Group
- * Chengxiang Lu and Alex Hauptmann
- */
--------------------------------------------------------------------------------
-Files:
-modules/audio_coding/codecs/isac/main/source/fft.c
-
-License:
-/*
- * Copyright(c)1995,97 Mark Olesen <olesen@me.QueensU.CA>
- * Queen's Univ at Kingston (Canada)
- *
- * Permission to use, copy, modify, and distribute this software for
- * any purpose without fee is hereby granted, provided that this
- * entire notice is included in all copies of any software which is
- * or includes a copy or modification of this software and in all
- * copies of the supporting documentation for such software.
- *
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR QUEEN'S
- * UNIVERSITY AT KINGSTON MAKES ANY REPRESENTATION OR WARRANTY OF ANY
- * KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS
- * FITNESS FOR ANY PARTICULAR PURPOSE.
- *
- * All of which is to say that you can do what you like with this
- * source code provided you don't try to sell it as your own and you
- * include an unaltered copy of this message (including the
- * copyright).
- *
- * It is also implicitly understood that bug fixes and improvements
- * should make their way back to the general Internet community so
- * that everyone benefits.
- */
--------------------------------------------------------------------------------
-Files:
-modules/audio_device/mac/portaudio/pa_memorybarrier.h
-modules/audio_device/mac/portaudio/pa_ringbuffer.c
-modules/audio_device/mac/portaudio/pa_ringbuffer.h
-
-License:
-/*
- * $Id: pa_memorybarrier.h 1240 2007-07-17 13:05:07Z bjornroche $
- * Portable Audio I/O Library
- * Memory barrier utilities
- *
- * Author: Bjorn Roche, XO Audio, LLC
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com
- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/*
- * $Id: pa_ringbuffer.c 1421 2009-11-18 16:09:05Z bjornroche $
- * Portable Audio I/O Library
- * Ring Buffer utility.
- *
- * Author: Phil Burk, http://www.softsynth.com
- * modified for SMP safety on Mac OS X by Bjorn Roche
- * modified for SMP safety on Linux by Leland Lucius
- * also, allowed for const where possible
- * modified for multiple-byte-sized data elements by Sven Fischer
- *
- * Note that this is safe only for a single-thread reader and a
- * single-thread writer.
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com
- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
--------------------------------------------------------------------------------
-Files:
-common_audio/fft4g.c
-modules/audio_processing/aec/aec_rdft.c
-
-License:
-/*
- * http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
- * Copyright Takuya OOURA, 1996-2001
- *
- * You may use, copy, modify and distribute this code for any purpose (include
- * commercial use) and without fee. Please refer to this package when you modify
- * this code.
- */
--------------------------------------------------------------------------------
-Files:
-system_wrappers/source/condition_variable_event_win.cc
-
-Source:
-http://www1.cse.wustl.edu/~schmidt/ACE-copying.html
-
-License:
-Copyright and Licensing Information for ACE(TM), TAO(TM), CIAO(TM), DAnCE(TM),
-and CoSMIC(TM)
-
-ACE(TM), TAO(TM), CIAO(TM), DAnCE>(TM), and CoSMIC(TM) (henceforth referred to
-as "DOC software") are copyrighted by Douglas C. Schmidt and his research
-group at Washington University, University of California, Irvine, and
-Vanderbilt University, Copyright (c) 1993-2009, all rights reserved. Since DOC
-software is open-source, freely available software, you are free to use,
-modify, copy, and distribute--perpetually and irrevocably--the DOC software
-source code and object code produced from the source, as well as copy and
-distribute modified versions of this software. You must, however, include this
-copyright statement along with any code built using DOC software that you
-release. No copyright statement needs to be provided if you just ship binary
-executables of your software products.
-You can use DOC software in commercial and/or binary software releases and are
-under no obligation to redistribute any of your source code that is built
-using DOC software. Note, however, that you may not misappropriate the DOC
-software code, such as copyrighting it yourself or claiming authorship of the
-DOC software code, in a way that will prevent DOC software from being
-distributed freely using an open-source development model. You needn't inform
-anyone that you're using DOC software in your software, though we encourage
-you to let us know so we can promote your project in the DOC software success
-stories.
-
-The ACE, TAO, CIAO, DAnCE, and CoSMIC web sites are maintained by the DOC
-Group at the Institute for Software Integrated Systems (ISIS) and the Center
-for Distributed Object Computing of Washington University, St. Louis for the
-development of open-source software as part of the open-source software
-community. Submissions are provided by the submitter ``as is'' with no
-warranties whatsoever, including any warranty of merchantability,
-noninfringement of third party intellectual property, or fitness for any
-particular purpose. In no event shall the submitter be liable for any direct,
-indirect, special, exemplary, punitive, or consequential damages, including
-without limitation, lost profits, even if advised of the possibility of such
-damages. Likewise, DOC software is provided as is with no warranties of any
-kind, including the warranties of design, merchantability, and fitness for a
-particular purpose, noninfringement, or arising from a course of dealing,
-usage or trade practice. Washington University, UC Irvine, Vanderbilt
-University, their employees, and students shall have no liability with respect
-to the infringement of copyrights, trade secrets or any patents by DOC
-software or any part thereof. Moreover, in no event will Washington
-University, UC Irvine, or Vanderbilt University, their employees, or students
-be liable for any lost revenue or profits or other special, indirect and
-consequential damages.
-
-DOC software is provided with no support and without any obligation on the
-part of Washington University, UC Irvine, Vanderbilt University, their
-employees, or students to assist in its use, correction, modification, or
-enhancement. A number of companies around the world provide commercial support
-for DOC software, however. DOC software is Y2K-compliant, as long as the
-underlying OS platform is Y2K-compliant. Likewise, DOC software is compliant
-with the new US daylight savings rule passed by Congress as "The Energy Policy
-Act of 2005," which established new daylight savings times (DST) rules for the
-United States that expand DST as of March 2007. Since DOC software obtains
-time/date and calendaring information from operating systems users will not be
-affected by the new DST rules as long as they upgrade their operating systems
-accordingly.
-
-The names ACE(TM), TAO(TM), CIAO(TM), DAnCE(TM), CoSMIC(TM), Washington
-University, UC Irvine, and Vanderbilt University, may not be used to endorse
-or promote products or services derived from this source without express
-written permission from Washington University, UC Irvine, or Vanderbilt
-University. This license grants no permission to call products or services
-derived from this source ACE(TM), TAO(TM), CIAO(TM), DAnCE(TM), or CoSMIC(TM),
-nor does it grant permission for the name Washington University, UC Irvine, or
-Vanderbilt University to appear in their names.
--------------------------------------------------------------------------------
-Files:
-system_wrappers/source/set_thread_name_win.h
-
-Source:
-http://msdn.microsoft.com/en-us/cc300389.aspx#P
-
-License:
-This license governs use of code marked as “sample” or “example” available on
-this web site without a license agreement, as provided under the section above
-titled “NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.” If you use
-such code (the “software”), you accept this license. If you do not accept the
-license, do not use the software.
-
-1. Definitions
-
-The terms “reproduce,” “reproduction,” “derivative works,” and “distribution”
-have the same meaning here as under U.S. copyright law.
-
-A “contribution” is the original software, or any additions or changes to the
-software.
-
-A “contributor” is any person that distributes its contribution under this
-license.
-
-“Licensed patents” are a contributor’s patent claims that read directly on its
-contribution.
-
-2. Grant of Rights
-
-(A) Copyright Grant - Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute its
-contribution or any derivative works that you create.
-
-(B) Patent Grant - Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution in
-the software.
-
-3. Conditions and Limitations
-
-(A) No Trademark License- This license does not grant you rights to use any
-contributors’ name, logo, or trademarks.
-
-(B) If you bring a patent claim against any contributor over patents that you
-claim are infringed by the software, your patent license from such contributor
-to the software ends automatically.
-
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in the
-software.
-
-(D) If you distribute any portion of the software in source code form, you may
-do so only under this license by including a complete copy of this license
-with your distribution. If you distribute any portion of the software in
-compiled or object code form, you may only do so under a license that complies
-with this license.
-
-(E) The software is licensed “as-is.” You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-
-(F) Platform Limitation - The licenses granted in sections 2(A) and 2(B)
-extend only to the software or derivative works that you create that run on a
-Microsoft Windows operating system product.
-
diff --git a/OWNERS b/OWNERS
deleted file mode 100644
index 025c721..0000000
--- a/OWNERS
+++ /dev/null
@@ -1,13 +0,0 @@
-henrika@webrtc.org
-kwiberg@webrtc.org
-mflodman@webrtc.org
-niklas.enbom@webrtc.org
-stefan@webrtc.org
-tina.legrand@webrtc.org
-tommi@webrtc.org
-
-per-file *.gn=kjellander@webrtc.org
-per-file *.gni=kjellander@webrtc.org
-
-per-file *video*.h=pbos@webrtc.org
-per-file DEPS=kjellander@webrtc.org
diff --git a/PATENTS b/PATENTS
deleted file mode 100644
index 190607a..0000000
--- a/PATENTS
+++ /dev/null
@@ -1,24 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the WebRTC code package.
-
-Google hereby grants to you a perpetual, worldwide, non-exclusive,
-no-charge, irrevocable (except as stated in this section) patent
-license to make, have made, use, offer to sell, sell, import,
-transfer, and otherwise run, modify and propagate the contents of this
-implementation of the WebRTC code package, where such license applies
-only to those patent claims, both currently owned by Google and
-acquired in the future, licensable by Google that are necessarily
-infringed by this implementation of the WebRTC code package. This
-grant does not include claims that would be infringed only as a
-consequence of further modification of this implementation. If you or
-your agent or exclusive licensee institute or order or agree to the
-institution of patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that this
-implementation of the WebRTC code package or any code incorporated
-within this implementation of the WebRTC code package constitutes
-direct or contributory patent infringement, or inducement of patent
-infringement, then any patent rights granted to you under this License
-for this implementation of the WebRTC code package shall terminate as
-of the date such litigation is filed.
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
deleted file mode 100644
index 4132c16..0000000
--- a/PRESUBMIT.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (c) 2013 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.
-
-def _LicenseHeader(input_api):
- """Returns the license header regexp."""
- # Accept any year number from 2003 to the current year
- current_year = int(input_api.time.strftime('%Y'))
- allowed_years = (str(s) for s in reversed(xrange(2003, current_year + 1)))
- years_re = '(' + '|'.join(allowed_years) + ')'
- license_header = (
- r'.*? Copyright( \(c\))? %(year)s The WebRTC [Pp]roject [Aa]uthors\. '
- r'All [Rr]ights [Rr]eserved\.\n'
- r'.*?\n'
- r'.*? Use of this source code is governed by a BSD-style license\n'
- r'.*? that can be found in the LICENSE file in the root of the source\n'
- r'.*? tree\. An additional intellectual property rights grant can be '
- r'found\n'
- r'.*? in the file PATENTS\. All contributing project authors may\n'
- r'.*? be found in the AUTHORS file in the root of the source tree\.\n'
- ) % {
- 'year': years_re,
- }
- return license_header
-
-def _CommonChecks(input_api, output_api):
- """Checks common to both upload and commit."""
- results = []
- results.extend(input_api.canned_checks.CheckLicense(
- input_api, output_api, _LicenseHeader(input_api)))
- return results
-
-def CheckChangeOnUpload(input_api, output_api):
- results = []
- results.extend(_CommonChecks(input_api, output_api))
- return results
-
-def CheckChangeOnCommit(input_api, output_api):
- results = []
- results.extend(_CommonChecks(input_api, output_api))
- return results
diff --git a/README.chromium b/README.chromium
deleted file mode 100644
index 246c13d..0000000
--- a/README.chromium
+++ /dev/null
@@ -1,13 +0,0 @@
-Name: WebRTC
-URL: http://www.webrtc.org
-Version: 90
-License: BSD
-License File: LICENSE
-
-Description:
-WebRTC provides real time voice and video processing
-functionality to enable the implementation of
-PeerConnection/MediaStream.
-
-Third party code used in this project is described
-in the file LICENSE_THIRD_PARTY.
diff --git a/api/BUILD.gn b/api/BUILD.gn
deleted file mode 100644
index 86a63e4..0000000
--- a/api/BUILD.gn
+++ /dev/null
@@ -1,302 +0,0 @@
-# Copyright (c) 2015 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-group("api") {
- public_deps = [
- ":libjingle_peerconnection_api",
- ]
-}
-
-rtc_source_set("call_api") {
- sources = [
- "call/audio_sink.h",
- ]
-
- deps = [
- # TODO(kjellander): Add remaining dependencies when webrtc:4243 is done.
- ":audio_mixer_api",
- ":transport_api",
- "..:webrtc_common",
- "../rtc_base:rtc_base_approved",
- "audio_codecs:audio_codecs_api",
- ]
-}
-
-rtc_static_library("libjingle_peerconnection_api") {
- # Cannot have GN check enabled since that would introduce dependency cycles
- # TODO(kjellander): Remove (bugs.webrtc.org/7504)
- check_includes = false
- cflags = []
- sources = [
- "datachannel.h",
- "datachannelinterface.h",
- "dtmfsenderinterface.h",
- "jsep.h",
- "jsepicecandidate.h",
- "jsepsessiondescription.h",
- "mediaconstraintsinterface.cc",
- "mediaconstraintsinterface.h",
- "mediastream.h",
- "mediastreaminterface.cc",
- "mediastreaminterface.h",
- "mediastreamproxy.h",
- "mediastreamtrack.h",
- "mediastreamtrackproxy.h",
- "mediatypes.cc",
- "mediatypes.h",
- "notifier.h",
- "peerconnectionfactoryproxy.h",
- "peerconnectioninterface.h",
- "peerconnectionproxy.h",
- "proxy.h",
- "rtcerror.cc",
- "rtcerror.h",
- "rtpparameters.cc",
- "rtpparameters.h",
- "rtpreceiverinterface.h",
- "rtpsender.h",
- "rtpsenderinterface.h",
- "statstypes.cc",
- "statstypes.h",
- "streamcollection.h",
- "umametrics.h",
- "videosourceproxy.h",
- "videotracksource.h",
- "webrtcsdp.h",
- ]
-
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-
- deps = [
- ":rtc_stats_api",
- "..:webrtc_common",
- "../rtc_base:rtc_base",
- "../rtc_base:rtc_base_approved",
- "audio_codecs:audio_codecs_api",
- ]
-
- # This is needed until bugs.webrtc.org/7504 is removed so this target can
- # properly depend on ../media:rtc_media_base
- # TODO(kjellander): Remove this dependency.
- if (is_nacl) {
- deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
- }
-}
-
-rtc_source_set("ortc_api") {
- check_includes = false # TODO(deadbeef): Remove (bugs.webrtc.org/6828)
- sources = [
- "ortc/mediadescription.cc",
- "ortc/mediadescription.h",
- "ortc/ortcfactoryinterface.h",
- "ortc/ortcrtpreceiverinterface.h",
- "ortc/ortcrtpsenderinterface.h",
- "ortc/packettransportinterface.h",
- "ortc/rtptransportcontrollerinterface.h",
- "ortc/rtptransportinterface.h",
- "ortc/sessiondescription.cc",
- "ortc/sessiondescription.h",
- "ortc/srtptransportinterface.h",
- "ortc/udptransportinterface.h",
- ]
-
- # For mediastreaminterface.h, etc.
- # TODO(deadbeef): Create a separate target for the common things ORTC and
- # PeerConnection code shares, so that ortc_api can depend on that instead of
- # libjingle_peerconnection_api.
- public_deps = [
- ":libjingle_peerconnection_api",
- ]
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-}
-
-# TODO(ossu): Remove once downstream projects have updated.
-rtc_source_set("libjingle_peerconnection") {
- public_deps = [
- "../pc:libjingle_peerconnection",
- ]
-}
-
-rtc_source_set("rtc_stats_api") {
- cflags = []
- sources = [
- "stats/rtcstats.h",
- "stats/rtcstats_objects.h",
- "stats/rtcstatscollectorcallback.h",
- "stats/rtcstatsreport.h",
- ]
-
- deps = [
- "../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_source_set("audio_mixer_api") {
- sources = [
- "audio/audio_mixer.h",
- ]
-
- deps = [
- "../modules:module_api",
- "../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_source_set("transport_api") {
- sources = [
- "call/transport.h",
- ]
-}
-
-rtc_source_set("video_frame_api") {
- sources = [
- "video/i420_buffer.cc",
- "video/i420_buffer.h",
- "video/video_content_type.cc",
- "video/video_content_type.h",
- "video/video_frame.cc",
- "video/video_frame.h",
- "video/video_frame_buffer.cc",
- "video/video_frame_buffer.h",
- "video/video_rotation.h",
- "video/video_timing.cc",
- "video/video_timing.h",
- ]
-
- deps = [
- "../rtc_base:rtc_base_approved",
- "../system_wrappers",
- ]
-
- # TODO(nisse): This logic is duplicated in multiple places.
- # Define in a single place.
- if (rtc_build_libyuv) {
- deps += [ "$rtc_libyuv_dir" ]
- public_deps = [
- "$rtc_libyuv_dir",
- ]
- } else {
- # Need to add a directory normally exported by libyuv.
- include_dirs = [ "$rtc_libyuv_dir/include" ]
- }
-}
-
-rtc_source_set("array_view") {
- sources = [
- "array_view.h",
- ]
- deps = [
- "../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_source_set("optional") {
- sources = [
- "optional.cc",
- "optional.h",
- ]
- deps = [
- ":array_view",
- "../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_source_set("libjingle_peerconnection_test_api") {
- testonly = true
- sources = [
- "test/fakeconstraints.h",
- ]
-
- public_deps = [
- ":libjingle_peerconnection_api",
- ]
-
- deps = [
- "../rtc_base:rtc_base_approved",
- ]
-}
-
-if (rtc_include_tests) {
- rtc_source_set("mock_audio_mixer") {
- testonly = true
- sources = [
- "test/mock_audio_mixer.h",
- ]
-
- public_deps = [
- ":audio_mixer_api",
- ]
-
- deps = [
- "../test:test_support",
- "//testing/gmock",
- ]
- }
-
- rtc_source_set("fakemetricsobserver") {
- testonly = true
- sources = [
- "fakemetricsobserver.cc",
- "fakemetricsobserver.h",
- ]
- deps = [
- ":libjingle_peerconnection_api",
- "../rtc_base:rtc_base_approved",
- ]
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
- }
-
- rtc_source_set("rtc_api_unittests") {
- testonly = true
-
- # Skip restricting visibility on mobile platforms since the tests on those
- # gets additional generated targets which would require many lines here to
- # cover (which would be confusing to read and hard to maintain).
- if (!is_android && !is_ios) {
- visibility = [ "..:rtc_unittests" ]
- }
- sources = [
- "array_view_unittest.cc",
- "optional_unittest.cc",
- "ortc/mediadescription_unittest.cc",
- "ortc/sessiondescription_unittest.cc",
- "rtcerror_unittest.cc",
- "rtpparameters_unittest.cc",
- ]
-
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-
- deps = [
- ":array_view",
- ":libjingle_peerconnection_api",
- ":optional",
- ":ortc_api",
- "../rtc_base:rtc_base_approved",
- "../rtc_base:rtc_base_tests_utils",
- "../test:test_support",
- ]
- }
-}
diff --git a/api/DEPS b/api/DEPS
deleted file mode 100644
index fad1d84..0000000
--- a/api/DEPS
+++ /dev/null
@@ -1,41 +0,0 @@
-include_rules = [
- "+third_party/libyuv",
- "+webrtc/common_video",
- "+webrtc/media",
- "+webrtc/p2p",
- "+webrtc/pc",
-]
-
-specific_include_rules = {
- "peerconnection_jni\.cc": [
- "+webrtc/voice_engine",
- ],
-
- # TODO(ossu): Remove this exception when {builtin_,}audio_encoder_factory.h
- # has moved to api/.
- "peerconnectioninterface\.h": [
- "+webrtc/call/callfactoryinterface.h",
- "+webrtc/logging/rtc_event_log/rtc_event_log_factory_interface.h",
- "+webrtc/modules/audio_coding/codecs/audio_encoder_factory.h",
- "+webrtc/modules/audio_coding/codecs/builtin_audio_encoder_factory.h",
- ],
-
- # Needed because AudioEncoderOpus is in the wrong place for
- # backwards compatibilty reasons. See
- # https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
- "audio_encoder_opus\.h": [
- "+webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h",
- ],
-
- # We allow .cc files in webrtc/api/ to #include a bunch of stuff
- # that's off-limits for the .h files. That's because .h files leak
- # their #includes to whoever's #including them, but .cc files do not
- # since no one #includes them.
- ".*\.cc": [
- "+webrtc/modules/audio_coding",
- ],
-
- ".*i420_buffer\.h": [
- "+webrtc/system_wrappers/include/aligned_malloc.h",
- ],
-}
diff --git a/api/OWNERS b/api/OWNERS
deleted file mode 100644
index e00e7d2..0000000
--- a/api/OWNERS
+++ /dev/null
@@ -1,12 +0,0 @@
-pthatcher@webrtc.org
-glaznev@webrtc.org
-juberti@webrtc.org
-perkj@webrtc.org
-solenberg@webrtc.org
-tkchin@webrtc.org
-tommi@webrtc.org
-deadbeef@webrtc.org
-kwiberg@webrtc.org
-
-per-file *.gn=kjellander@webrtc.org
-per-file *.gni=kjellander@webrtc.org
diff --git a/api/array_view.h b/api/array_view.h
deleted file mode 100644
index c97d388..0000000
--- a/api/array_view.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright 2015 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 WEBRTC_API_ARRAY_VIEW_H_
-#define WEBRTC_API_ARRAY_VIEW_H_
-
-#include <algorithm>
-#include <type_traits>
-
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/type_traits.h"
-
-namespace rtc {
-
-// tl;dr: rtc::ArrayView is the same thing as gsl::span from the Guideline
-// Support Library.
-//
-// Many functions read from or write to arrays. The obvious way to do this is
-// to use two arguments, a pointer to the first element and an element count:
-//
-// bool Contains17(const int* arr, size_t size) {
-// for (size_t i = 0; i < size; ++i) {
-// if (arr[i] == 17)
-// return true;
-// }
-// return false;
-// }
-//
-// This is flexible, since it doesn't matter how the array is stored (C array,
-// std::vector, rtc::Buffer, ...), but it's error-prone because the caller has
-// to correctly specify the array length:
-//
-// Contains17(arr, arraysize(arr)); // C array
-// Contains17(arr.data(), arr.size()); // std::vector
-// Contains17(arr, size); // pointer + size
-// ...
-//
-// It's also kind of messy to have two separate arguments for what is
-// conceptually a single thing.
-//
-// Enter rtc::ArrayView<T>. It contains a T pointer (to an array it doesn't
-// own) and a count, and supports the basic things you'd expect, such as
-// indexing and iteration. It allows us to write our function like this:
-//
-// bool Contains17(rtc::ArrayView<const int> arr) {
-// for (auto e : arr) {
-// if (e == 17)
-// return true;
-// }
-// return false;
-// }
-//
-// And even better, because a bunch of things will implicitly convert to
-// ArrayView, we can call it like this:
-//
-// Contains17(arr); // C array
-// Contains17(arr); // std::vector
-// Contains17(rtc::ArrayView<int>(arr, size)); // pointer + size
-// Contains17(nullptr); // nullptr -> empty ArrayView
-// ...
-//
-// ArrayView<T> stores both a pointer and a size, but you may also use
-// ArrayView<T, N>, which has a size that's fixed at compile time (which means
-// it only has to store the pointer).
-//
-// One important point is that ArrayView<T> and ArrayView<const T> are
-// different types, which allow and don't allow mutation of the array elements,
-// respectively. The implicit conversions work just like you'd hope, so that
-// e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const
-// int>, but const vector<int> will convert only to ArrayView<const int>.
-// (ArrayView itself can be the source type in such conversions, so
-// ArrayView<int> will convert to ArrayView<const int>.)
-//
-// Note: ArrayView is tiny (just a pointer and a count if variable-sized, just
-// a pointer if fix-sized) and trivially copyable, so it's probably cheaper to
-// pass it by value than by const reference.
-
-namespace impl {
-
-// Magic constant for indicating that the size of an ArrayView is variable
-// instead of fixed.
-enum : std::ptrdiff_t { kArrayViewVarSize = -4711 };
-
-// Base class for ArrayViews of fixed nonzero size.
-template <typename T, std::ptrdiff_t Size>
-class ArrayViewBase {
- static_assert(Size > 0, "ArrayView size must be variable or non-negative");
-
- public:
- ArrayViewBase(T* data, size_t size) : data_(data) {}
-
- static constexpr size_t size() { return Size; }
- static constexpr bool empty() { return false; }
- T* data() const { return data_; }
-
- protected:
- static constexpr bool fixed_size() { return true; }
-
- private:
- T* data_;
-};
-
-// Specialized base class for ArrayViews of fixed zero size.
-template <typename T>
-class ArrayViewBase<T, 0> {
- public:
- explicit ArrayViewBase(T* data, size_t size) {}
-
- static constexpr size_t size() { return 0; }
- static constexpr bool empty() { return true; }
- T* data() const { return nullptr; }
-
- protected:
- static constexpr bool fixed_size() { return true; }
-};
-
-// Specialized base class for ArrayViews of variable size.
-template <typename T>
-class ArrayViewBase<T, impl::kArrayViewVarSize> {
- public:
- ArrayViewBase(T* data, size_t size)
- : data_(size == 0 ? nullptr : data), size_(size) {}
-
- size_t size() const { return size_; }
- bool empty() const { return size_ == 0; }
- T* data() const { return data_; }
-
- protected:
- static constexpr bool fixed_size() { return false; }
-
- private:
- T* data_;
- size_t size_;
-};
-
-} // namespace impl
-
-template <typename T, std::ptrdiff_t Size = impl::kArrayViewVarSize>
-class ArrayView final : public impl::ArrayViewBase<T, Size> {
- public:
- using value_type = T;
- using const_iterator = const T*;
-
- // Construct an ArrayView from a pointer and a length.
- template <typename U>
- ArrayView(U* data, size_t size)
- : impl::ArrayViewBase<T, Size>::ArrayViewBase(data, size) {
- RTC_DCHECK_EQ(size == 0 ? nullptr : data, this->data());
- RTC_DCHECK_EQ(size, this->size());
- RTC_DCHECK_EQ(!this->data(),
- this->size() == 0); // data is null iff size == 0.
- }
-
- // Construct an empty ArrayView. Note that fixed-size ArrayViews of size > 0
- // cannot be empty.
- ArrayView() : ArrayView(nullptr, 0) {}
- ArrayView(std::nullptr_t) // NOLINT
- : ArrayView() {}
- ArrayView(std::nullptr_t, size_t size)
- : ArrayView(static_cast<T*>(nullptr), size) {
- static_assert(Size == 0 || Size == impl::kArrayViewVarSize, "");
- RTC_DCHECK_EQ(0, size);
- }
-
- // Construct an ArrayView from an array.
- template <typename U, size_t N>
- ArrayView(U (&array)[N]) // NOLINT
- : ArrayView(array, N) {
- static_assert(Size == N || Size == impl::kArrayViewVarSize,
- "Array size must match ArrayView size");
- }
-
- // (Only if size is fixed.) Construct an ArrayView from any type U that has a
- // static constexpr size() method whose return value is equal to Size, and a
- // data() method whose return value converts implicitly to T*. In particular,
- // this means we allow conversion from ArrayView<T, N> to ArrayView<const T,
- // N>, but not the other way around. We also don't allow conversion from
- // ArrayView<T> to ArrayView<T, N>, or from ArrayView<T, M> to ArrayView<T,
- // N> when M != N.
- template <
- typename U,
- typename std::enable_if<Size != impl::kArrayViewVarSize &&
- HasDataAndSize<U, T>::value>::type* = nullptr>
- ArrayView(U& u) // NOLINT
- : ArrayView(u.data(), u.size()) {
- static_assert(U::size() == Size, "Sizes must match exactly");
- }
-
- // (Only if size is variable.) Construct an ArrayView from any type U that
- // has a size() method whose return value converts implicitly to size_t, and
- // a data() method whose return value converts implicitly to T*. In
- // particular, this means we allow conversion from ArrayView<T> to
- // ArrayView<const T>, but not the other way around. Other allowed
- // conversions include
- // ArrayView<T, N> to ArrayView<T> or ArrayView<const T>,
- // std::vector<T> to ArrayView<T> or ArrayView<const T>,
- // const std::vector<T> to ArrayView<const T>,
- // rtc::Buffer to ArrayView<uint8_t> or ArrayView<const uint8_t>, and
- // const rtc::Buffer to ArrayView<const uint8_t>.
- template <
- typename U,
- typename std::enable_if<Size == impl::kArrayViewVarSize &&
- HasDataAndSize<U, T>::value>::type* = nullptr>
- ArrayView(U& u) // NOLINT
- : ArrayView(u.data(), u.size()) {}
-
- // Indexing and iteration. These allow mutation even if the ArrayView is
- // const, because the ArrayView doesn't own the array. (To prevent mutation,
- // use a const element type.)
- T& operator[](size_t idx) const {
- RTC_DCHECK_LT(idx, this->size());
- RTC_DCHECK(this->data());
- return this->data()[idx];
- }
- T* begin() const { return this->data(); }
- T* end() const { return this->data() + this->size(); }
- const T* cbegin() const { return this->data(); }
- const T* cend() const { return this->data() + this->size(); }
-
- ArrayView<T> subview(size_t offset, size_t size) const {
- return offset < this->size()
- ? ArrayView<T>(this->data() + offset,
- std::min(size, this->size() - offset))
- : ArrayView<T>();
- }
- ArrayView<T> subview(size_t offset) const {
- return subview(offset, this->size());
- }
-};
-
-// Comparing two ArrayViews compares their (pointer,size) pairs; it does *not*
-// dereference the pointers.
-template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
-bool operator==(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
- return a.data() == b.data() && a.size() == b.size();
-}
-template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
-bool operator!=(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
- return !(a == b);
-}
-
-// Variable-size ArrayViews are the size of two pointers; fixed-size ArrayViews
-// are the size of one pointer. (And as a special case, fixed-size ArrayViews
-// of size 0 require no storage.)
-static_assert(sizeof(ArrayView<int>) == 2 * sizeof(int*), "");
-static_assert(sizeof(ArrayView<int, 17>) == sizeof(int*), "");
-static_assert(std::is_empty<ArrayView<int, 0>>::value, "");
-
-template <typename T>
-inline ArrayView<T> MakeArrayView(T* data, size_t size) {
- return ArrayView<T>(data, size);
-}
-
-} // namespace rtc
-
-#endif // WEBRTC_API_ARRAY_VIEW_H_
diff --git a/api/array_view_unittest.cc b/api/array_view_unittest.cc
deleted file mode 100644
index b19abc1..0000000
--- a/api/array_view_unittest.cc
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * Copyright 2015 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 <algorithm>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "webrtc/api/array_view.h"
-#include "webrtc/rtc_base/buffer.h"
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/gunit.h"
-#include "webrtc/test/gmock.h"
-
-namespace rtc {
-
-namespace {
-
-using ::testing::ElementsAre;
-using ::testing::IsEmpty;
-
-template <typename T>
-void Call(ArrayView<T>) {}
-
-} // namespace
-
-TEST(ArrayViewTest, TestConstructFromPtrAndArray) {
- char arr[] = "Arrr!";
- const char carr[] = "Carrr!";
- Call<const char>(arr);
- Call<const char>(carr);
- Call<char>(arr);
- // Call<char>(carr); // Compile error, because can't drop const.
- // Call<int>(arr); // Compile error, because incompatible types.
- ArrayView<int*> x;
- EXPECT_EQ(0u, x.size());
- EXPECT_EQ(nullptr, x.data());
- ArrayView<char> y = arr;
- EXPECT_EQ(6u, y.size());
- EXPECT_EQ(arr, y.data());
- ArrayView<char, 6> yf = arr;
- static_assert(yf.size() == 6, "");
- EXPECT_EQ(arr, yf.data());
- ArrayView<const char> z(arr + 1, 3);
- EXPECT_EQ(3u, z.size());
- EXPECT_EQ(arr + 1, z.data());
- ArrayView<const char, 3> zf(arr + 1, 3);
- static_assert(zf.size() == 3, "");
- EXPECT_EQ(arr + 1, zf.data());
- ArrayView<const char> w(arr, 2);
- EXPECT_EQ(2u, w.size());
- EXPECT_EQ(arr, w.data());
- ArrayView<const char, 2> wf(arr, 2);
- static_assert(wf.size() == 2, "");
- EXPECT_EQ(arr, wf.data());
- ArrayView<char> q(arr, 0);
- EXPECT_EQ(0u, q.size());
- EXPECT_EQ(nullptr, q.data());
- ArrayView<char, 0> qf(arr, 0);
- static_assert(qf.size() == 0, "");
- EXPECT_EQ(nullptr, qf.data());
-#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
- // DCHECK error (nullptr with nonzero size).
- EXPECT_DEATH(ArrayView<int>(static_cast<int*>(nullptr), 5), "");
-#endif
- // These are compile errors, because incompatible types.
- // ArrayView<int> m = arr;
- // ArrayView<float> n(arr + 2, 2);
-}
-
-TEST(ArrayViewTest, TestCopyConstructorVariable) {
- char arr[] = "Arrr!";
- ArrayView<char> x = arr;
- EXPECT_EQ(6u, x.size());
- EXPECT_EQ(arr, x.data());
- ArrayView<char> y = x; // Copy non-const -> non-const.
- EXPECT_EQ(6u, y.size());
- EXPECT_EQ(arr, y.data());
- ArrayView<const char> z = x; // Copy non-const -> const.
- EXPECT_EQ(6u, z.size());
- EXPECT_EQ(arr, z.data());
- ArrayView<const char> w = z; // Copy const -> const.
- EXPECT_EQ(6u, w.size());
- EXPECT_EQ(arr, w.data());
- // ArrayView<char> v = z; // Compile error, because can't drop const.
-}
-
-TEST(ArrayViewTest, TestCopyConstructorFixed) {
- char arr[] = "Arrr!";
- ArrayView<char, 6> x = arr;
- static_assert(x.size() == 6, "");
- EXPECT_EQ(arr, x.data());
-
- // Copy fixed -> fixed.
- ArrayView<char, 6> y = x; // Copy non-const -> non-const.
- static_assert(y.size() == 6, "");
- EXPECT_EQ(arr, y.data());
- ArrayView<const char, 6> z = x; // Copy non-const -> const.
- static_assert(z.size() == 6, "");
- EXPECT_EQ(arr, z.data());
- ArrayView<const char, 6> w = z; // Copy const -> const.
- static_assert(w.size() == 6, "");
- EXPECT_EQ(arr, w.data());
- // ArrayView<char, 6> v = z; // Compile error, because can't drop const.
-
- // Copy fixed -> variable.
- ArrayView<char> yv = x; // Copy non-const -> non-const.
- EXPECT_EQ(6u, yv.size());
- EXPECT_EQ(arr, yv.data());
- ArrayView<const char> zv = x; // Copy non-const -> const.
- EXPECT_EQ(6u, zv.size());
- EXPECT_EQ(arr, zv.data());
- ArrayView<const char> wv = z; // Copy const -> const.
- EXPECT_EQ(6u, wv.size());
- EXPECT_EQ(arr, wv.data());
- // ArrayView<char> vv = z; // Compile error, because can't drop const.
-}
-
-TEST(ArrayViewTest, TestCopyAssignmentVariable) {
- char arr[] = "Arrr!";
- ArrayView<char> x(arr);
- EXPECT_EQ(6u, x.size());
- EXPECT_EQ(arr, x.data());
- ArrayView<char> y;
- y = x; // Copy non-const -> non-const.
- EXPECT_EQ(6u, y.size());
- EXPECT_EQ(arr, y.data());
- ArrayView<const char> z;
- z = x; // Copy non-const -> const.
- EXPECT_EQ(6u, z.size());
- EXPECT_EQ(arr, z.data());
- ArrayView<const char> w;
- w = z; // Copy const -> const.
- EXPECT_EQ(6u, w.size());
- EXPECT_EQ(arr, w.data());
- // ArrayView<char> v;
- // v = z; // Compile error, because can't drop const.
-}
-
-TEST(ArrayViewTest, TestCopyAssignmentFixed) {
- char arr[] = "Arrr!";
- char init[] = "Init!";
- ArrayView<char, 6> x(arr);
- EXPECT_EQ(arr, x.data());
-
- // Copy fixed -> fixed.
- ArrayView<char, 6> y(init);
- y = x; // Copy non-const -> non-const.
- EXPECT_EQ(arr, y.data());
- ArrayView<const char, 6> z(init);
- z = x; // Copy non-const -> const.
- EXPECT_EQ(arr, z.data());
- ArrayView<const char, 6> w(init);
- w = z; // Copy const -> const.
- EXPECT_EQ(arr, w.data());
- // ArrayView<char, 6> v(init);
- // v = z; // Compile error, because can't drop const.
-
- // Copy fixed -> variable.
- ArrayView<char> yv;
- yv = x; // Copy non-const -> non-const.
- EXPECT_EQ(6u, yv.size());
- EXPECT_EQ(arr, yv.data());
- ArrayView<const char> zv;
- zv = x; // Copy non-const -> const.
- EXPECT_EQ(6u, zv.size());
- EXPECT_EQ(arr, zv.data());
- ArrayView<const char> wv;
- wv = z; // Copy const -> const.
- EXPECT_EQ(6u, wv.size());
- EXPECT_EQ(arr, wv.data());
- // ArrayView<char> v;
- // v = z; // Compile error, because can't drop const.
-}
-
-TEST(ArrayViewTest, TestStdVector) {
- std::vector<int> v;
- v.push_back(3);
- v.push_back(11);
- Call<const int>(v);
- Call<int>(v);
- // Call<unsigned int>(v); // Compile error, because incompatible types.
- ArrayView<int> x = v;
- EXPECT_EQ(2u, x.size());
- EXPECT_EQ(v.data(), x.data());
- ArrayView<const int> y;
- y = v;
- EXPECT_EQ(2u, y.size());
- EXPECT_EQ(v.data(), y.data());
- // ArrayView<double> d = v; // Compile error, because incompatible types.
- const std::vector<int> cv;
- Call<const int>(cv);
- // Call<int>(cv); // Compile error, because can't drop const.
- ArrayView<const int> z = cv;
- EXPECT_EQ(0u, z.size());
- EXPECT_EQ(nullptr, z.data());
- // ArrayView<int> w = cv; // Compile error, because can't drop const.
-}
-
-TEST(ArrayViewTest, TestRtcBuffer) {
- rtc::Buffer b = "so buffer";
- Call<const uint8_t>(b);
- Call<uint8_t>(b);
- // Call<int8_t>(b); // Compile error, because incompatible types.
- ArrayView<uint8_t> x = b;
- EXPECT_EQ(10u, x.size());
- EXPECT_EQ(b.data(), x.data());
- ArrayView<const uint8_t> y;
- y = b;
- EXPECT_EQ(10u, y.size());
- EXPECT_EQ(b.data(), y.data());
- // ArrayView<char> d = b; // Compile error, because incompatible types.
- const rtc::Buffer cb = "very const";
- Call<const uint8_t>(cb);
- // Call<uint8_t>(cb); // Compile error, because can't drop const.
- ArrayView<const uint8_t> z = cb;
- EXPECT_EQ(11u, z.size());
- EXPECT_EQ(cb.data(), z.data());
- // ArrayView<uint8_t> w = cb; // Compile error, because can't drop const.
-}
-
-TEST(ArrayViewTest, TestSwapVariable) {
- const char arr[] = "Arrr!";
- const char aye[] = "Aye, Cap'n!";
- ArrayView<const char> x(arr);
- EXPECT_EQ(6u, x.size());
- EXPECT_EQ(arr, x.data());
- ArrayView<const char> y(aye);
- EXPECT_EQ(12u, y.size());
- EXPECT_EQ(aye, y.data());
- using std::swap;
- swap(x, y);
- EXPECT_EQ(12u, x.size());
- EXPECT_EQ(aye, x.data());
- EXPECT_EQ(6u, y.size());
- EXPECT_EQ(arr, y.data());
- // ArrayView<char> z;
- // swap(x, z); // Compile error, because can't drop const.
-}
-
-TEST(FixArrayViewTest, TestSwapFixed) {
- const char arr[] = "Arr!";
- char aye[] = "Aye!";
- ArrayView<const char, 5> x(arr);
- EXPECT_EQ(arr, x.data());
- ArrayView<const char, 5> y(aye);
- EXPECT_EQ(aye, y.data());
- using std::swap;
- swap(x, y);
- EXPECT_EQ(aye, x.data());
- EXPECT_EQ(arr, y.data());
- // ArrayView<char, 5> z(aye);
- // swap(x, z); // Compile error, because can't drop const.
- // ArrayView<const char, 4> w(aye, 4);
- // swap(x, w); // Compile error, because different sizes.
-}
-
-TEST(ArrayViewTest, TestIndexing) {
- char arr[] = "abcdefg";
- ArrayView<char> x(arr);
- const ArrayView<char> y(arr);
- ArrayView<const char, 8> z(arr);
- EXPECT_EQ(8u, x.size());
- EXPECT_EQ(8u, y.size());
- EXPECT_EQ(8u, z.size());
- EXPECT_EQ('b', x[1]);
- EXPECT_EQ('c', y[2]);
- EXPECT_EQ('d', z[3]);
- x[3] = 'X';
- y[2] = 'Y';
- // z[1] = 'Z'; // Compile error, because z's element type is const char.
- EXPECT_EQ('b', x[1]);
- EXPECT_EQ('Y', y[2]);
- EXPECT_EQ('X', z[3]);
-#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
- EXPECT_DEATH(z[8], ""); // DCHECK error (index out of bounds).
-#endif
-}
-
-TEST(ArrayViewTest, TestIterationEmpty) {
- // Variable-size.
- ArrayView<std::vector<std::vector<std::vector<std::string>>>> av;
- EXPECT_EQ(av.begin(), av.end());
- EXPECT_EQ(av.cbegin(), av.cend());
- for (auto& e : av) {
- EXPECT_TRUE(false);
- EXPECT_EQ(42u, e.size()); // Dummy use of e to prevent unused var warning.
- }
-
- // Fixed-size.
- ArrayView<std::vector<std::vector<std::vector<std::string>>>, 0> af;
- EXPECT_EQ(af.begin(), af.end());
- EXPECT_EQ(af.cbegin(), af.cend());
- for (auto& e : af) {
- EXPECT_TRUE(false);
- EXPECT_EQ(42u, e.size()); // Dummy use of e to prevent unused var warning.
- }
-}
-
-TEST(ArrayViewTest, TestIterationVariable) {
- char arr[] = "Arrr!";
- ArrayView<char> av(arr);
- EXPECT_EQ('A', *av.begin());
- EXPECT_EQ('A', *av.cbegin());
- EXPECT_EQ('\0', *(av.end() - 1));
- EXPECT_EQ('\0', *(av.cend() - 1));
- char i = 0;
- for (auto& e : av) {
- EXPECT_EQ(arr + i, &e);
- e = 's' + i;
- ++i;
- }
- i = 0;
- for (auto& e : ArrayView<const char>(av)) {
- EXPECT_EQ(arr + i, &e);
- // e = 'q' + i; // Compile error, because e is a const char&.
- ++i;
- }
-}
-
-TEST(ArrayViewTest, TestIterationFixed) {
- char arr[] = "Arrr!";
- ArrayView<char, 6> av(arr);
- EXPECT_EQ('A', *av.begin());
- EXPECT_EQ('A', *av.cbegin());
- EXPECT_EQ('\0', *(av.end() - 1));
- EXPECT_EQ('\0', *(av.cend() - 1));
- char i = 0;
- for (auto& e : av) {
- EXPECT_EQ(arr + i, &e);
- e = 's' + i;
- ++i;
- }
- i = 0;
- for (auto& e : ArrayView<const char, 6>(av)) {
- EXPECT_EQ(arr + i, &e);
- // e = 'q' + i; // Compile error, because e is a const char&.
- ++i;
- }
-}
-
-TEST(ArrayViewTest, TestEmpty) {
- EXPECT_TRUE(ArrayView<int>().empty());
- const int a[] = {1, 2, 3};
- EXPECT_FALSE(ArrayView<const int>(a).empty());
-
- static_assert(ArrayView<int, 0>::empty(), "");
- static_assert(!ArrayView<int, 3>::empty(), "");
-}
-
-TEST(ArrayViewTest, TestCompare) {
- int a[] = {1, 2, 3};
- int b[] = {1, 2, 3};
-
- EXPECT_EQ(ArrayView<int>(a), ArrayView<int>(a));
- EXPECT_EQ((ArrayView<int, 3>(a)), (ArrayView<int, 3>(a)));
- EXPECT_EQ(ArrayView<int>(a), (ArrayView<int, 3>(a)));
- EXPECT_EQ(ArrayView<int>(), ArrayView<int>());
- EXPECT_EQ(ArrayView<int>(), ArrayView<int>(a, 0));
- EXPECT_EQ(ArrayView<int>(a, 0), ArrayView<int>(b, 0));
- EXPECT_EQ((ArrayView<int, 0>(a, 0)), ArrayView<int>());
-
- EXPECT_NE(ArrayView<int>(a), ArrayView<int>(b));
- EXPECT_NE((ArrayView<int, 3>(a)), (ArrayView<int, 3>(b)));
- EXPECT_NE((ArrayView<int, 3>(a)), ArrayView<int>(b));
- EXPECT_NE(ArrayView<int>(a), ArrayView<int>());
- EXPECT_NE(ArrayView<int>(a), ArrayView<int>(a, 2));
- EXPECT_NE((ArrayView<int, 3>(a)), (ArrayView<int, 2>(a, 2)));
-}
-
-TEST(ArrayViewTest, TestSubViewVariable) {
- int a[] = {1, 2, 3};
- ArrayView<int> av(a);
-
- EXPECT_EQ(av.subview(0), av);
-
- EXPECT_THAT(av.subview(1), ElementsAre(2, 3));
- EXPECT_THAT(av.subview(2), ElementsAre(3));
- EXPECT_THAT(av.subview(3), IsEmpty());
- EXPECT_THAT(av.subview(4), IsEmpty());
-
- EXPECT_THAT(av.subview(1, 0), IsEmpty());
- EXPECT_THAT(av.subview(1, 1), ElementsAre(2));
- EXPECT_THAT(av.subview(1, 2), ElementsAre(2, 3));
- EXPECT_THAT(av.subview(1, 3), ElementsAre(2, 3));
-}
-
-TEST(ArrayViewTest, TestSubViewFixed) {
- int a[] = {1, 2, 3};
- ArrayView<int, 3> av(a);
-
- EXPECT_EQ(av.subview(0), av);
-
- EXPECT_THAT(av.subview(1), ElementsAre(2, 3));
- EXPECT_THAT(av.subview(2), ElementsAre(3));
- EXPECT_THAT(av.subview(3), IsEmpty());
- EXPECT_THAT(av.subview(4), IsEmpty());
-
- EXPECT_THAT(av.subview(1, 0), IsEmpty());
- EXPECT_THAT(av.subview(1, 1), ElementsAre(2));
- EXPECT_THAT(av.subview(1, 2), ElementsAre(2, 3));
- EXPECT_THAT(av.subview(1, 3), ElementsAre(2, 3));
-}
-
-} // namespace rtc
diff --git a/api/audio/audio_mixer.h b/api/audio/audio_mixer.h
deleted file mode 100644
index d1abf9a..0000000
--- a/api/audio/audio_mixer.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2011 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 WEBRTC_API_AUDIO_AUDIO_MIXER_H_
-#define WEBRTC_API_AUDIO_AUDIO_MIXER_H_
-
-#include <memory>
-
-#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/rtc_base/refcount.h"
-
-namespace webrtc {
-
-// WORK IN PROGRESS
-// This class is under development and is not yet intended for for use outside
-// of WebRtc/Libjingle.
-class AudioMixer : public rtc::RefCountInterface {
- public:
- // A callback class that all mixer participants must inherit from/implement.
- class Source {
- public:
- enum class AudioFrameInfo {
- kNormal, // The samples in audio_frame are valid and should be used.
- kMuted, // The samples in audio_frame should not be used, but
- // should be implicitly interpreted as zero. Other
- // fields in audio_frame may be read and should
- // contain meaningful values.
- kError, // The audio_frame will not be used.
- };
-
- // Overwrites |audio_frame|. The data_ field is overwritten with
- // 10 ms of new audio (either 1 or 2 interleaved channels) at
- // |sample_rate_hz|. All fields in |audio_frame| must be updated.
- virtual AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz,
- AudioFrame* audio_frame) = 0;
-
- // A way for a mixer implementation to distinguish participants.
- virtual int Ssrc() const = 0;
-
- // A way for this source to say that GetAudioFrameWithInfo called
- // with this sample rate or higher will not cause quality loss.
- virtual int PreferredSampleRate() const = 0;
-
- virtual ~Source() {}
- };
-
- // Returns true if adding was successful. A source is never added
- // twice. Addition and removal can happen on different threads.
- virtual bool AddSource(Source* audio_source) = 0;
-
- // Removal is never attempted if a source has not been successfully
- // added to the mixer.
- virtual void RemoveSource(Source* audio_source) = 0;
-
- // Performs mixing by asking registered audio sources for audio. The
- // mixed result is placed in the provided AudioFrame. This method
- // will only be called from a single thread. The channels argument
- // specifies the number of channels of the mix result. The mixer
- // should mix at a rate that doesn't cause quality loss of the
- // sources' audio. The mixing rate is one of the rates listed in
- // AudioProcessing::NativeRate. All fields in
- // |audio_frame_for_mixing| must be updated.
- virtual void Mix(size_t number_of_channels,
- AudioFrame* audio_frame_for_mixing) = 0;
-
- protected:
- // Since the mixer is reference counted, the destructor may be
- // called from any thread.
- ~AudioMixer() override {}
-};
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn
deleted file mode 100644
index 04a5238..0000000
--- a/api/audio_codecs/BUILD.gn
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_source_set("audio_codecs_api") {
- sources = [
- "audio_decoder.cc",
- "audio_decoder.h",
- "audio_decoder_factory.h",
- "audio_decoder_factory_template.h",
- "audio_encoder.cc",
- "audio_encoder.h",
- "audio_encoder_factory.h",
- "audio_encoder_factory_template.h",
- "audio_format.cc",
- "audio_format.h",
- ]
- deps = [
- "..:array_view",
- "..:optional",
- "../..:webrtc_common",
- "../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("builtin_audio_decoder_factory") {
- sources = [
- "builtin_audio_decoder_factory.cc",
- "builtin_audio_decoder_factory.h",
- ]
- deps = [
- ":audio_codecs_api",
- "../../rtc_base:rtc_base_approved",
- "L16:audio_decoder_L16",
- "g711:audio_decoder_g711",
- ]
- defines = []
- if (rtc_include_ilbc) {
- deps += [ "ilbc:audio_decoder_ilbc" ]
- defines += [ "WEBRTC_USE_BUILTIN_ILBC=1" ]
- } else {
- defines += [ "WEBRTC_USE_BUILTIN_ILBC=0" ]
- }
- if (rtc_include_opus) {
- deps += [ "opus:audio_decoder_opus" ]
- defines += [ "WEBRTC_USE_BUILTIN_OPUS=1" ]
- } else {
- defines += [ "WEBRTC_USE_BUILTIN_OPUS=0" ]
- }
- if (build_with_mozilla) {
- defines += [
- "WEBRTC_USE_BUILTIN_G722=0",
- "WEBRTC_USE_BUILTIN_ISAC_FIX=0",
- "WEBRTC_USE_BUILTIN_ISAC_FLOAT=0",
- ]
- } else {
- if (current_cpu == "arm") {
- deps += [ "isac:audio_decoder_isac_fix" ]
- defines += [
- "WEBRTC_USE_BUILTIN_ISAC_FIX=1",
- "WEBRTC_USE_BUILTIN_ISAC_FLOAT=0",
- ]
- } else {
- deps += [ "isac:audio_decoder_isac_float" ]
- defines += [
- "WEBRTC_USE_BUILTIN_ISAC_FIX=0",
- "WEBRTC_USE_BUILTIN_ISAC_FLOAT=1",
- ]
- }
- deps += [ "g722:audio_decoder_g722" ]
- defines += [ "WEBRTC_USE_BUILTIN_G722=1" ]
- }
-}
-
-rtc_static_library("builtin_audio_encoder_factory") {
- sources = [
- "builtin_audio_encoder_factory.cc",
- "builtin_audio_encoder_factory.h",
- ]
- deps = [
- ":audio_codecs_api",
- "../../rtc_base:rtc_base_approved",
- "L16:audio_encoder_L16",
- "g711:audio_encoder_g711",
- ]
- defines = []
- if (rtc_include_ilbc) {
- deps += [ "ilbc:audio_encoder_ilbc" ]
- defines += [ "WEBRTC_USE_BUILTIN_ILBC=1" ]
- } else {
- defines += [ "WEBRTC_USE_BUILTIN_ILBC=0" ]
- }
- if (rtc_include_opus) {
- deps += [ "opus:audio_encoder_opus" ]
- defines += [ "WEBRTC_USE_BUILTIN_OPUS=1" ]
- } else {
- defines += [ "WEBRTC_USE_BUILTIN_OPUS=0" ]
- }
- if (build_with_mozilla) {
- defines += [
- "WEBRTC_USE_BUILTIN_G722=0",
- "WEBRTC_USE_BUILTIN_ISAC_FIX=0",
- "WEBRTC_USE_BUILTIN_ISAC_FLOAT=0",
- ]
- } else {
- if (current_cpu == "arm") {
- deps += [ "isac:audio_encoder_isac_fix" ]
- defines += [
- "WEBRTC_USE_BUILTIN_ISAC_FIX=1",
- "WEBRTC_USE_BUILTIN_ISAC_FLOAT=0",
- ]
- } else {
- deps += [ "isac:audio_encoder_isac_float" ]
- defines += [
- "WEBRTC_USE_BUILTIN_ISAC_FIX=0",
- "WEBRTC_USE_BUILTIN_ISAC_FLOAT=1",
- ]
- }
- deps += [ "g722:audio_encoder_g722" ]
- defines += [ "WEBRTC_USE_BUILTIN_G722=1" ]
- }
-}
diff --git a/api/audio_codecs/L16/BUILD.gn b/api/audio_codecs/L16/BUILD.gn
deleted file mode 100644
index 8f06a8f..0000000
--- a/api/audio_codecs/L16/BUILD.gn
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_static_library("audio_encoder_L16") {
- sources = [
- "audio_encoder_L16.cc",
- "audio_encoder_L16.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:pcm16b",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_decoder_L16") {
- sources = [
- "audio_decoder_L16.cc",
- "audio_decoder_L16.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:pcm16b",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
diff --git a/api/audio_codecs/L16/audio_decoder_L16.cc b/api/audio_codecs/L16/audio_decoder_L16.cc
deleted file mode 100644
index b5a64d8..0000000
--- a/api/audio_codecs/L16/audio_decoder_L16.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/L16/audio_decoder_L16.h"
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
-#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
- const SdpAudioFormat& format) {
- Config config;
- config.sample_rate_hz = format.clockrate_hz;
- config.num_channels = rtc::checked_cast<int>(format.num_channels);
- return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
- ? rtc::Optional<Config>(config)
- : rtc::Optional<Config>();
-}
-
-void AudioDecoderL16::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- Pcm16BAppendSupportedCodecSpecs(specs);
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder(
- const Config& config) {
- return config.IsOk() ? rtc::MakeUnique<AudioDecoderPcm16B>(
- config.sample_rate_hz, config.num_channels)
- : nullptr;
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/L16/audio_decoder_L16.h b/api/audio_codecs/L16/audio_decoder_L16.h
deleted file mode 100644
index 39b389a..0000000
--- a/api/audio_codecs/L16/audio_decoder_L16.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_L16_AUDIO_DECODER_L16_H_
-#define WEBRTC_API_AUDIO_CODECS_L16_AUDIO_DECODER_L16_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// L16 decoder API for use as a template parameter to
-// CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderL16 {
- struct Config {
- bool IsOk() const {
- return (sample_rate_hz == 8000 || sample_rate_hz == 16000 ||
- sample_rate_hz == 32000 || sample_rate_hz == 48000) &&
- num_channels >= 1;
- }
- int sample_rate_hz = 8000;
- int num_channels = 1;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const Config& config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_L16_AUDIO_DECODER_L16_H_
diff --git a/api/audio_codecs/L16/audio_encoder_L16.cc b/api/audio_codecs/L16/audio_encoder_L16.cc
deleted file mode 100644
index 99af03d..0000000
--- a/api/audio_codecs/L16/audio_encoder_L16.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/L16/audio_encoder_L16.h"
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
-#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
- const SdpAudioFormat& format) {
- if (!rtc::IsValueInRangeForNumericType<int>(format.num_channels)) {
- return rtc::Optional<Config>();
- }
- Config config;
- config.sample_rate_hz = format.clockrate_hz;
- config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
- return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
- ? rtc::Optional<Config>(config)
- : rtc::Optional<Config>();
-}
-
-void AudioEncoderL16::AppendSupportedEncoders(
- std::vector<AudioCodecSpec>* specs) {
- Pcm16BAppendSupportedCodecSpecs(specs);
-}
-
-AudioCodecInfo AudioEncoderL16::QueryAudioEncoder(
- const AudioEncoderL16::Config& config) {
- RTC_DCHECK(config.IsOk());
- return {config.sample_rate_hz,
- rtc::dchecked_cast<size_t>(config.num_channels),
- config.sample_rate_hz * config.num_channels * 16};
-}
-
-std::unique_ptr<AudioEncoder> AudioEncoderL16::MakeAudioEncoder(
- const AudioEncoderL16::Config& config,
- int payload_type) {
- RTC_DCHECK(config.IsOk());
- AudioEncoderPcm16B::Config c;
- c.sample_rate_hz = config.sample_rate_hz;
- c.num_channels = config.num_channels;
- c.frame_size_ms = config.frame_size_ms;
- c.payload_type = payload_type;
- return rtc::MakeUnique<AudioEncoderPcm16B>(c);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/L16/audio_encoder_L16.h b/api/audio_codecs/L16/audio_encoder_L16.h
deleted file mode 100644
index 3ac0423..0000000
--- a/api/audio_codecs/L16/audio_encoder_L16.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_L16_AUDIO_ENCODER_L16_H_
-#define WEBRTC_API_AUDIO_CODECS_L16_AUDIO_ENCODER_L16_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// L16 encoder API for use as a template parameter to
-// CreateAudioEncoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderL16 {
- struct Config {
- bool IsOk() const {
- return (sample_rate_hz == 8000 || sample_rate_hz == 16000 ||
- sample_rate_hz == 32000 || sample_rate_hz == 48000) &&
- num_channels >= 1 && frame_size_ms > 0 && frame_size_ms <= 120 &&
- frame_size_ms % 10 == 0;
- }
- int sample_rate_hz = 8000;
- int num_channels = 1;
- int frame_size_ms = 10;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(const Config& config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(const Config& config,
- int payload_type);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_L16_AUDIO_ENCODER_L16_H_
diff --git a/api/audio_codecs/OWNERS b/api/audio_codecs/OWNERS
deleted file mode 100644
index a52dd93..0000000
--- a/api/audio_codecs/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-kwiberg@webrtc.org
-ossu@webrtc.org
diff --git a/api/audio_codecs/audio_decoder.cc b/api/audio_codecs/audio_decoder.cc
deleted file mode 100644
index b25e85b..0000000
--- a/api/audio_codecs/audio_decoder.cc
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2012 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 "webrtc/api/audio_codecs/audio_decoder.h"
-
-#include <assert.h>
-#include <memory>
-#include <utility>
-
-#include "webrtc/api/array_view.h"
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/sanitizer.h"
-#include "webrtc/rtc_base/trace_event.h"
-
-namespace webrtc {
-
-namespace {
-
-class OldStyleEncodedFrame final : public AudioDecoder::EncodedAudioFrame {
- public:
- OldStyleEncodedFrame(AudioDecoder* decoder, rtc::Buffer&& payload)
- : decoder_(decoder), payload_(std::move(payload)) {}
-
- size_t Duration() const override {
- const int ret = decoder_->PacketDuration(payload_.data(), payload_.size());
- return ret < 0 ? 0 : static_cast<size_t>(ret);
- }
-
- rtc::Optional<DecodeResult> Decode(
- rtc::ArrayView<int16_t> decoded) const override {
- auto speech_type = AudioDecoder::kSpeech;
- const int ret = decoder_->Decode(
- payload_.data(), payload_.size(), decoder_->SampleRateHz(),
- decoded.size() * sizeof(int16_t), decoded.data(), &speech_type);
- return ret < 0 ? rtc::Optional<DecodeResult>()
- : rtc::Optional<DecodeResult>(
- {static_cast<size_t>(ret), speech_type});
- }
-
- private:
- AudioDecoder* const decoder_;
- const rtc::Buffer payload_;
-};
-
-} // namespace
-
-AudioDecoder::ParseResult::ParseResult() = default;
-AudioDecoder::ParseResult::ParseResult(ParseResult&& b) = default;
-AudioDecoder::ParseResult::ParseResult(uint32_t timestamp,
- int priority,
- std::unique_ptr<EncodedAudioFrame> frame)
- : timestamp(timestamp), priority(priority), frame(std::move(frame)) {
- RTC_DCHECK_GE(priority, 0);
-}
-
-AudioDecoder::ParseResult::~ParseResult() = default;
-
-AudioDecoder::ParseResult& AudioDecoder::ParseResult::operator=(
- ParseResult&& b) = default;
-
-std::vector<AudioDecoder::ParseResult> AudioDecoder::ParsePayload(
- rtc::Buffer&& payload,
- uint32_t timestamp) {
- std::vector<ParseResult> results;
- std::unique_ptr<EncodedAudioFrame> frame(
- new OldStyleEncodedFrame(this, std::move(payload)));
- results.emplace_back(timestamp, 0, std::move(frame));
- return results;
-}
-
-int AudioDecoder::Decode(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- size_t max_decoded_bytes,
- int16_t* decoded,
- SpeechType* speech_type) {
- TRACE_EVENT0("webrtc", "AudioDecoder::Decode");
- rtc::MsanCheckInitialized(rtc::MakeArrayView(encoded, encoded_len));
- int duration = PacketDuration(encoded, encoded_len);
- if (duration >= 0 &&
- duration * Channels() * sizeof(int16_t) > max_decoded_bytes) {
- return -1;
- }
- return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded,
- speech_type);
-}
-
-int AudioDecoder::DecodeRedundant(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- size_t max_decoded_bytes,
- int16_t* decoded,
- SpeechType* speech_type) {
- TRACE_EVENT0("webrtc", "AudioDecoder::DecodeRedundant");
- rtc::MsanCheckInitialized(rtc::MakeArrayView(encoded, encoded_len));
- int duration = PacketDurationRedundant(encoded, encoded_len);
- if (duration >= 0 &&
- duration * Channels() * sizeof(int16_t) > max_decoded_bytes) {
- return -1;
- }
- return DecodeRedundantInternal(encoded, encoded_len, sample_rate_hz, decoded,
- speech_type);
-}
-
-int AudioDecoder::DecodeRedundantInternal(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- int16_t* decoded,
- SpeechType* speech_type) {
- return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded,
- speech_type);
-}
-
-bool AudioDecoder::HasDecodePlc() const {
- return false;
-}
-
-size_t AudioDecoder::DecodePlc(size_t num_frames, int16_t* decoded) {
- return 0;
-}
-
-int AudioDecoder::IncomingPacket(const uint8_t* payload,
- size_t payload_len,
- uint16_t rtp_sequence_number,
- uint32_t rtp_timestamp,
- uint32_t arrival_timestamp) {
- return 0;
-}
-
-int AudioDecoder::ErrorCode() {
- return 0;
-}
-
-int AudioDecoder::PacketDuration(const uint8_t* encoded,
- size_t encoded_len) const {
- return kNotImplemented;
-}
-
-int AudioDecoder::PacketDurationRedundant(const uint8_t* encoded,
- size_t encoded_len) const {
- return kNotImplemented;
-}
-
-bool AudioDecoder::PacketHasFec(const uint8_t* encoded,
- size_t encoded_len) const {
- return false;
-}
-
-AudioDecoder::SpeechType AudioDecoder::ConvertSpeechType(int16_t type) {
- switch (type) {
- case 0: // TODO(hlundin): Both iSAC and Opus return 0 for speech.
- case 1:
- return kSpeech;
- case 2:
- return kComfortNoise;
- default:
- assert(false);
- return kSpeech;
- }
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/audio_decoder.h b/api/audio_codecs/audio_decoder.h
deleted file mode 100644
index 2d850fd..0000000
--- a/api/audio_codecs/audio_decoder.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2012 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 WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/array_view.h"
-#include "webrtc/api/optional.h"
-#include "webrtc/rtc_base/buffer.h"
-#include "webrtc/rtc_base/constructormagic.h"
-#include "webrtc/typedefs.h"
-
-namespace webrtc {
-
-class AudioDecoder {
- public:
- enum SpeechType {
- kSpeech = 1,
- kComfortNoise = 2,
- };
-
- // Used by PacketDuration below. Save the value -1 for errors.
- enum { kNotImplemented = -2 };
-
- AudioDecoder() = default;
- virtual ~AudioDecoder() = default;
-
- class EncodedAudioFrame {
- public:
- struct DecodeResult {
- size_t num_decoded_samples;
- SpeechType speech_type;
- };
-
- virtual ~EncodedAudioFrame() = default;
-
- // Returns the duration in samples-per-channel of this audio frame.
- // If no duration can be ascertained, returns zero.
- virtual size_t Duration() const = 0;
-
- // Decodes this frame of audio and writes the result in |decoded|.
- // |decoded| must be large enough to store as many samples as indicated by a
- // call to Duration() . On success, returns an rtc::Optional containing the
- // total number of samples across all channels, as well as whether the
- // decoder produced comfort noise or speech. On failure, returns an empty
- // rtc::Optional. Decode may be called at most once per frame object.
- virtual rtc::Optional<DecodeResult> Decode(
- rtc::ArrayView<int16_t> decoded) const = 0;
- };
-
- struct ParseResult {
- ParseResult();
- ParseResult(uint32_t timestamp,
- int priority,
- std::unique_ptr<EncodedAudioFrame> frame);
- ParseResult(ParseResult&& b);
- ~ParseResult();
-
- ParseResult& operator=(ParseResult&& b);
-
- // The timestamp of the frame is in samples per channel.
- uint32_t timestamp;
- // The relative priority of the frame compared to other frames of the same
- // payload and the same timeframe. A higher value means a lower priority.
- // The highest priority is zero - negative values are not allowed.
- int priority;
- std::unique_ptr<EncodedAudioFrame> frame;
- };
-
- // Let the decoder parse this payload and prepare zero or more decodable
- // frames. Each frame must be between 10 ms and 120 ms long. The caller must
- // ensure that the AudioDecoder object outlives any frame objects returned by
- // this call. The decoder is free to swap or move the data from the |payload|
- // buffer. |timestamp| is the input timestamp, in samples, corresponding to
- // the start of the payload.
- virtual std::vector<ParseResult> ParsePayload(rtc::Buffer&& payload,
- uint32_t timestamp);
-
- // Decodes |encode_len| bytes from |encoded| and writes the result in
- // |decoded|. The maximum bytes allowed to be written into |decoded| is
- // |max_decoded_bytes|. Returns the total number of samples across all
- // channels. If the decoder produced comfort noise, |speech_type|
- // is set to kComfortNoise, otherwise it is kSpeech. The desired output
- // sample rate is provided in |sample_rate_hz|, which must be valid for the
- // codec at hand.
- int Decode(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- size_t max_decoded_bytes,
- int16_t* decoded,
- SpeechType* speech_type);
-
- // Same as Decode(), but interfaces to the decoders redundant decode function.
- // The default implementation simply calls the regular Decode() method.
- int DecodeRedundant(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- size_t max_decoded_bytes,
- int16_t* decoded,
- SpeechType* speech_type);
-
- // Indicates if the decoder implements the DecodePlc method.
- virtual bool HasDecodePlc() const;
-
- // Calls the packet-loss concealment of the decoder to update the state after
- // one or several lost packets. The caller has to make sure that the
- // memory allocated in |decoded| should accommodate |num_frames| frames.
- virtual size_t DecodePlc(size_t num_frames, int16_t* decoded);
-
- // Resets the decoder state (empty buffers etc.).
- virtual void Reset() = 0;
-
- // Notifies the decoder of an incoming packet to NetEQ.
- virtual int IncomingPacket(const uint8_t* payload,
- size_t payload_len,
- uint16_t rtp_sequence_number,
- uint32_t rtp_timestamp,
- uint32_t arrival_timestamp);
-
- // Returns the last error code from the decoder.
- virtual int ErrorCode();
-
- // Returns the duration in samples-per-channel of the payload in |encoded|
- // which is |encoded_len| bytes long. Returns kNotImplemented if no duration
- // estimate is available, or -1 in case of an error.
- virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len) const;
-
- // Returns the duration in samples-per-channel of the redandant payload in
- // |encoded| which is |encoded_len| bytes long. Returns kNotImplemented if no
- // duration estimate is available, or -1 in case of an error.
- virtual int PacketDurationRedundant(const uint8_t* encoded,
- size_t encoded_len) const;
-
- // Detects whether a packet has forward error correction. The packet is
- // comprised of the samples in |encoded| which is |encoded_len| bytes long.
- // Returns true if the packet has FEC and false otherwise.
- virtual bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const;
-
- // Returns the actual sample rate of the decoder's output. This value may not
- // change during the lifetime of the decoder.
- virtual int SampleRateHz() const = 0;
-
- // The number of channels in the decoder's output. This value may not change
- // during the lifetime of the decoder.
- virtual size_t Channels() const = 0;
-
- protected:
- static SpeechType ConvertSpeechType(int16_t type);
-
- virtual int DecodeInternal(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- int16_t* decoded,
- SpeechType* speech_type) = 0;
-
- virtual int DecodeRedundantInternal(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- int16_t* decoded,
- SpeechType* speech_type);
-
- private:
- RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
-};
-
-} // namespace webrtc
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_H_
diff --git a/api/audio_codecs/audio_decoder_factory.h b/api/audio_codecs/audio_decoder_factory.h
deleted file mode 100644
index 0becf6f..0000000
--- a/api/audio_codecs/audio_decoder_factory.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016 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 WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/rtc_base/refcount.h"
-
-namespace webrtc {
-
-// A factory that creates AudioDecoders.
-// NOTE: This class is still under development and may change without notice.
-class AudioDecoderFactory : public rtc::RefCountInterface {
- public:
- virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;
-
- virtual bool IsSupportedDecoder(const SdpAudioFormat& format) = 0;
-
- virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
- const SdpAudioFormat& format) = 0;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
diff --git a/api/audio_codecs/audio_decoder_factory_template.h b/api/audio_codecs/audio_decoder_factory_template.h
deleted file mode 100644
index 422a514..0000000
--- a/api/audio_codecs/audio_decoder_factory_template.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_TEMPLATE_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_TEMPLATE_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder_factory.h"
-#include "webrtc/rtc_base/scoped_ref_ptr.h"
-
-namespace webrtc {
-
-namespace audio_decoder_factory_template_impl {
-
-template <typename... Ts>
-struct Helper;
-
-// Base case: 0 template parameters.
-template <>
-struct Helper<> {
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {}
- static bool IsSupportedDecoder(const SdpAudioFormat& format) { return false; }
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
- const SdpAudioFormat& format) {
- return nullptr;
- }
-};
-
-// Inductive case: Called with n + 1 template parameters; calls subroutines
-// with n template parameters.
-template <typename T, typename... Ts>
-struct Helper<T, Ts...> {
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
- T::AppendSupportedDecoders(specs);
- Helper<Ts...>::AppendSupportedDecoders(specs);
- }
- static bool IsSupportedDecoder(const SdpAudioFormat& format) {
- auto opt_config = T::SdpToConfig(format);
- return opt_config ? true : Helper<Ts...>::IsSupportedDecoder(format);
- }
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
- const SdpAudioFormat& format) {
- auto opt_config = T::SdpToConfig(format);
- return opt_config ? T::MakeAudioDecoder(*opt_config)
- : Helper<Ts...>::MakeAudioDecoder(format);
- }
-};
-
-template <typename... Ts>
-class AudioDecoderFactoryT : public AudioDecoderFactory {
- public:
- std::vector<AudioCodecSpec> GetSupportedDecoders() override {
- std::vector<AudioCodecSpec> specs;
- Helper<Ts...>::AppendSupportedDecoders(&specs);
- return specs;
- }
-
- bool IsSupportedDecoder(const SdpAudioFormat& format) override {
- return Helper<Ts...>::IsSupportedDecoder(format);
- }
-
- std::unique_ptr<AudioDecoder> MakeAudioDecoder(
- const SdpAudioFormat& format) override {
- return Helper<Ts...>::MakeAudioDecoder(format);
- }
-};
-
-} // namespace audio_decoder_factory_template_impl
-
-// Make an AudioDecoderFactory that can create instances of the given decoders.
-//
-// Each decoder type is given as a template argument to the function; it should
-// be a struct with the following static member functions:
-//
-// // Converts |audio_format| to a ConfigType instance. Returns an empty
-// // optional if |audio_format| doesn't correctly specify an decoder of our
-// // type.
-// rtc::Optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
-//
-// // Appends zero or more AudioCodecSpecs to the list that will be returned
-// // by AudioDecoderFactory::GetSupportedDecoders().
-// void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
-//
-// // Creates an AudioDecoder for the specified format. Used to implement
-// // AudioDecoderFactory::MakeAudioDecoder().
-// std::unique_ptr<AudioDecoder> MakeAudioDecoder(const ConfigType& config);
-//
-// ConfigType should be a type that encapsulates all the settings needed to
-// create an AudioDecoder.
-//
-// Whenever it tries to do something, the new factory will try each of the
-// decoder types in the order they were specified in the template argument
-// list, stopping at the first one that claims to be able to do the job.
-//
-// NOTE: This function is still under development and may change without notice.
-//
-// TODO(kwiberg): Point at CreateBuiltinAudioDecoderFactory() for an example of
-// how it is used.
-template <typename... Ts>
-rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory() {
- // There's no technical reason we couldn't allow zero template parameters,
- // but such a factory couldn't create any decoders, and callers can do this
- // by mistake by simply forgetting the <> altogether. So we forbid it in
- // order to prevent caller foot-shooting.
- static_assert(sizeof...(Ts) >= 1,
- "Caller must give at least one template parameter");
-
- return rtc::scoped_refptr<AudioDecoderFactory>(
- new rtc::RefCountedObject<
- audio_decoder_factory_template_impl::AudioDecoderFactoryT<Ts...>>());
-}
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_TEMPLATE_H_
diff --git a/api/audio_codecs/audio_encoder.cc b/api/audio_codecs/audio_encoder.cc
deleted file mode 100644
index d5be26c..0000000
--- a/api/audio_codecs/audio_encoder.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2014 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 "webrtc/api/audio_codecs/audio_encoder.h"
-
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/trace_event.h"
-
-namespace webrtc {
-
-ANAStats::ANAStats() = default;
-ANAStats::~ANAStats() = default;
-ANAStats::ANAStats(const ANAStats&) = default;
-
-AudioEncoder::EncodedInfo::EncodedInfo() = default;
-AudioEncoder::EncodedInfo::EncodedInfo(const EncodedInfo&) = default;
-AudioEncoder::EncodedInfo::EncodedInfo(EncodedInfo&&) = default;
-AudioEncoder::EncodedInfo::~EncodedInfo() = default;
-AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(
- const EncodedInfo&) = default;
-AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(EncodedInfo&&) =
- default;
-
-int AudioEncoder::RtpTimestampRateHz() const {
- return SampleRateHz();
-}
-
-AudioEncoder::EncodedInfo AudioEncoder::Encode(
- uint32_t rtp_timestamp,
- rtc::ArrayView<const int16_t> audio,
- rtc::Buffer* encoded) {
- TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
- RTC_CHECK_EQ(audio.size(),
- static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
-
- const size_t old_size = encoded->size();
- EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded);
- RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes);
- return info;
-}
-
-bool AudioEncoder::SetFec(bool enable) {
- return !enable;
-}
-
-bool AudioEncoder::SetDtx(bool enable) {
- return !enable;
-}
-
-bool AudioEncoder::GetDtx() const {
- return false;
-}
-
-bool AudioEncoder::SetApplication(Application application) {
- return false;
-}
-
-void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
-
-void AudioEncoder::SetTargetBitrate(int target_bps) {}
-
-rtc::ArrayView<std::unique_ptr<AudioEncoder>>
-AudioEncoder::ReclaimContainedEncoders() {
- return nullptr;
-}
-
-bool AudioEncoder::EnableAudioNetworkAdaptor(const std::string& config_string,
- RtcEventLog* event_log) {
- return false;
-}
-
-void AudioEncoder::DisableAudioNetworkAdaptor() {}
-
-void AudioEncoder::OnReceivedUplinkPacketLossFraction(
- float uplink_packet_loss_fraction) {}
-
-void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
- float uplink_recoverable_packet_loss_fraction) {}
-
-void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
- OnReceivedUplinkBandwidth(target_audio_bitrate_bps, rtc::Optional<int64_t>());
-}
-
-void AudioEncoder::OnReceivedUplinkBandwidth(
- int target_audio_bitrate_bps,
- rtc::Optional<int64_t> bwe_period_ms) {}
-
-void AudioEncoder::OnReceivedRtt(int rtt_ms) {}
-
-void AudioEncoder::OnReceivedOverhead(size_t overhead_bytes_per_packet) {}
-
-void AudioEncoder::SetReceiverFrameLengthRange(int min_frame_length_ms,
- int max_frame_length_ms) {}
-
-ANAStats AudioEncoder::GetANAStats() const {
- return ANAStats();
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/audio_encoder.h b/api/audio_codecs/audio_encoder.h
deleted file mode 100644
index a1f36ae..0000000
--- a/api/audio_codecs/audio_encoder.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2014 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 WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_
-
-#include <algorithm>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "webrtc/api/array_view.h"
-#include "webrtc/api/optional.h"
-#include "webrtc/rtc_base/buffer.h"
-#include "webrtc/rtc_base/deprecation.h"
-#include "webrtc/typedefs.h"
-
-namespace webrtc {
-
-class Clock;
-class RtcEventLog;
-
-// Statistics related to Audio Network Adaptation.
-struct ANAStats {
- ANAStats();
- ANAStats(const ANAStats&);
- ~ANAStats();
- // Number of actions taken by the ANA bitrate controller since the start of
- // the call. If this value is not set, it indicates that the bitrate
- // controller is disabled.
- rtc::Optional<uint32_t> bitrate_action_counter;
- // Number of actions taken by the ANA channel controller since the start of
- // the call. If this value is not set, it indicates that the channel
- // controller is disabled.
- rtc::Optional<uint32_t> channel_action_counter;
- // Number of actions taken by the ANA DTX controller since the start of the
- // call. If this value is not set, it indicates that the DTX controller is
- // disabled.
- rtc::Optional<uint32_t> dtx_action_counter;
- // Number of actions taken by the ANA FEC controller since the start of the
- // call. If this value is not set, it indicates that the FEC controller is
- // disabled.
- rtc::Optional<uint32_t> fec_action_counter;
- // Number of times the ANA frame length controller decided to increase the
- // frame length since the start of the call. If this value is not set, it
- // indicates that the frame length controller is disabled.
- rtc::Optional<uint32_t> frame_length_increase_counter;
- // Number of times the ANA frame length controller decided to decrease the
- // frame length since the start of the call. If this value is not set, it
- // indicates that the frame length controller is disabled.
- rtc::Optional<uint32_t> frame_length_decrease_counter;
- // The uplink packet loss fractions as set by the ANA FEC controller. If this
- // value is not set, it indicates that the ANA FEC controller is not active.
- rtc::Optional<float> uplink_packet_loss_fraction;
-};
-
-// This is the interface class for encoders in AudioCoding module. Each codec
-// type must have an implementation of this class.
-class AudioEncoder {
- public:
- // Used for UMA logging of codec usage. The same codecs, with the
- // same values, must be listed in
- // src/tools/metrics/histograms/histograms.xml in chromium to log
- // correct values.
- enum class CodecType {
- kOther = 0, // Codec not specified, and/or not listed in this enum
- kOpus = 1,
- kIsac = 2,
- kPcmA = 3,
- kPcmU = 4,
- kG722 = 5,
- kIlbc = 6,
-
- // Number of histogram bins in the UMA logging of codec types. The
- // total number of different codecs that are logged cannot exceed this
- // number.
- kMaxLoggedAudioCodecTypes
- };
-
- struct EncodedInfoLeaf {
- size_t encoded_bytes = 0;
- uint32_t encoded_timestamp = 0;
- int payload_type = 0;
- bool send_even_if_empty = false;
- bool speech = true;
- CodecType encoder_type = CodecType::kOther;
- };
-
- // This is the main struct for auxiliary encoding information. Each encoded
- // packet should be accompanied by one EncodedInfo struct, containing the
- // total number of |encoded_bytes|, the |encoded_timestamp| and the
- // |payload_type|. If the packet contains redundant encodings, the |redundant|
- // vector will be populated with EncodedInfoLeaf structs. Each struct in the
- // vector represents one encoding; the order of structs in the vector is the
- // same as the order in which the actual payloads are written to the byte
- // stream. When EncoderInfoLeaf structs are present in the vector, the main
- // struct's |encoded_bytes| will be the sum of all the |encoded_bytes| in the
- // vector.
- struct EncodedInfo : public EncodedInfoLeaf {
- EncodedInfo();
- EncodedInfo(const EncodedInfo&);
- EncodedInfo(EncodedInfo&&);
- ~EncodedInfo();
- EncodedInfo& operator=(const EncodedInfo&);
- EncodedInfo& operator=(EncodedInfo&&);
-
- std::vector<EncodedInfoLeaf> redundant;
- };
-
- virtual ~AudioEncoder() = default;
-
- // Returns the input sample rate in Hz and the number of input channels.
- // These are constants set at instantiation time.
- virtual int SampleRateHz() const = 0;
- virtual size_t NumChannels() const = 0;
-
- // Returns the rate at which the RTP timestamps are updated. The default
- // implementation returns SampleRateHz().
- virtual int RtpTimestampRateHz() const;
-
- // Returns the number of 10 ms frames the encoder will put in the next
- // packet. This value may only change when Encode() outputs a packet; i.e.,
- // the encoder may vary the number of 10 ms frames from packet to packet, but
- // it must decide the length of the next packet no later than when outputting
- // the preceding packet.
- virtual size_t Num10MsFramesInNextPacket() const = 0;
-
- // Returns the maximum value that can be returned by
- // Num10MsFramesInNextPacket().
- virtual size_t Max10MsFramesInAPacket() const = 0;
-
- // Returns the current target bitrate in bits/s. The value -1 means that the
- // codec adapts the target automatically, and a current target cannot be
- // provided.
- virtual int GetTargetBitrate() const = 0;
-
- // Accepts one 10 ms block of input audio (i.e., SampleRateHz() / 100 *
- // NumChannels() samples). Multi-channel audio must be sample-interleaved.
- // The encoder appends zero or more bytes of output to |encoded| and returns
- // additional encoding information. Encode() checks some preconditions, calls
- // EncodeImpl() which does the actual work, and then checks some
- // postconditions.
- EncodedInfo Encode(uint32_t rtp_timestamp,
- rtc::ArrayView<const int16_t> audio,
- rtc::Buffer* encoded);
-
- // Resets the encoder to its starting state, discarding any input that has
- // been fed to the encoder but not yet emitted in a packet.
- virtual void Reset() = 0;
-
- // Enables or disables codec-internal FEC (forward error correction). Returns
- // true if the codec was able to comply. The default implementation returns
- // true when asked to disable FEC and false when asked to enable it (meaning
- // that FEC isn't supported).
- virtual bool SetFec(bool enable);
-
- // Enables or disables codec-internal VAD/DTX. Returns true if the codec was
- // able to comply. The default implementation returns true when asked to
- // disable DTX and false when asked to enable it (meaning that DTX isn't
- // supported).
- virtual bool SetDtx(bool enable);
-
- // Returns the status of codec-internal DTX. The default implementation always
- // returns false.
- virtual bool GetDtx() const;
-
- // Sets the application mode. Returns true if the codec was able to comply.
- // The default implementation just returns false.
- enum class Application { kSpeech, kAudio };
- virtual bool SetApplication(Application application);
-
- // Tells the encoder about the highest sample rate the decoder is expected to
- // use when decoding the bitstream. The encoder would typically use this
- // information to adjust the quality of the encoding. The default
- // implementation does nothing.
- virtual void SetMaxPlaybackRate(int frequency_hz);
-
- // This is to be deprecated. Please use |OnReceivedTargetAudioBitrate|
- // instead.
- // Tells the encoder what average bitrate we'd like it to produce. The
- // encoder is free to adjust or disregard the given bitrate (the default
- // implementation does the latter).
- RTC_DEPRECATED virtual void SetTargetBitrate(int target_bps);
-
- // Causes this encoder to let go of any other encoders it contains, and
- // returns a pointer to an array where they are stored (which is required to
- // live as long as this encoder). Unless the returned array is empty, you may
- // not call any methods on this encoder afterwards, except for the
- // destructor. The default implementation just returns an empty array.
- // NOTE: This method is subject to change. Do not call or override it.
- virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>>
- ReclaimContainedEncoders();
-
- // Enables audio network adaptor. Returns true if successful.
- virtual bool EnableAudioNetworkAdaptor(const std::string& config_string,
- RtcEventLog* event_log);
-
- // Disables audio network adaptor.
- virtual void DisableAudioNetworkAdaptor();
-
- // Provides uplink packet loss fraction to this encoder to allow it to adapt.
- // |uplink_packet_loss_fraction| is in the range [0.0, 1.0].
- virtual void OnReceivedUplinkPacketLossFraction(
- float uplink_packet_loss_fraction);
-
- // Provides 1st-order-FEC-recoverable uplink packet loss rate to this encoder
- // to allow it to adapt.
- // |uplink_recoverable_packet_loss_fraction| is in the range [0.0, 1.0].
- virtual void OnReceivedUplinkRecoverablePacketLossFraction(
- float uplink_recoverable_packet_loss_fraction);
-
- // Provides target audio bitrate to this encoder to allow it to adapt.
- virtual void OnReceivedTargetAudioBitrate(int target_bps);
-
- // Provides target audio bitrate and corresponding probing interval of
- // the bandwidth estimator to this encoder to allow it to adapt.
- virtual void OnReceivedUplinkBandwidth(
- int target_audio_bitrate_bps,
- rtc::Optional<int64_t> bwe_period_ms);
-
- // Provides RTT to this encoder to allow it to adapt.
- virtual void OnReceivedRtt(int rtt_ms);
-
- // Provides overhead to this encoder to adapt. The overhead is the number of
- // bytes that will be added to each packet the encoder generates.
- virtual void OnReceivedOverhead(size_t overhead_bytes_per_packet);
-
- // To allow encoder to adapt its frame length, it must be provided the frame
- // length range that receivers can accept.
- virtual void SetReceiverFrameLengthRange(int min_frame_length_ms,
- int max_frame_length_ms);
-
- // Get statistics related to audio network adaptation.
- virtual ANAStats GetANAStats() const;
-
- protected:
- // Subclasses implement this to perform the actual encoding. Called by
- // Encode().
- virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
- rtc::ArrayView<const int16_t> audio,
- rtc::Buffer* encoded) = 0;
-};
-} // namespace webrtc
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_
diff --git a/api/audio_codecs/audio_encoder_factory.h b/api/audio_codecs/audio_encoder_factory.h
deleted file mode 100644
index 820651f..0000000
--- a/api/audio_codecs/audio_encoder_factory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/rtc_base/refcount.h"
-
-namespace webrtc {
-
-// A factory that creates AudioEncoders.
-// NOTE: This class is still under development and may change without notice.
-class AudioEncoderFactory : public rtc::RefCountInterface {
- public:
- // Returns a prioritized list of audio codecs, to use for signaling etc.
- virtual std::vector<AudioCodecSpec> GetSupportedEncoders() = 0;
-
- // Returns information about how this format would be encoded, provided it's
- // supported. More format and format variations may be supported than those
- // returned by GetSupportedEncoders().
- virtual rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
- const SdpAudioFormat& format) = 0;
-
- // Creates an AudioEncoder for the specified format. The encoder will tags its
- // payloads with the specified payload type.
- // TODO(ossu): Try to avoid audio encoders having to know their payload type.
- virtual std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- int payload_type,
- const SdpAudioFormat& format) = 0;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_H_
diff --git a/api/audio_codecs/audio_encoder_factory_template.h b/api/audio_codecs/audio_encoder_factory_template.h
deleted file mode 100644
index 00bba46..0000000
--- a/api/audio_codecs/audio_encoder_factory_template.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_TEMPLATE_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_TEMPLATE_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder_factory.h"
-#include "webrtc/rtc_base/scoped_ref_ptr.h"
-
-namespace webrtc {
-
-namespace audio_encoder_factory_template_impl {
-
-template <typename... Ts>
-struct Helper;
-
-// Base case: 0 template parameters.
-template <>
-struct Helper<> {
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {}
- static rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
- const SdpAudioFormat& format) {
- return rtc::Optional<AudioCodecInfo>();
- }
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- int payload_type,
- const SdpAudioFormat& format) {
- return nullptr;
- }
-};
-
-// Inductive case: Called with n + 1 template parameters; calls subroutines
-// with n template parameters.
-template <typename T, typename... Ts>
-struct Helper<T, Ts...> {
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
- T::AppendSupportedEncoders(specs);
- Helper<Ts...>::AppendSupportedEncoders(specs);
- }
- static rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
- const SdpAudioFormat& format) {
- auto opt_config = T::SdpToConfig(format);
- return opt_config ? rtc::Optional<AudioCodecInfo>(
- T::QueryAudioEncoder(*opt_config))
- : Helper<Ts...>::QueryAudioEncoder(format);
- }
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- int payload_type,
- const SdpAudioFormat& format) {
- auto opt_config = T::SdpToConfig(format);
- if (opt_config) {
- return T::MakeAudioEncoder(*opt_config, payload_type);
- } else {
- return Helper<Ts...>::MakeAudioEncoder(payload_type, format);
- }
- }
-};
-
-template <typename... Ts>
-class AudioEncoderFactoryT : public AudioEncoderFactory {
- public:
- std::vector<AudioCodecSpec> GetSupportedEncoders() override {
- std::vector<AudioCodecSpec> specs;
- Helper<Ts...>::AppendSupportedEncoders(&specs);
- return specs;
- }
-
- rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
- const SdpAudioFormat& format) override {
- return Helper<Ts...>::QueryAudioEncoder(format);
- }
-
- std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- int payload_type,
- const SdpAudioFormat& format) override {
- return Helper<Ts...>::MakeAudioEncoder(payload_type, format);
- }
-};
-
-} // namespace audio_encoder_factory_template_impl
-
-// Make an AudioEncoderFactory that can create instances of the given encoders.
-//
-// Each encoder type is given as a template argument to the function; it should
-// be a struct with the following static member functions:
-//
-// // Converts |audio_format| to a ConfigType instance. Returns an empty
-// // optional if |audio_format| doesn't correctly specify an encoder of our
-// // type.
-// rtc::Optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
-//
-// // Appends zero or more AudioCodecSpecs to the list that will be returned
-// // by AudioEncoderFactory::GetSupportedEncoders().
-// void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
-//
-// // Returns information about how this format would be encoded. Used to
-// // implement AudioEncoderFactory::QueryAudioEncoder().
-// AudioCodecInfo QueryAudioEncoder(const ConfigType& config);
-//
-// // Creates an AudioEncoder for the specified format. Used to implement
-// // AudioEncoderFactory::MakeAudioEncoder().
-// std::unique_ptr<AudioEncoder> MakeAudioEncoder(const ConfigType& config,
-// int payload_type);
-//
-// ConfigType should be a type that encapsulates all the settings needed to
-// create an AudioDecoder.
-//
-// Whenever it tries to do something, the new factory will try each of the
-// encoders in the order they were specified in the template argument list,
-// stopping at the first one that claims to be able to do the job.
-//
-// NOTE: This function is still under development and may change without notice.
-//
-// TODO(kwiberg): Point at CreateBuiltinAudioEncoderFactory() for an example of
-// how it is used.
-template <typename... Ts>
-rtc::scoped_refptr<AudioEncoderFactory> CreateAudioEncoderFactory() {
- // There's no technical reason we couldn't allow zero template parameters,
- // but such a factory couldn't create any encoders, and callers can do this
- // by mistake by simply forgetting the <> altogether. So we forbid it in
- // order to prevent caller foot-shooting.
- static_assert(sizeof...(Ts) >= 1,
- "Caller must give at least one template parameter");
-
- return rtc::scoped_refptr<AudioEncoderFactory>(
- new rtc::RefCountedObject<
- audio_encoder_factory_template_impl::AudioEncoderFactoryT<Ts...>>());
-}
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_TEMPLATE_H_
diff --git a/api/audio_codecs/audio_format.cc b/api/audio_codecs/audio_format.cc
deleted file mode 100644
index de8b1fd..0000000
--- a/api/audio_codecs/audio_format.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2016 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 "webrtc/api/audio_codecs/audio_format.h"
-
-#include "webrtc/common_types.h"
-
-namespace webrtc {
-
-SdpAudioFormat::SdpAudioFormat(const SdpAudioFormat&) = default;
-SdpAudioFormat::SdpAudioFormat(SdpAudioFormat&&) = default;
-
-SdpAudioFormat::SdpAudioFormat(const char* name,
- int clockrate_hz,
- size_t num_channels)
- : name(name), clockrate_hz(clockrate_hz), num_channels(num_channels) {}
-
-SdpAudioFormat::SdpAudioFormat(const std::string& name,
- int clockrate_hz,
- size_t num_channels)
- : name(name), clockrate_hz(clockrate_hz), num_channels(num_channels) {}
-
-SdpAudioFormat::SdpAudioFormat(const char* name,
- int clockrate_hz,
- size_t num_channels,
- const Parameters& param)
- : name(name),
- clockrate_hz(clockrate_hz),
- num_channels(num_channels),
- parameters(param) {}
-
-SdpAudioFormat::SdpAudioFormat(const std::string& name,
- int clockrate_hz,
- size_t num_channels,
- const Parameters& param)
- : name(name),
- clockrate_hz(clockrate_hz),
- num_channels(num_channels),
- parameters(param) {}
-
-bool SdpAudioFormat::Matches(const SdpAudioFormat& o) const {
- return STR_CASE_CMP(name.c_str(), o.name.c_str()) == 0 &&
- clockrate_hz == o.clockrate_hz && num_channels == o.num_channels;
-}
-
-SdpAudioFormat::~SdpAudioFormat() = default;
-SdpAudioFormat& SdpAudioFormat::operator=(const SdpAudioFormat&) = default;
-SdpAudioFormat& SdpAudioFormat::operator=(SdpAudioFormat&&) = default;
-
-bool operator==(const SdpAudioFormat& a, const SdpAudioFormat& b) {
- return STR_CASE_CMP(a.name.c_str(), b.name.c_str()) == 0 &&
- a.clockrate_hz == b.clockrate_hz && a.num_channels == b.num_channels &&
- a.parameters == b.parameters;
-}
-
-void swap(SdpAudioFormat& a, SdpAudioFormat& b) {
- using std::swap;
- swap(a.name, b.name);
- swap(a.clockrate_hz, b.clockrate_hz);
- swap(a.num_channels, b.num_channels);
- swap(a.parameters, b.parameters);
-}
-
-std::ostream& operator<<(std::ostream& os, const SdpAudioFormat& saf) {
- os << "{name: " << saf.name;
- os << ", clockrate_hz: " << saf.clockrate_hz;
- os << ", num_channels: " << saf.num_channels;
- os << ", parameters: {";
- const char* sep = "";
- for (const auto& kv : saf.parameters) {
- os << sep << kv.first << ": " << kv.second;
- sep = ", ";
- }
- os << "}}";
- return os;
-}
-
-AudioCodecInfo::AudioCodecInfo(int sample_rate_hz,
- size_t num_channels,
- int bitrate_bps)
- : AudioCodecInfo(sample_rate_hz,
- num_channels,
- bitrate_bps,
- bitrate_bps,
- bitrate_bps) {}
-
-AudioCodecInfo::AudioCodecInfo(int sample_rate_hz,
- size_t num_channels,
- int default_bitrate_bps,
- int min_bitrate_bps,
- int max_bitrate_bps)
- : sample_rate_hz(sample_rate_hz),
- num_channels(num_channels),
- default_bitrate_bps(default_bitrate_bps),
- min_bitrate_bps(min_bitrate_bps),
- max_bitrate_bps(max_bitrate_bps) {
- RTC_DCHECK_GT(sample_rate_hz, 0);
- RTC_DCHECK_GT(num_channels, 0);
- RTC_DCHECK_GE(min_bitrate_bps, 0);
- RTC_DCHECK_LE(min_bitrate_bps, default_bitrate_bps);
- RTC_DCHECK_GE(max_bitrate_bps, default_bitrate_bps);
-}
-
-std::ostream& operator<<(std::ostream& os, const AudioCodecInfo& aci) {
- os << "{sample_rate_hz: " << aci.sample_rate_hz;
- os << ", num_channels: " << aci.num_channels;
- os << ", default_bitrate_bps: " << aci.default_bitrate_bps;
- os << ", min_bitrate_bps: " << aci.min_bitrate_bps;
- os << ", max_bitrate_bps: " << aci.max_bitrate_bps;
- os << ", allow_comfort_noise: " << aci.allow_comfort_noise;
- os << ", supports_network_adaption: " << aci.supports_network_adaption;
- os << "}";
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const AudioCodecSpec& acs) {
- os << "{format: " << acs.format;
- os << ", info: " << acs.info;
- os << "}";
- return os;
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/audio_format.h b/api/audio_codecs/audio_format.h
deleted file mode 100644
index ab825bb..0000000
--- a/api/audio_codecs/audio_format.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2016 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 WEBRTC_API_AUDIO_CODECS_AUDIO_FORMAT_H_
-#define WEBRTC_API_AUDIO_CODECS_AUDIO_FORMAT_H_
-
-#include <map>
-#include <ostream>
-#include <string>
-#include <utility>
-
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// SDP specification for a single audio codec.
-// NOTE: This class is still under development and may change without notice.
-struct SdpAudioFormat {
- using Parameters = std::map<std::string, std::string>;
-
- SdpAudioFormat(const SdpAudioFormat&);
- SdpAudioFormat(SdpAudioFormat&&);
- SdpAudioFormat(const char* name, int clockrate_hz, size_t num_channels);
- SdpAudioFormat(const std::string& name,
- int clockrate_hz,
- size_t num_channels);
- SdpAudioFormat(const char* name,
- int clockrate_hz,
- size_t num_channels,
- const Parameters& param);
- SdpAudioFormat(const std::string& name,
- int clockrate_hz,
- size_t num_channels,
- const Parameters& param);
- ~SdpAudioFormat();
-
- // Returns true if this format is compatible with |o|. In SDP terminology:
- // would it represent the same codec between an offer and an answer? As
- // opposed to operator==, this method disregards codec parameters.
- bool Matches(const SdpAudioFormat& o) const;
-
- SdpAudioFormat& operator=(const SdpAudioFormat&);
- SdpAudioFormat& operator=(SdpAudioFormat&&);
-
- friend bool operator==(const SdpAudioFormat& a, const SdpAudioFormat& b);
- friend bool operator!=(const SdpAudioFormat& a, const SdpAudioFormat& b) {
- return !(a == b);
- }
-
- std::string name;
- int clockrate_hz;
- size_t num_channels;
- Parameters parameters;
-};
-
-void swap(SdpAudioFormat& a, SdpAudioFormat& b);
-std::ostream& operator<<(std::ostream& os, const SdpAudioFormat& saf);
-
-// Information about how an audio format is treated by the codec implementation.
-// Contains basic information, such as sample rate and number of channels, which
-// isn't uniformly presented by SDP. Also contains flags indicating support for
-// integrating with other parts of WebRTC, like external VAD and comfort noise
-// level calculation.
-//
-// To avoid API breakage, and make the code clearer, AudioCodecInfo should not
-// be directly initializable with any flags indicating optional support. If it
-// were, these initializers would break any time a new flag was added. It's also
-// more difficult to understand:
-// AudioCodecInfo info{16000, 1, 32000, true, false, false, true, true};
-// than
-// AudioCodecInfo info(16000, 1, 32000);
-// info.allow_comfort_noise = true;
-// info.future_flag_b = true;
-// info.future_flag_c = true;
-struct AudioCodecInfo {
- AudioCodecInfo(int sample_rate_hz, size_t num_channels, int bitrate_bps);
- AudioCodecInfo(int sample_rate_hz,
- size_t num_channels,
- int default_bitrate_bps,
- int min_bitrate_bps,
- int max_bitrate_bps);
- AudioCodecInfo(const AudioCodecInfo& b) = default;
- ~AudioCodecInfo() = default;
-
- bool operator==(const AudioCodecInfo& b) const {
- return sample_rate_hz == b.sample_rate_hz &&
- num_channels == b.num_channels &&
- default_bitrate_bps == b.default_bitrate_bps &&
- min_bitrate_bps == b.min_bitrate_bps &&
- max_bitrate_bps == b.max_bitrate_bps &&
- allow_comfort_noise == b.allow_comfort_noise &&
- supports_network_adaption == b.supports_network_adaption;
- }
-
- bool operator!=(const AudioCodecInfo& b) const { return !(*this == b); }
-
- bool HasFixedBitrate() const {
- RTC_DCHECK_GE(min_bitrate_bps, 0);
- RTC_DCHECK_LE(min_bitrate_bps, default_bitrate_bps);
- RTC_DCHECK_GE(max_bitrate_bps, default_bitrate_bps);
- return min_bitrate_bps == max_bitrate_bps;
- }
-
- int sample_rate_hz;
- size_t num_channels;
- int default_bitrate_bps;
- int min_bitrate_bps;
- int max_bitrate_bps;
-
- bool allow_comfort_noise = true; // This codec can be used with an external
- // comfort noise generator.
- bool supports_network_adaption = false; // This codec can adapt to varying
- // network conditions.
-};
-
-std::ostream& operator<<(std::ostream& os, const AudioCodecInfo& aci);
-
-// AudioCodecSpec ties an audio format to specific information about the codec
-// and its implementation.
-struct AudioCodecSpec {
- bool operator==(const AudioCodecSpec& b) const {
- return format == b.format && info == b.info;
- }
-
- bool operator!=(const AudioCodecSpec& b) const { return !(*this == b); }
-
- SdpAudioFormat format;
- AudioCodecInfo info;
-};
-
-std::ostream& operator<<(std::ostream& os, const AudioCodecSpec& acs);
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_AUDIO_FORMAT_H_
diff --git a/api/audio_codecs/builtin_audio_decoder_factory.cc b/api/audio_codecs/builtin_audio_decoder_factory.cc
deleted file mode 100644
index 69a3e7c..0000000
--- a/api/audio_codecs/builtin_audio_decoder_factory.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/L16/audio_decoder_L16.h"
-#include "webrtc/api/audio_codecs/audio_decoder_factory_template.h"
-#include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h"
-#if WEBRTC_USE_BUILTIN_G722
-#include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h" // nogncheck
-#endif
-#if WEBRTC_USE_BUILTIN_ILBC
-#include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h" // nogncheck
-#endif
-#if WEBRTC_USE_BUILTIN_ISAC_FIX
-#include "webrtc/api/audio_codecs/isac/audio_decoder_isac_fix.h" // nogncheck
-#elif WEBRTC_USE_BUILTIN_ISAC_FLOAT
-#include "webrtc/api/audio_codecs/isac/audio_decoder_isac_float.h" // nogncheck
-#endif
-#if WEBRTC_USE_BUILTIN_OPUS
-#include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck
-#endif
-
-namespace webrtc {
-
-namespace {
-
-// Modify an audio decoder to not advertise support for anything.
-template <typename T>
-struct NotAdvertised {
- using Config = typename T::Config;
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
- return T::SdpToConfig(audio_format);
- }
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
- // Don't advertise support for anything.
- }
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const Config& config) {
- return T::MakeAudioDecoder(config);
- }
-};
-
-} // namespace
-
-rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() {
- return CreateAudioDecoderFactory<
-
-#if WEBRTC_USE_BUILTIN_OPUS
- AudioDecoderOpus,
-#endif
-
-#if WEBRTC_USE_BUILTIN_ISAC_FIX
- AudioDecoderIsacFix,
-#elif WEBRTC_USE_BUILTIN_ISAC_FLOAT
- AudioDecoderIsacFloat,
-#endif
-
-#if WEBRTC_USE_BUILTIN_G722
- AudioDecoderG722,
-#endif
-
-#if WEBRTC_USE_BUILTIN_ILBC
- AudioDecoderIlbc,
-#endif
-
- AudioDecoderG711, NotAdvertised<AudioDecoderL16>>();
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/builtin_audio_decoder_factory.h b/api/audio_codecs/builtin_audio_decoder_factory.h
deleted file mode 100644
index 5b93158..0000000
--- a/api/audio_codecs/builtin_audio_decoder_factory.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2016 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 WEBRTC_API_AUDIO_CODECS_BUILTIN_AUDIO_DECODER_FACTORY_H_
-#define WEBRTC_API_AUDIO_CODECS_BUILTIN_AUDIO_DECODER_FACTORY_H_
-
-#include "webrtc/api/audio_codecs/audio_decoder_factory.h"
-#include "webrtc/rtc_base/scoped_ref_ptr.h"
-
-namespace webrtc {
-
-// Creates a new factory that can create the built-in types of audio decoders.
-// NOTE: This function is still under development and may change without notice.
-rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory();
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_BUILTIN_AUDIO_DECODER_FACTORY_H_
diff --git a/api/audio_codecs/builtin_audio_encoder_factory.cc b/api/audio_codecs/builtin_audio_encoder_factory.cc
deleted file mode 100644
index ae1bf4b..0000000
--- a/api/audio_codecs/builtin_audio_encoder_factory.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/L16/audio_encoder_L16.h"
-#include "webrtc/api/audio_codecs/audio_encoder_factory_template.h"
-#include "webrtc/api/audio_codecs/g711/audio_encoder_g711.h"
-#if WEBRTC_USE_BUILTIN_G722
-#include "webrtc/api/audio_codecs/g722/audio_encoder_g722.h" // nogncheck
-#endif
-#if WEBRTC_USE_BUILTIN_ILBC
-#include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc.h" // nogncheck
-#endif
-#if WEBRTC_USE_BUILTIN_ISAC_FIX
-#include "webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.h" // nogncheck
-#elif WEBRTC_USE_BUILTIN_ISAC_FLOAT
-#include "webrtc/api/audio_codecs/isac/audio_encoder_isac_float.h" // nogncheck
-#endif
-#if WEBRTC_USE_BUILTIN_OPUS
-#include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h" // nogncheck
-#endif
-
-namespace webrtc {
-
-namespace {
-
-// Modify an audio encoder to not advertise support for anything.
-template <typename T>
-struct NotAdvertised {
- using Config = typename T::Config;
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
- return T::SdpToConfig(audio_format);
- }
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
- // Don't advertise support for anything.
- }
- static AudioCodecInfo QueryAudioEncoder(const Config& config) {
- return T::QueryAudioEncoder(config);
- }
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(const Config& config,
- int payload_type) {
- return T::MakeAudioEncoder(config, payload_type);
- }
-};
-
-} // namespace
-
-rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() {
- return CreateAudioEncoderFactory<
-
-#if WEBRTC_USE_BUILTIN_OPUS
- AudioEncoderOpus,
-#endif
-
-#if WEBRTC_USE_BUILTIN_ISAC_FIX
- AudioEncoderIsacFix,
-#elif WEBRTC_USE_BUILTIN_ISAC_FLOAT
- AudioEncoderIsacFloat,
-#endif
-
-#if WEBRTC_USE_BUILTIN_G722
- AudioEncoderG722,
-#endif
-
-#if WEBRTC_USE_BUILTIN_ILBC
- AudioEncoderIlbc,
-#endif
-
- AudioEncoderG711, NotAdvertised<AudioEncoderL16>>();
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/builtin_audio_encoder_factory.h b/api/audio_codecs/builtin_audio_encoder_factory.h
deleted file mode 100644
index 1546cfb..0000000
--- a/api/audio_codecs/builtin_audio_encoder_factory.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2016 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 WEBRTC_API_AUDIO_CODECS_BUILTIN_AUDIO_ENCODER_FACTORY_H_
-#define WEBRTC_API_AUDIO_CODECS_BUILTIN_AUDIO_ENCODER_FACTORY_H_
-
-#include "webrtc/api/audio_codecs/audio_encoder_factory.h"
-#include "webrtc/rtc_base/scoped_ref_ptr.h"
-
-namespace webrtc {
-
-// Creates a new factory that can create the built-in types of audio encoders.
-// NOTE: This function is still under development and may change without notice.
-rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory();
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_BUILTIN_AUDIO_ENCODER_FACTORY_H_
diff --git a/api/audio_codecs/g711/BUILD.gn b/api/audio_codecs/g711/BUILD.gn
deleted file mode 100644
index aa86490..0000000
--- a/api/audio_codecs/g711/BUILD.gn
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_static_library("audio_encoder_g711") {
- sources = [
- "audio_encoder_g711.cc",
- "audio_encoder_g711.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:g711",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_decoder_g711") {
- sources = [
- "audio_decoder_g711.cc",
- "audio_decoder_g711.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:g711",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
diff --git a/api/audio_codecs/g711/audio_decoder_g711.cc b/api/audio_codecs/g711/audio_decoder_g711.cc
deleted file mode 100644
index cb4b074..0000000
--- a/api/audio_codecs/g711/audio_decoder_g711.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/g711/audio_decoder_g711.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
- const SdpAudioFormat& format) {
- const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
- const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
- if (format.clockrate_hz == 8000 && format.num_channels >= 1 &&
- (is_pcmu || is_pcma)) {
- Config config;
- config.type = is_pcmu ? Config::Type::kPcmU : Config::Type::kPcmA;
- config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
- RTC_DCHECK(config.IsOk());
- return rtc::Optional<Config>(config);
- } else {
- return rtc::Optional<Config>();
- }
-}
-
-void AudioDecoderG711::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- for (const char* type : {"PCMU", "PCMA"}) {
- specs->push_back({{type, 8000, 1}, {8000, 1, 64000}});
- }
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder(
- const Config& config) {
- RTC_DCHECK(config.IsOk());
- switch (config.type) {
- case Config::Type::kPcmU:
- return rtc::MakeUnique<AudioDecoderPcmU>(config.num_channels);
- case Config::Type::kPcmA:
- return rtc::MakeUnique<AudioDecoderPcmA>(config.num_channels);
- default:
- return nullptr;
- }
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/g711/audio_decoder_g711.h b/api/audio_codecs/g711/audio_decoder_g711.h
deleted file mode 100644
index 2824c32..0000000
--- a/api/audio_codecs/g711/audio_decoder_g711.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_G711_AUDIO_DECODER_G711_H_
-#define WEBRTC_API_AUDIO_CODECS_G711_AUDIO_DECODER_G711_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// G711 decoder API for use as a template parameter to
-// CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderG711 {
- struct Config {
- enum class Type { kPcmU, kPcmA };
- bool IsOk() const {
- return (type == Type::kPcmU || type == Type::kPcmA) && num_channels >= 1;
- }
- Type type;
- int num_channels;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const Config& config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_G711_AUDIO_DECODER_G711_H_
diff --git a/api/audio_codecs/g711/audio_encoder_g711.cc b/api/audio_codecs/g711/audio_encoder_g711.cc
deleted file mode 100644
index 28fb951..0000000
--- a/api/audio_codecs/g711/audio_encoder_g711.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/g711/audio_encoder_g711.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-#include "webrtc/rtc_base/safe_minmax.h"
-#include "webrtc/rtc_base/string_to_number.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
- const SdpAudioFormat& format) {
- const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
- const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
- if (format.clockrate_hz == 8000 && format.num_channels >= 1 &&
- (is_pcmu || is_pcma)) {
- Config config;
- config.type = is_pcmu ? Config::Type::kPcmU : Config::Type::kPcmA;
- config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
- config.frame_size_ms = 20;
- auto ptime_iter = format.parameters.find("ptime");
- if (ptime_iter != format.parameters.end()) {
- const auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
- if (ptime && *ptime > 0) {
- config.frame_size_ms = rtc::SafeClamp(10 * (*ptime / 10), 10, 60);
- }
- }
- RTC_DCHECK(config.IsOk());
- return rtc::Optional<Config>(config);
- } else {
- return rtc::Optional<Config>();
- }
-}
-
-void AudioEncoderG711::AppendSupportedEncoders(
- std::vector<AudioCodecSpec>* specs) {
- for (const char* type : {"PCMU", "PCMA"}) {
- specs->push_back({{type, 8000, 1}, {8000, 1, 64000}});
- }
-}
-
-AudioCodecInfo AudioEncoderG711::QueryAudioEncoder(const Config& config) {
- RTC_DCHECK(config.IsOk());
- return {8000, rtc::dchecked_cast<size_t>(config.num_channels),
- 64000 * config.num_channels};
-}
-
-std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
- const Config& config,
- int payload_type) {
- RTC_DCHECK(config.IsOk());
- switch (config.type) {
- case Config::Type::kPcmU: {
- AudioEncoderPcmU::Config impl_config;
- impl_config.num_channels = config.num_channels;
- impl_config.frame_size_ms = config.frame_size_ms;
- impl_config.payload_type = payload_type;
- return rtc::MakeUnique<AudioEncoderPcmU>(impl_config);
- }
- case Config::Type::kPcmA: {
- AudioEncoderPcmA::Config impl_config;
- impl_config.num_channels = config.num_channels;
- impl_config.frame_size_ms = config.frame_size_ms;
- impl_config.payload_type = payload_type;
- return rtc::MakeUnique<AudioEncoderPcmA>(impl_config);
- }
- default: { return nullptr; }
- }
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/g711/audio_encoder_g711.h b/api/audio_codecs/g711/audio_encoder_g711.h
deleted file mode 100644
index 5750100..0000000
--- a/api/audio_codecs/g711/audio_encoder_g711.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_G711_AUDIO_ENCODER_G711_H_
-#define WEBRTC_API_AUDIO_CODECS_G711_AUDIO_ENCODER_G711_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// G711 encoder API for use as a template parameter to
-// CreateAudioEncoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderG711 {
- struct Config {
- enum class Type { kPcmU, kPcmA };
- bool IsOk() const {
- return (type == Type::kPcmU || type == Type::kPcmA) &&
- frame_size_ms > 0 && frame_size_ms % 10 == 0 && num_channels >= 1;
- }
- Type type = Type::kPcmU;
- int num_channels = 1;
- int frame_size_ms = 20;
- };
- static rtc::Optional<AudioEncoderG711::Config> SdpToConfig(
- const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(const Config& config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(const Config& config,
- int payload_type);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_G711_AUDIO_ENCODER_G711_H_
diff --git a/api/audio_codecs/g722/BUILD.gn b/api/audio_codecs/g722/BUILD.gn
deleted file mode 100644
index 5af7e5c..0000000
--- a/api/audio_codecs/g722/BUILD.gn
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_source_set("audio_encoder_g722_config") {
- sources = [
- "audio_encoder_g722_config.h",
- ]
-}
-
-rtc_static_library("audio_encoder_g722") {
- sources = [
- "audio_encoder_g722.cc",
- "audio_encoder_g722.h",
- ]
- deps = [
- ":audio_encoder_g722_config",
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:g722",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_decoder_g722") {
- sources = [
- "audio_decoder_g722.cc",
- "audio_decoder_g722.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:g722",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
diff --git a/api/audio_codecs/g722/audio_decoder_g722.cc b/api/audio_codecs/g722/audio_decoder_g722.cc
deleted file mode 100644
index 6f3ce97..0000000
--- a/api/audio_codecs/g722/audio_decoder_g722.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/g722/audio_decoder_g722.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
- const SdpAudioFormat& format) {
- return STR_CASE_CMP(format.name.c_str(), "G722") == 0 &&
- format.clockrate_hz == 8000 &&
- (format.num_channels == 1 || format.num_channels == 2)
- ? rtc::Optional<Config>(
- Config{rtc::dchecked_cast<int>(format.num_channels)})
- : rtc::Optional<Config>();
-}
-
-void AudioDecoderG722::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- specs->push_back({{"G722", 8000, 1}, {16000, 1, 64000}});
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
- Config config) {
- switch (config.num_channels) {
- case 1:
- return rtc::MakeUnique<AudioDecoderG722Impl>();
- case 2:
- return rtc::MakeUnique<AudioDecoderG722StereoImpl>();
- default:
- return nullptr;
- }
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/g722/audio_decoder_g722.h b/api/audio_codecs/g722/audio_decoder_g722.h
deleted file mode 100644
index cf0dfa9..0000000
--- a/api/audio_codecs/g722/audio_decoder_g722.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_G722_AUDIO_DECODER_G722_H_
-#define WEBRTC_API_AUDIO_CODECS_G722_AUDIO_DECODER_G722_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// G722 decoder API for use as a template parameter to
-// CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderG722 {
- struct Config {
- bool IsOk() const { return num_channels == 1 || num_channels == 2; }
- int num_channels;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(Config config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_G722_AUDIO_DECODER_G722_H_
diff --git a/api/audio_codecs/g722/audio_encoder_g722.cc b/api/audio_codecs/g722/audio_encoder_g722.cc
deleted file mode 100644
index b9df585..0000000
--- a/api/audio_codecs/g722/audio_encoder_g722.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/g722/audio_encoder_g722.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-#include "webrtc/rtc_base/safe_minmax.h"
-#include "webrtc/rtc_base/string_to_number.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
- const SdpAudioFormat& format) {
- if (STR_CASE_CMP(format.name.c_str(), "g722") != 0 ||
- format.clockrate_hz != 8000) {
- return rtc::Optional<AudioEncoderG722Config>();
- }
-
- AudioEncoderG722Config config;
- config.num_channels = rtc::checked_cast<int>(format.num_channels);
- auto ptime_iter = format.parameters.find("ptime");
- if (ptime_iter != format.parameters.end()) {
- auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
- if (ptime && *ptime > 0) {
- const int whole_packets = *ptime / 10;
- config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 10, 60);
- }
- }
- return config.IsOk() ? rtc::Optional<AudioEncoderG722Config>(config)
- : rtc::Optional<AudioEncoderG722Config>();
-}
-
-void AudioEncoderG722::AppendSupportedEncoders(
- std::vector<AudioCodecSpec>* specs) {
- const SdpAudioFormat fmt = {"G722", 8000, 1};
- const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
- specs->push_back({fmt, info});
-}
-
-AudioCodecInfo AudioEncoderG722::QueryAudioEncoder(
- const AudioEncoderG722Config& config) {
- RTC_DCHECK(config.IsOk());
- return {16000, rtc::dchecked_cast<size_t>(config.num_channels),
- 64000 * config.num_channels};
-}
-
-std::unique_ptr<AudioEncoder> AudioEncoderG722::MakeAudioEncoder(
- const AudioEncoderG722Config& config,
- int payload_type) {
- RTC_DCHECK(config.IsOk());
- return rtc::MakeUnique<AudioEncoderG722Impl>(config, payload_type);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/g722/audio_encoder_g722.h b/api/audio_codecs/g722/audio_encoder_g722.h
deleted file mode 100644
index 37cb968..0000000
--- a/api/audio_codecs/g722/audio_encoder_g722.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_H_
-#define WEBRTC_API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/audio_codecs/g722/audio_encoder_g722_config.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// G722 encoder API for use as a template parameter to
-// CreateAudioEncoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderG722 {
- static rtc::Optional<AudioEncoderG722Config> SdpToConfig(
- const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(const AudioEncoderG722Config& config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- const AudioEncoderG722Config& config,
- int payload_type);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_H_
diff --git a/api/audio_codecs/g722/audio_encoder_g722_config.h b/api/audio_codecs/g722/audio_encoder_g722_config.h
deleted file mode 100644
index fa26942..0000000
--- a/api/audio_codecs/g722/audio_encoder_g722_config.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_CONFIG_H_
-#define WEBRTC_API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_CONFIG_H_
-
-namespace webrtc {
-
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderG722Config {
- bool IsOk() const {
- return frame_size_ms > 0 && frame_size_ms % 10 == 0 && num_channels >= 1;
- }
- int frame_size_ms = 20;
- int num_channels = 1;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_CONFIG_H_
diff --git a/api/audio_codecs/ilbc/BUILD.gn b/api/audio_codecs/ilbc/BUILD.gn
deleted file mode 100644
index 0f5f80d..0000000
--- a/api/audio_codecs/ilbc/BUILD.gn
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_source_set("audio_encoder_ilbc_config") {
- sources = [
- "audio_encoder_ilbc_config.h",
- ]
-}
-
-rtc_static_library("audio_encoder_ilbc") {
- sources = [
- "audio_encoder_ilbc.cc",
- "audio_encoder_ilbc.h",
- ]
- deps = [
- ":audio_encoder_ilbc_config",
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:ilbc",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_decoder_ilbc") {
- sources = [
- "audio_decoder_ilbc.cc",
- "audio_decoder_ilbc.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:ilbc",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
diff --git a/api/audio_codecs/ilbc/audio_decoder_ilbc.cc b/api/audio_codecs/ilbc/audio_decoder_ilbc.cc
deleted file mode 100644
index dc17751..0000000
--- a/api/audio_codecs/ilbc/audio_decoder_ilbc.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
-#include "webrtc/rtc_base/ptr_util.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
- const SdpAudioFormat& format) {
- return STR_CASE_CMP(format.name.c_str(), "ILBC") == 0 &&
- format.clockrate_hz == 8000 && format.num_channels == 1
- ? rtc::Optional<Config>(Config())
- : rtc::Optional<Config>();
-}
-
-void AudioDecoderIlbc::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}});
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
- Config config) {
- return rtc::MakeUnique<AudioDecoderIlbcImpl>();
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/ilbc/audio_decoder_ilbc.h b/api/audio_codecs/ilbc/audio_decoder_ilbc.h
deleted file mode 100644
index 343308d..0000000
--- a/api/audio_codecs/ilbc/audio_decoder_ilbc.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_
-#define WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// ILBC decoder API for use as a template parameter to
-// CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderIlbc {
- struct Config {}; // Empty---no config values needed!
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(Config config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_
diff --git a/api/audio_codecs/ilbc/audio_encoder_ilbc.cc b/api/audio_codecs/ilbc/audio_encoder_ilbc.cc
deleted file mode 100644
index fd11f00..0000000
--- a/api/audio_codecs/ilbc/audio_encoder_ilbc.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc.h"
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/safe_conversions.h"
-#include "webrtc/rtc_base/safe_minmax.h"
-#include "webrtc/rtc_base/string_to_number.h"
-
-namespace webrtc {
-namespace {
-int GetIlbcBitrate(int ptime) {
- switch (ptime) {
- case 20:
- case 40:
- // 38 bytes per frame of 20 ms => 15200 bits/s.
- return 15200;
- case 30:
- case 60:
- // 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
- return 13333;
- default:
- FATAL();
- }
-}
-} // namespace
-
-rtc::Optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
- const SdpAudioFormat& format) {
- if (STR_CASE_CMP(format.name.c_str(), "ILBC") != 0 ||
- format.clockrate_hz != 8000 || format.num_channels != 1) {
- return rtc::Optional<AudioEncoderIlbcConfig>();
- }
-
- AudioEncoderIlbcConfig config;
- auto ptime_iter = format.parameters.find("ptime");
- if (ptime_iter != format.parameters.end()) {
- auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
- if (ptime && *ptime > 0) {
- const int whole_packets = *ptime / 10;
- config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 20, 60);
- }
- }
- return config.IsOk() ? rtc::Optional<AudioEncoderIlbcConfig>(config)
- : rtc::Optional<AudioEncoderIlbcConfig>();
-}
-
-void AudioEncoderIlbc::AppendSupportedEncoders(
- std::vector<AudioCodecSpec>* specs) {
- const SdpAudioFormat fmt = {"ILBC", 8000, 1};
- const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
- specs->push_back({fmt, info});
-}
-
-AudioCodecInfo AudioEncoderIlbc::QueryAudioEncoder(
- const AudioEncoderIlbcConfig& config) {
- RTC_DCHECK(config.IsOk());
- return {8000, 1, GetIlbcBitrate(config.frame_size_ms)};
-}
-
-std::unique_ptr<AudioEncoder> AudioEncoderIlbc::MakeAudioEncoder(
- const AudioEncoderIlbcConfig& config,
- int payload_type) {
- RTC_DCHECK(config.IsOk());
- return rtc::MakeUnique<AudioEncoderIlbcImpl>(config, payload_type);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/ilbc/audio_encoder_ilbc.h b/api/audio_codecs/ilbc/audio_encoder_ilbc.h
deleted file mode 100644
index a30d109..0000000
--- a/api/audio_codecs/ilbc/audio_encoder_ilbc.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_
-#define WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// ILBC encoder API for use as a template parameter to
-// CreateAudioEncoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderIlbc {
- static rtc::Optional<AudioEncoderIlbcConfig> SdpToConfig(
- const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(const AudioEncoderIlbcConfig& config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- const AudioEncoderIlbcConfig& config,
- int payload_type);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_
diff --git a/api/audio_codecs/ilbc/audio_encoder_ilbc_config.h b/api/audio_codecs/ilbc/audio_encoder_ilbc_config.h
deleted file mode 100644
index 429ac81..0000000
--- a/api/audio_codecs/ilbc/audio_encoder_ilbc_config.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_CONFIG_H_
-#define WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_CONFIG_H_
-
-namespace webrtc {
-
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderIlbcConfig {
- bool IsOk() const {
- return (frame_size_ms == 20 || frame_size_ms == 30 || frame_size_ms == 40 ||
- frame_size_ms == 60);
- }
- int frame_size_ms = 30; // Valid values are 20, 30, 40, and 60 ms.
- // Note that frame size 40 ms produces encodings with two 20 ms frames in
- // them, and frame size 60 ms consists of two 30 ms frames.
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_CONFIG_H_
diff --git a/api/audio_codecs/isac/BUILD.gn b/api/audio_codecs/isac/BUILD.gn
deleted file mode 100644
index b22eb95..0000000
--- a/api/audio_codecs/isac/BUILD.gn
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_static_library("audio_encoder_isac_fix") {
- sources = [
- "audio_encoder_isac_fix.cc",
- "audio_encoder_isac_fix.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:isac_fix",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_decoder_isac_fix") {
- sources = [
- "audio_decoder_isac_fix.cc",
- "audio_decoder_isac_fix.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:isac_fix",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_encoder_isac_float") {
- sources = [
- "audio_encoder_isac_float.cc",
- "audio_encoder_isac_float.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:isac",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
-
-rtc_static_library("audio_decoder_isac_float") {
- sources = [
- "audio_decoder_isac_float.cc",
- "audio_decoder_isac_float.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:isac",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
diff --git a/api/audio_codecs/isac/audio_decoder_isac_fix.cc b/api/audio_codecs/isac/audio_decoder_isac_fix.cc
deleted file mode 100644
index ef8655f..0000000
--- a/api/audio_codecs/isac/audio_decoder_isac_fix.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/isac/audio_decoder_isac_fix.h"
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h"
-#include "webrtc/rtc_base/ptr_util.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
- const SdpAudioFormat& format) {
- return STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
- format.clockrate_hz == 16000 && format.num_channels == 1
- ? rtc::Optional<Config>(Config())
- : rtc::Optional<Config>();
-}
-
-void AudioDecoderIsacFix::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}});
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderIsacFix::MakeAudioDecoder(
- Config config) {
- return rtc::MakeUnique<AudioDecoderIsacFixImpl>(16000);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/isac/audio_decoder_isac_fix.h b/api/audio_codecs/isac/audio_decoder_isac_fix.h
deleted file mode 100644
index 7662002..0000000
--- a/api/audio_codecs/isac/audio_decoder_isac_fix.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_DECODER_ISAC_FIX_H_
-#define WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_DECODER_ISAC_FIX_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// iSAC decoder API (fixed-point implementation) for use as a template
-// parameter to CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderIsacFix {
- struct Config {}; // Empty---no config values needed!
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(Config config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_DECODER_ISAC_FIX_H_
diff --git a/api/audio_codecs/isac/audio_decoder_isac_float.cc b/api/audio_codecs/isac/audio_decoder_isac_float.cc
deleted file mode 100644
index e26e651..0000000
--- a/api/audio_codecs/isac/audio_decoder_isac_float.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/isac/audio_decoder_isac_float.h"
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h"
-#include "webrtc/rtc_base/ptr_util.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderIsacFloat::Config> AudioDecoderIsacFloat::SdpToConfig(
- const SdpAudioFormat& format) {
- if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
- (format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
- format.num_channels == 1) {
- Config config;
- config.sample_rate_hz = format.clockrate_hz;
- return rtc::Optional<Config>(config);
- } else {
- return rtc::Optional<Config>();
- }
-}
-
-void AudioDecoderIsacFloat::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}});
- specs->push_back({{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}});
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderIsacFloat::MakeAudioDecoder(
- Config config) {
- RTC_DCHECK(config.IsOk());
- return rtc::MakeUnique<AudioDecoderIsacFloatImpl>(config.sample_rate_hz);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/isac/audio_decoder_isac_float.h b/api/audio_codecs/isac/audio_decoder_isac_float.h
deleted file mode 100644
index f0232e9..0000000
--- a/api/audio_codecs/isac/audio_decoder_isac_float.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_DECODER_ISAC_FLOAT_H_
-#define WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_DECODER_ISAC_FLOAT_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// iSAC decoder API (floating-point implementation) for use as a template
-// parameter to CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderIsacFloat {
- struct Config {
- bool IsOk() const {
- return sample_rate_hz == 16000 || sample_rate_hz == 32000;
- }
- int sample_rate_hz = 16000;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(Config config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_DECODER_ISAC_FLOAT_H_
diff --git a/api/audio_codecs/isac/audio_encoder_isac_fix.cc b/api/audio_codecs/isac/audio_encoder_isac_fix.cc
deleted file mode 100644
index c07957d..0000000
--- a/api/audio_codecs/isac/audio_encoder_isac_fix.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.h"
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/string_to_number.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
- const SdpAudioFormat& format) {
- if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
- format.clockrate_hz == 16000 && format.num_channels == 1) {
- Config config;
- const auto ptime_iter = format.parameters.find("ptime");
- if (ptime_iter != format.parameters.end()) {
- const auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
- if (ptime && *ptime >= 60) {
- config.frame_size_ms = 60;
- }
- }
- return rtc::Optional<Config>(config);
- } else {
- return rtc::Optional<Config>();
- }
-}
-
-void AudioEncoderIsacFix::AppendSupportedEncoders(
- std::vector<AudioCodecSpec>* specs) {
- const SdpAudioFormat fmt = {"ISAC", 16000, 1};
- const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
- specs->push_back({fmt, info});
-}
-
-AudioCodecInfo AudioEncoderIsacFix::QueryAudioEncoder(
- AudioEncoderIsacFix::Config config) {
- RTC_DCHECK(config.IsOk());
- return {16000, 1, 32000, 10000, 32000};
-}
-
-std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
- AudioEncoderIsacFix::Config config,
- int payload_type) {
- RTC_DCHECK(config.IsOk());
- AudioEncoderIsacFixImpl::Config c;
- c.frame_size_ms = config.frame_size_ms;
- c.payload_type = payload_type;
- return rtc::MakeUnique<AudioEncoderIsacFixImpl>(c);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/isac/audio_encoder_isac_fix.h b/api/audio_codecs/isac/audio_encoder_isac_fix.h
deleted file mode 100644
index ce4a1d0..0000000
--- a/api/audio_codecs/isac/audio_encoder_isac_fix.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_ENCODER_ISAC_FIX_H_
-#define WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_ENCODER_ISAC_FIX_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// iSAC encoder API (fixed-point implementation) for use as a template
-// parameter to CreateAudioEncoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderIsacFix {
- struct Config {
- bool IsOk() const { return frame_size_ms == 30 || frame_size_ms == 60; }
- int frame_size_ms = 30;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(Config config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(Config config,
- int payload_type);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_ENCODER_ISAC_FIX_H_
diff --git a/api/audio_codecs/isac/audio_encoder_isac_float.cc b/api/audio_codecs/isac/audio_encoder_isac_float.cc
deleted file mode 100644
index 500cfd1..0000000
--- a/api/audio_codecs/isac/audio_encoder_isac_float.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/isac/audio_encoder_isac_float.h"
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/rtc_base/string_to_number.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioEncoderIsacFloat::Config> AudioEncoderIsacFloat::SdpToConfig(
- const SdpAudioFormat& format) {
- if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
- (format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
- format.num_channels == 1) {
- Config config;
- config.sample_rate_hz = format.clockrate_hz;
- if (config.sample_rate_hz == 16000) {
- // For sample rate 16 kHz, optionally use 60 ms frames, instead of the
- // default 30 ms.
- const auto ptime_iter = format.parameters.find("ptime");
- if (ptime_iter != format.parameters.end()) {
- const auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
- if (ptime && *ptime >= 60) {
- config.frame_size_ms = 60;
- }
- }
- }
- return rtc::Optional<Config>(config);
- } else {
- return rtc::Optional<Config>();
- }
-}
-
-void AudioEncoderIsacFloat::AppendSupportedEncoders(
- std::vector<AudioCodecSpec>* specs) {
- for (int sample_rate_hz : {16000, 32000}) {
- const SdpAudioFormat fmt = {"ISAC", sample_rate_hz, 1};
- const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
- specs->push_back({fmt, info});
- }
-}
-
-AudioCodecInfo AudioEncoderIsacFloat::QueryAudioEncoder(
- const AudioEncoderIsacFloat::Config& config) {
- RTC_DCHECK(config.IsOk());
- constexpr int min_bitrate = 10000;
- const int max_bitrate = config.sample_rate_hz == 16000 ? 32000 : 56000;
- const int default_bitrate = max_bitrate;
- return {config.sample_rate_hz, 1, default_bitrate, min_bitrate, max_bitrate};
-}
-
-std::unique_ptr<AudioEncoder> AudioEncoderIsacFloat::MakeAudioEncoder(
- const AudioEncoderIsacFloat::Config& config,
- int payload_type) {
- RTC_DCHECK(config.IsOk());
- AudioEncoderIsacFloatImpl::Config c;
- c.sample_rate_hz = config.sample_rate_hz;
- c.frame_size_ms = config.frame_size_ms;
- c.payload_type = payload_type;
- return rtc::MakeUnique<AudioEncoderIsacFloatImpl>(c);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/isac/audio_encoder_isac_float.h b/api/audio_codecs/isac/audio_encoder_isac_float.h
deleted file mode 100644
index 244e59b..0000000
--- a/api/audio_codecs/isac/audio_encoder_isac_float.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_ENCODER_ISAC_FLOAT_H_
-#define WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_ENCODER_ISAC_FLOAT_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_encoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// iSAC encoder API (floating-point implementation) for use as a template
-// parameter to CreateAudioEncoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderIsacFloat {
- struct Config {
- bool IsOk() const {
- return (sample_rate_hz == 16000 &&
- (frame_size_ms == 30 || frame_size_ms == 60)) ||
- (sample_rate_hz == 32000 && frame_size_ms == 30);
- }
- int sample_rate_hz = 16000;
- int frame_size_ms = 30;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(const Config& config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(const Config& config,
- int payload_type);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_ISAC_AUDIO_ENCODER_ISAC_FLOAT_H_
diff --git a/api/audio_codecs/opus/BUILD.gn b/api/audio_codecs/opus/BUILD.gn
deleted file mode 100644
index faa5956..0000000
--- a/api/audio_codecs/opus/BUILD.gn
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-rtc_static_library("audio_encoder_opus_config") {
- sources = [
- "audio_encoder_opus_config.cc",
- "audio_encoder_opus_config.h",
- ]
- deps = [
- "../..:optional",
- "../../../rtc_base:rtc_base_approved",
- ]
- defines = []
- if (rtc_opus_variable_complexity) {
- defines += [ "WEBRTC_OPUS_VARIABLE_COMPLEXITY=1" ]
- } else {
- defines += [ "WEBRTC_OPUS_VARIABLE_COMPLEXITY=0" ]
- }
-}
-
-rtc_source_set("audio_encoder_opus") {
- sources = [
- "audio_encoder_opus.h",
- ]
- deps = [
- ":audio_encoder_opus_config",
- "..:audio_codecs_api",
- "../../../modules/audio_coding:webrtc_opus",
- "../../../rtc_base:rtc_base_approved",
- ]
- public_deps = [
- # TODO(kwiberg): Remove this public_dep when bug 7847 has been fixed.
- "../../../rtc_base:protobuf_utils",
- ]
-}
-
-rtc_static_library("audio_decoder_opus") {
- sources = [
- "audio_decoder_opus.cc",
- "audio_decoder_opus.h",
- ]
- deps = [
- "..:audio_codecs_api",
- "../..:optional",
- "../../..:webrtc_common",
- "../../../modules/audio_coding:webrtc_opus",
- "../../../rtc_base:rtc_base_approved",
- ]
-}
diff --git a/api/audio_codecs/opus/audio_decoder_opus.cc b/api/audio_codecs/opus/audio_decoder_opus.cc
deleted file mode 100644
index 7f478fe..0000000
--- a/api/audio_codecs/opus/audio_decoder_opus.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/opus/audio_decoder_opus.h"
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"
-#include "webrtc/rtc_base/ptr_util.h"
-
-namespace webrtc {
-
-rtc::Optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
- const SdpAudioFormat& format) {
- const rtc::Optional<int> num_channels = [&] {
- auto stereo = format.parameters.find("stereo");
- if (stereo != format.parameters.end()) {
- if (stereo->second == "0") {
- return rtc::Optional<int>(1);
- } else if (stereo->second == "1") {
- return rtc::Optional<int>(2);
- } else {
- return rtc::Optional<int>(); // Bad stereo parameter.
- }
- }
- return rtc::Optional<int>(1); // Default to mono.
- }();
- if (STR_CASE_CMP(format.name.c_str(), "opus") == 0 &&
- format.clockrate_hz == 48000 && format.num_channels == 2 &&
- num_channels) {
- return rtc::Optional<Config>(Config{*num_channels});
- } else {
- return rtc::Optional<Config>();
- }
-}
-
-void AudioDecoderOpus::AppendSupportedDecoders(
- std::vector<AudioCodecSpec>* specs) {
- AudioCodecInfo opus_info{48000, 1, 64000, 6000, 510000};
- opus_info.allow_comfort_noise = false;
- opus_info.supports_network_adaption = true;
- SdpAudioFormat opus_format(
- {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}});
- specs->push_back({std::move(opus_format), std::move(opus_info)});
-}
-
-std::unique_ptr<AudioDecoder> AudioDecoderOpus::MakeAudioDecoder(
- Config config) {
- return rtc::MakeUnique<AudioDecoderOpusImpl>(config.num_channels);
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/opus/audio_decoder_opus.h b/api/audio_codecs/opus/audio_decoder_opus.h
deleted file mode 100644
index 272503d..0000000
--- a/api/audio_codecs/opus/audio_decoder_opus.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
-#define WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
-
-#include <memory>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// Opus decoder API for use as a template parameter to
-// CreateAudioDecoderFactory<...>().
-//
-// NOTE: This struct is still under development and may change without notice.
-struct AudioDecoderOpus {
- struct Config {
- int num_channels;
- };
- static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(Config config);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
diff --git a/api/audio_codecs/opus/audio_encoder_opus.h b/api/audio_codecs/opus/audio_encoder_opus.h
deleted file mode 100644
index 4763f44..0000000
--- a/api/audio_codecs/opus/audio_encoder_opus.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
-#define WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
-
-#include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h"
-
-namespace webrtc {
-
-// Opus encoder API for use as a template parameter to
-// CreateAudioEncoderFactory<...>().
-//
-// NOTE: At the moment, this struct actually resides in another file. This is a
-// temporary backwards compatibility hack; see
-// https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
-//
-// NOTE: This struct is still under development and may change without notice.
-/*
-struct AudioEncoderOpus {
- static rtc::Optional<AudioEncoderOpusConfig> SdpToConfig(
- const SdpAudioFormat& audio_format);
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
- static AudioCodecInfo QueryAudioEncoder(const AudioEncoderOpusConfig& config);
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
- const AudioEncoderOpusConfig&,
- int payload_type);
-};
-*/
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
diff --git a/api/audio_codecs/opus/audio_encoder_opus_config.cc b/api/audio_codecs/opus/audio_encoder_opus_config.cc
deleted file mode 100644
index 7d29883..0000000
--- a/api/audio_codecs/opus/audio_encoder_opus_config.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/opus/audio_encoder_opus_config.h"
-
-namespace webrtc {
-
-namespace {
-
-#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM)
-// If we are on Android, iOS and/or ARM, use a lower complexity setting by
-// default, to save encoder complexity.
-constexpr int kDefaultComplexity = 5;
-#else
-constexpr int kDefaultComplexity = 9;
-#endif
-
-constexpr int kDefaultLowRateComplexity =
- WEBRTC_OPUS_VARIABLE_COMPLEXITY ? 9 : kDefaultComplexity;
-
-} // namespace
-
-constexpr int AudioEncoderOpusConfig::kDefaultFrameSizeMs;
-constexpr int AudioEncoderOpusConfig::kMinBitrateBps;
-constexpr int AudioEncoderOpusConfig::kMaxBitrateBps;
-
-AudioEncoderOpusConfig::AudioEncoderOpusConfig()
- : frame_size_ms(kDefaultFrameSizeMs),
- num_channels(1),
- application(ApplicationMode::kVoip),
- bitrate_bps(32000),
- fec_enabled(false),
- cbr_enabled(false),
- max_playback_rate_hz(48000),
- complexity(kDefaultComplexity),
- low_rate_complexity(kDefaultLowRateComplexity),
- complexity_threshold_bps(12500),
- complexity_threshold_window_bps(1500),
- dtx_enabled(false),
- uplink_bandwidth_update_interval_ms(200),
- payload_type(-1) {}
-AudioEncoderOpusConfig::AudioEncoderOpusConfig(const AudioEncoderOpusConfig&) =
- default;
-AudioEncoderOpusConfig::~AudioEncoderOpusConfig() = default;
-AudioEncoderOpusConfig& AudioEncoderOpusConfig::operator=(
- const AudioEncoderOpusConfig&) = default;
-
-bool AudioEncoderOpusConfig::IsOk() const {
- if (frame_size_ms <= 0 || frame_size_ms % 10 != 0)
- return false;
- if (num_channels != 1 && num_channels != 2)
- return false;
- if (!bitrate_bps)
- return false;
- if (*bitrate_bps < kMinBitrateBps || *bitrate_bps > kMaxBitrateBps)
- return false;
- if (complexity < 0 || complexity > 10)
- return false;
- if (low_rate_complexity < 0 || low_rate_complexity > 10)
- return false;
- return true;
-}
-} // namespace webrtc
diff --git a/api/audio_codecs/opus/audio_encoder_opus_config.h b/api/audio_codecs/opus/audio_encoder_opus_config.h
deleted file mode 100644
index d07f784..0000000
--- a/api/audio_codecs/opus/audio_encoder_opus_config.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2017 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 WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_
-#define WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_
-
-#include <stddef.h>
-
-#include <vector>
-
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// NOTE: This struct is still under development and may change without notice.
-struct AudioEncoderOpusConfig {
- static constexpr int kDefaultFrameSizeMs = 20;
-
- // Opus API allows a min bitrate of 500bps, but Opus documentation suggests
- // bitrate should be in the range of 6000 to 510000, inclusive.
- static constexpr int kMinBitrateBps = 6000;
- static constexpr int kMaxBitrateBps = 510000;
-
- AudioEncoderOpusConfig();
- AudioEncoderOpusConfig(const AudioEncoderOpusConfig&);
- ~AudioEncoderOpusConfig();
- AudioEncoderOpusConfig& operator=(const AudioEncoderOpusConfig&);
-
- bool IsOk() const; // Checks if the values are currently OK.
-
- int frame_size_ms;
- size_t num_channels;
- enum class ApplicationMode { kVoip, kAudio };
- ApplicationMode application;
-
- // NOTE: This member must always be set.
- // TODO(kwiberg): Turn it into just an int.
- rtc::Optional<int> bitrate_bps;
-
- bool fec_enabled;
- bool cbr_enabled;
- int max_playback_rate_hz;
-
- // |complexity| is used when the bitrate goes above
- // |complexity_threshold_bps| + |complexity_threshold_window_bps|;
- // |low_rate_complexity| is used when the bitrate falls below
- // |complexity_threshold_bps| - |complexity_threshold_window_bps|. In the
- // interval in the middle, we keep using the most recent of the two
- // complexity settings.
- int complexity;
- int low_rate_complexity;
- int complexity_threshold_bps;
- int complexity_threshold_window_bps;
-
- bool dtx_enabled;
- std::vector<int> supported_frame_lengths_ms;
- int uplink_bandwidth_update_interval_ms;
-
- // NOTE: This member isn't necessary, and will soon go away. See
- // https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
- int payload_type;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_CONFIG_H_
diff --git a/api/audio_codecs/test/BUILD.gn b/api/audio_codecs/test/BUILD.gn
deleted file mode 100644
index 0f742f5..0000000
--- a/api/audio_codecs/test/BUILD.gn
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2017 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")
-if (is_android) {
- import("//build/config/android/config.gni")
- import("//build/config/android/rules.gni")
-}
-
-if (rtc_include_tests) {
- rtc_source_set("audio_codecs_api_unittests") {
- testonly = true
- sources = [
- "audio_decoder_factory_template_unittest.cc",
- "audio_encoder_factory_template_unittest.cc",
- ]
- deps = [
- "..:audio_codecs_api",
- "../../../rtc_base:rtc_base_approved",
- "../../../test:audio_codec_mocks",
- "../../../test:test_support",
- "../L16:audio_decoder_L16",
- "../L16:audio_encoder_L16",
- "../g711:audio_decoder_g711",
- "../g711:audio_encoder_g711",
- "../g722:audio_decoder_g722",
- "../g722:audio_encoder_g722",
- "../ilbc:audio_decoder_ilbc",
- "../ilbc:audio_encoder_ilbc",
- "../isac:audio_decoder_isac_fix",
- "../isac:audio_decoder_isac_float",
- "../isac:audio_encoder_isac_fix",
- "../isac:audio_encoder_isac_float",
- "../opus:audio_decoder_opus",
- "../opus:audio_encoder_opus",
- "//testing/gmock",
- ]
- }
-}
diff --git a/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc b/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
deleted file mode 100644
index 0b1135c..0000000
--- a/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/audio_decoder_factory_template.h"
-#include "webrtc/api/audio_codecs/L16/audio_decoder_L16.h"
-#include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h"
-#include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h"
-#include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h"
-#include "webrtc/api/audio_codecs/isac/audio_decoder_isac_fix.h"
-#include "webrtc/api/audio_codecs/isac/audio_decoder_isac_float.h"
-#include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/test/gmock.h"
-#include "webrtc/test/gtest.h"
-#include "webrtc/test/mock_audio_decoder.h"
-
-namespace webrtc {
-
-namespace {
-
-struct BogusParams {
- static SdpAudioFormat AudioFormat() { return {"bogus", 8000, 1}; }
- static AudioCodecInfo CodecInfo() { return {8000, 1, 12345}; }
-};
-
-struct ShamParams {
- static SdpAudioFormat AudioFormat() {
- return {"sham", 16000, 2, {{"param", "value"}}};
- }
- static AudioCodecInfo CodecInfo() { return {16000, 2, 23456}; }
-};
-
-struct MyLittleConfig {
- SdpAudioFormat audio_format;
-};
-
-template <typename Params>
-struct AudioDecoderFakeApi {
- static rtc::Optional<MyLittleConfig> SdpToConfig(
- const SdpAudioFormat& audio_format) {
- if (Params::AudioFormat() == audio_format) {
- MyLittleConfig config = {audio_format};
- return rtc::Optional<MyLittleConfig>(config);
- } else {
- return rtc::Optional<MyLittleConfig>();
- }
- }
-
- static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
- specs->push_back({Params::AudioFormat(), Params::CodecInfo()});
- }
-
- static AudioCodecInfo QueryAudioDecoder(const MyLittleConfig&) {
- return Params::CodecInfo();
- }
-
- static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const MyLittleConfig&) {
- auto dec = rtc::MakeUnique<testing::StrictMock<MockAudioDecoder>>();
- EXPECT_CALL(*dec, SampleRateHz())
- .WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
- EXPECT_CALL(*dec, Die());
- return std::move(dec);
- }
-};
-
-} // namespace
-
-TEST(AudioDecoderFactoryTemplateTest, NoDecoderTypes) {
- rtc::scoped_refptr<AudioDecoderFactory> factory(
- new rtc::RefCountedObject<
- audio_decoder_factory_template_impl::AudioDecoderFactoryT<>>());
- EXPECT_THAT(factory->GetSupportedDecoders(), testing::IsEmpty());
- EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
-}
-
-TEST(AudioDecoderFactoryTemplateTest, OneDecoderType) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderFakeApi<BogusParams>>();
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"bogus", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
- auto dec = factory->MakeAudioDecoder({"bogus", 8000, 1});
- ASSERT_NE(nullptr, dec);
- EXPECT_EQ(8000, dec->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, TwoDecoderTypes) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderFakeApi<BogusParams>,
- AudioDecoderFakeApi<ShamParams>>();
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}},
- AudioCodecSpec{{"sham", 16000, 2, {{"param", "value"}}},
- {16000, 2, 23456}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"bogus", 8000, 1}));
- EXPECT_TRUE(
- factory->IsSupportedDecoder({"sham", 16000, 2, {{"param", "value"}}}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
- auto dec1 = factory->MakeAudioDecoder({"bogus", 8000, 1});
- ASSERT_NE(nullptr, dec1);
- EXPECT_EQ(8000, dec1->SampleRateHz());
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"sham", 16000, 2}));
- auto dec2 =
- factory->MakeAudioDecoder({"sham", 16000, 2, {{"param", "value"}}});
- ASSERT_NE(nullptr, dec2);
- EXPECT_EQ(16000, dec2->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, G711) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderG711>();
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
- AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"G711", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"PCMU", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"pcma", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"pcmu", 16000, 1}));
- auto dec1 = factory->MakeAudioDecoder({"pcmu", 8000, 1});
- ASSERT_NE(nullptr, dec1);
- EXPECT_EQ(8000, dec1->SampleRateHz());
- auto dec2 = factory->MakeAudioDecoder({"PCMA", 8000, 1});
- ASSERT_NE(nullptr, dec2);
- EXPECT_EQ(8000, dec2->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, G722) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderG722>();
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"G722", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
- auto dec1 = factory->MakeAudioDecoder({"G722", 8000, 1});
- ASSERT_NE(nullptr, dec1);
- EXPECT_EQ(16000, dec1->SampleRateHz());
- EXPECT_EQ(1u, dec1->Channels());
- auto dec2 = factory->MakeAudioDecoder({"G722", 8000, 2});
- ASSERT_NE(nullptr, dec2);
- EXPECT_EQ(16000, dec2->SampleRateHz());
- EXPECT_EQ(2u, dec2->Channels());
- auto dec3 = factory->MakeAudioDecoder({"G722", 8000, 3});
- ASSERT_EQ(nullptr, dec3);
-}
-
-TEST(AudioDecoderFactoryTemplateTest, Ilbc) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderIlbc>();
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1}));
- auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1});
- ASSERT_NE(nullptr, dec);
- EXPECT_EQ(8000, dec->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, IsacFix) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderIsacFix>();
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(AudioCodecSpec{
- {"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"isac", 16000, 2}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"isac", 32000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"isac", 8000, 1}));
- auto dec = factory->MakeAudioDecoder({"isac", 16000, 1});
- ASSERT_NE(nullptr, dec);
- EXPECT_EQ(16000, dec->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, IsacFloat) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderIsacFloat>();
- EXPECT_THAT(
- factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}},
- AudioCodecSpec{{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"isac", 16000, 2}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 32000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"isac", 8000, 1}));
- auto dec1 = factory->MakeAudioDecoder({"isac", 16000, 1});
- ASSERT_NE(nullptr, dec1);
- EXPECT_EQ(16000, dec1->SampleRateHz());
- auto dec2 = factory->MakeAudioDecoder({"isac", 32000, 1});
- ASSERT_NE(nullptr, dec2);
- EXPECT_EQ(32000, dec2->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, L16) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderL16>();
- EXPECT_THAT(
- factory->GetSupportedDecoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"L16", 8000, 1}, {8000, 1, 8000 * 16}},
- AudioCodecSpec{{"L16", 16000, 1}, {16000, 1, 16000 * 16}},
- AudioCodecSpec{{"L16", 32000, 1}, {32000, 1, 32000 * 16}},
- AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}},
- AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}},
- AudioCodecSpec{{"L16", 32000, 2}, {32000, 2, 32000 * 16 * 2}}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"L16", 48000, 1}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"L16", 96000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"L16", 8000, 0}));
- auto dec = factory->MakeAudioDecoder({"L16", 48000, 2});
- ASSERT_NE(nullptr, dec);
- EXPECT_EQ(48000, dec->SampleRateHz());
-}
-
-TEST(AudioDecoderFactoryTemplateTest, Opus) {
- auto factory = CreateAudioDecoderFactory<AudioDecoderOpus>();
- AudioCodecInfo opus_info{48000, 1, 64000, 6000, 510000};
- opus_info.allow_comfort_noise = false;
- opus_info.supports_network_adaption = true;
- const SdpAudioFormat opus_format(
- {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}});
- EXPECT_THAT(factory->GetSupportedDecoders(),
- testing::ElementsAre(AudioCodecSpec{opus_format, opus_info}));
- EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1}));
- EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2}));
- EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
- auto dec = factory->MakeAudioDecoder({"opus", 48000, 2});
- ASSERT_NE(nullptr, dec);
- EXPECT_EQ(48000, dec->SampleRateHz());
-}
-
-} // namespace webrtc
diff --git a/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc b/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc
deleted file mode 100644
index 891821a..0000000
--- a/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/audio_codecs/audio_encoder_factory_template.h"
-#include "webrtc/api/audio_codecs/L16/audio_encoder_L16.h"
-#include "webrtc/api/audio_codecs/g711/audio_encoder_g711.h"
-#include "webrtc/api/audio_codecs/g722/audio_encoder_g722.h"
-#include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc.h"
-#include "webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.h"
-#include "webrtc/api/audio_codecs/isac/audio_encoder_isac_float.h"
-#include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h"
-#include "webrtc/rtc_base/ptr_util.h"
-#include "webrtc/test/gmock.h"
-#include "webrtc/test/gtest.h"
-#include "webrtc/test/mock_audio_encoder.h"
-
-namespace webrtc {
-
-namespace {
-
-struct BogusParams {
- static SdpAudioFormat AudioFormat() { return {"bogus", 8000, 1}; }
- static AudioCodecInfo CodecInfo() { return {8000, 1, 12345}; }
-};
-
-struct ShamParams {
- static SdpAudioFormat AudioFormat() {
- return {"sham", 16000, 2, {{"param", "value"}}};
- }
- static AudioCodecInfo CodecInfo() { return {16000, 2, 23456}; }
-};
-
-struct MyLittleConfig {
- SdpAudioFormat audio_format;
-};
-
-template <typename Params>
-struct AudioEncoderFakeApi {
- static rtc::Optional<MyLittleConfig> SdpToConfig(
- const SdpAudioFormat& audio_format) {
- if (Params::AudioFormat() == audio_format) {
- MyLittleConfig config = {audio_format};
- return rtc::Optional<MyLittleConfig>(config);
- } else {
- return rtc::Optional<MyLittleConfig>();
- }
- }
-
- static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
- specs->push_back({Params::AudioFormat(), Params::CodecInfo()});
- }
-
- static AudioCodecInfo QueryAudioEncoder(const MyLittleConfig&) {
- return Params::CodecInfo();
- }
-
- static std::unique_ptr<AudioEncoder> MakeAudioEncoder(const MyLittleConfig&,
- int payload_type) {
- auto enc = rtc::MakeUnique<testing::StrictMock<MockAudioEncoder>>();
- EXPECT_CALL(*enc, SampleRateHz())
- .WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
- EXPECT_CALL(*enc, Die());
- return std::move(enc);
- }
-};
-
-} // namespace
-
-TEST(AudioEncoderFactoryTemplateTest, NoEncoderTypes) {
- rtc::scoped_refptr<AudioEncoderFactory> factory(
- new rtc::RefCountedObject<
- audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>());
- EXPECT_THAT(factory->GetSupportedEncoders(), testing::IsEmpty());
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"foo", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
-}
-
-TEST(AudioEncoderFactoryTemplateTest, OneEncoderType) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderFakeApi<BogusParams>>();
- EXPECT_THAT(factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"foo", 8000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({8000, 1, 12345}),
- factory->QueryAudioEncoder({"bogus", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
- auto enc = factory->MakeAudioEncoder(17, {"bogus", 8000, 1});
- ASSERT_NE(nullptr, enc);
- EXPECT_EQ(8000, enc->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, TwoEncoderTypes) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderFakeApi<BogusParams>,
- AudioEncoderFakeApi<ShamParams>>();
- EXPECT_THAT(factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}},
- AudioCodecSpec{{"sham", 16000, 2, {{"param", "value"}}},
- {16000, 2, 23456}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"foo", 8000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({8000, 1, 12345}),
- factory->QueryAudioEncoder({"bogus", 8000, 1}));
- EXPECT_EQ(
- rtc::Optional<AudioCodecInfo>({16000, 2, 23456}),
- factory->QueryAudioEncoder({"sham", 16000, 2, {{"param", "value"}}}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
- auto enc1 = factory->MakeAudioEncoder(17, {"bogus", 8000, 1});
- ASSERT_NE(nullptr, enc1);
- EXPECT_EQ(8000, enc1->SampleRateHz());
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"sham", 16000, 2}));
- auto enc2 =
- factory->MakeAudioEncoder(17, {"sham", 16000, 2, {{"param", "value"}}});
- ASSERT_NE(nullptr, enc2);
- EXPECT_EQ(16000, enc2->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, G711) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderG711>();
- EXPECT_THAT(factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
- AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"PCMA", 16000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({8000, 1, 64000}),
- factory->QueryAudioEncoder({"PCMA", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"PCMU", 16000, 1}));
- auto enc1 = factory->MakeAudioEncoder(17, {"PCMU", 8000, 1});
- ASSERT_NE(nullptr, enc1);
- EXPECT_EQ(8000, enc1->SampleRateHz());
- auto enc2 = factory->MakeAudioEncoder(17, {"PCMA", 8000, 1});
- ASSERT_NE(nullptr, enc2);
- EXPECT_EQ(8000, enc2->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, G722) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderG722>();
- EXPECT_THAT(factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"foo", 8000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 64000}),
- factory->QueryAudioEncoder({"G722", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
- auto enc = factory->MakeAudioEncoder(17, {"G722", 8000, 1});
- ASSERT_NE(nullptr, enc);
- EXPECT_EQ(16000, enc->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, Ilbc) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderIlbc>();
- EXPECT_THAT(factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"foo", 8000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({8000, 1, 13333}),
- factory->QueryAudioEncoder({"ilbc", 8000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 8000, 1}));
- auto enc = factory->MakeAudioEncoder(17, {"ilbc", 8000, 1});
- ASSERT_NE(nullptr, enc);
- EXPECT_EQ(8000, enc->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, IsacFix) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderIsacFix>();
- EXPECT_THAT(factory->GetSupportedEncoders(),
- testing::ElementsAre(AudioCodecSpec{
- {"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"isac", 16000, 2}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 32000, 10000, 32000}),
- factory->QueryAudioEncoder({"isac", 16000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"isac", 32000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"isac", 8000, 1}));
- auto enc1 = factory->MakeAudioEncoder(17, {"isac", 16000, 1});
- ASSERT_NE(nullptr, enc1);
- EXPECT_EQ(16000, enc1->SampleRateHz());
- EXPECT_EQ(3u, enc1->Num10MsFramesInNextPacket());
- auto enc2 =
- factory->MakeAudioEncoder(17, {"isac", 16000, 1, {{"ptime", "60"}}});
- ASSERT_NE(nullptr, enc2);
- EXPECT_EQ(6u, enc2->Num10MsFramesInNextPacket());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, IsacFloat) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderIsacFloat>();
- EXPECT_THAT(
- factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}},
- AudioCodecSpec{{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"isac", 16000, 2}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 32000, 10000, 32000}),
- factory->QueryAudioEncoder({"isac", 16000, 1}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({32000, 1, 56000, 10000, 56000}),
- factory->QueryAudioEncoder({"isac", 32000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"isac", 8000, 1}));
- auto enc1 = factory->MakeAudioEncoder(17, {"isac", 16000, 1});
- ASSERT_NE(nullptr, enc1);
- EXPECT_EQ(16000, enc1->SampleRateHz());
- auto enc2 = factory->MakeAudioEncoder(17, {"isac", 32000, 1});
- ASSERT_NE(nullptr, enc2);
- EXPECT_EQ(32000, enc2->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, L16) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderL16>();
- EXPECT_THAT(
- factory->GetSupportedEncoders(),
- testing::ElementsAre(
- AudioCodecSpec{{"L16", 8000, 1}, {8000, 1, 8000 * 16}},
- AudioCodecSpec{{"L16", 16000, 1}, {16000, 1, 16000 * 16}},
- AudioCodecSpec{{"L16", 32000, 1}, {32000, 1, 32000 * 16}},
- AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}},
- AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}},
- AudioCodecSpec{{"L16", 32000, 2}, {32000, 2, 32000 * 16 * 2}}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"L16", 8000, 0}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>({48000, 1, 48000 * 16}),
- factory->QueryAudioEncoder({"L16", 48000, 1}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"L16", 8000, 0}));
- auto enc = factory->MakeAudioEncoder(17, {"L16", 48000, 2});
- ASSERT_NE(nullptr, enc);
- EXPECT_EQ(48000, enc->SampleRateHz());
-}
-
-TEST(AudioEncoderFactoryTemplateTest, Opus) {
- auto factory = CreateAudioEncoderFactory<AudioEncoderOpus>();
- AudioCodecInfo info = {48000, 1, 32000, 6000, 510000};
- info.allow_comfort_noise = false;
- info.supports_network_adaption = true;
- EXPECT_THAT(
- factory->GetSupportedEncoders(),
- testing::ElementsAre(AudioCodecSpec{
- {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}},
- info}));
- EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
- factory->QueryAudioEncoder({"foo", 8000, 1}));
- EXPECT_EQ(
- rtc::Optional<AudioCodecInfo>(info),
- factory->QueryAudioEncoder(
- {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}));
- EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
- auto enc = factory->MakeAudioEncoder(17, {"opus", 48000, 2});
- ASSERT_NE(nullptr, enc);
- EXPECT_EQ(48000, enc->SampleRateHz());
-}
-
-} // namespace webrtc
diff --git a/api/call/audio_sink.h b/api/call/audio_sink.h
deleted file mode 100644
index 8d38763..0000000
--- a/api/call/audio_sink.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2015 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 WEBRTC_API_CALL_AUDIO_SINK_H_
-#define WEBRTC_API_CALL_AUDIO_SINK_H_
-
-#if defined(WEBRTC_POSIX) && !defined(__STDC_FORMAT_MACROS)
-// Avoid conflict with format_macros.h.
-#define __STDC_FORMAT_MACROS
-#endif
-
-#include <inttypes.h>
-#include <stddef.h>
-
-namespace webrtc {
-
-// Represents a simple push audio sink.
-class AudioSinkInterface {
- public:
- virtual ~AudioSinkInterface() {}
-
- struct Data {
- Data(const int16_t* data,
- size_t samples_per_channel,
- int sample_rate,
- size_t channels,
- uint32_t timestamp)
- : data(data),
- samples_per_channel(samples_per_channel),
- sample_rate(sample_rate),
- channels(channels),
- timestamp(timestamp) {}
-
- const int16_t* data; // The actual 16bit audio data.
- size_t samples_per_channel; // Number of frames in the buffer.
- int sample_rate; // Sample rate in Hz.
- size_t channels; // Number of channels in the audio data.
- uint32_t timestamp; // The RTP timestamp of the first sample.
- };
-
- virtual void OnData(const Data& audio) = 0;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_CALL_AUDIO_SINK_H_
diff --git a/api/call/transport.h b/api/call/transport.h
deleted file mode 100644
index 1126f62..0000000
--- a/api/call/transport.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2013 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 WEBRTC_API_CALL_TRANSPORT_H_
-#define WEBRTC_API_CALL_TRANSPORT_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace webrtc {
-
-// TODO(holmer): Look into unifying this with the PacketOptions in
-// asyncpacketsocket.h.
-struct PacketOptions {
- // A 16 bits positive id. Negative ids are invalid and should be interpreted
- // as packet_id not being set.
- int packet_id = -1;
-};
-
-class Transport {
- public:
- virtual bool SendRtp(const uint8_t* packet,
- size_t length,
- const PacketOptions& options) = 0;
- virtual bool SendRtcp(const uint8_t* packet, size_t length) = 0;
-
- protected:
- virtual ~Transport() {}
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_CALL_TRANSPORT_H_
diff --git a/api/datachannel.h b/api/datachannel.h
deleted file mode 100644
index 28112ad..0000000
--- a/api/datachannel.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2012 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 WEBRTC_API_DATACHANNEL_H_
-#define WEBRTC_API_DATACHANNEL_H_
-
-// Including this file is deprecated. It is no longer part of the public API.
-// This only includes the file in its new location for backwards compatibility.
-#include "webrtc/pc/datachannel.h"
-
-#endif // WEBRTC_API_DATACHANNEL_H_
diff --git a/api/datachannelinterface.h b/api/datachannelinterface.h
deleted file mode 100644
index 1395a2e..0000000
--- a/api/datachannelinterface.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2012 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.
- */
-
-// This file contains interfaces for DataChannels
-// http://dev.w3.org/2011/webrtc/editor/webrtc.html#rtcdatachannel
-
-#ifndef WEBRTC_API_DATACHANNELINTERFACE_H_
-#define WEBRTC_API_DATACHANNELINTERFACE_H_
-
-#include <string>
-
-#include "webrtc/rtc_base/basictypes.h"
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/copyonwritebuffer.h"
-#include "webrtc/rtc_base/refcount.h"
-
-namespace webrtc {
-
-// C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelinit
-// TODO(deadbeef): Use rtc::Optional for the "-1 if unset" things.
-struct DataChannelInit {
- // Deprecated. Reliability is assumed, and channel will be unreliable if
- // maxRetransmitTime or MaxRetransmits is set.
- bool reliable = false;
-
- // True if ordered delivery is required.
- bool ordered = true;
-
- // The max period of time in milliseconds in which retransmissions will be
- // sent. After this time, no more retransmissions will be sent. -1 if unset.
- //
- // Cannot be set along with |maxRetransmits|.
- int maxRetransmitTime = -1;
-
- // The max number of retransmissions. -1 if unset.
- //
- // Cannot be set along with |maxRetransmitTime|.
- int maxRetransmits = -1;
-
- // This is set by the application and opaque to the WebRTC implementation.
- std::string protocol;
-
- // True if the channel has been externally negotiated and we do not send an
- // in-band signalling in the form of an "open" message. If this is true, |id|
- // below must be set; otherwise it should be unset and will be negotiated
- // in-band.
- bool negotiated = false;
-
- // The stream id, or SID, for SCTP data channels. -1 if unset (see above).
- int id = -1;
-};
-
-// At the JavaScript level, data can be passed in as a string or a blob, so
-// this structure's |binary| flag tells whether the data should be interpreted
-// as binary or text.
-struct DataBuffer {
- DataBuffer(const rtc::CopyOnWriteBuffer& data, bool binary)
- : data(data),
- binary(binary) {
- }
- // For convenience for unit tests.
- explicit DataBuffer(const std::string& text)
- : data(text.data(), text.length()),
- binary(false) {
- }
- size_t size() const { return data.size(); }
-
- rtc::CopyOnWriteBuffer data;
- // Indicates if the received data contains UTF-8 or binary data.
- // Note that the upper layers are left to verify the UTF-8 encoding.
- // TODO(jiayl): prefer to use an enum instead of a bool.
- bool binary;
-};
-
-// Used to implement RTCDataChannel events.
-//
-// The code responding to these callbacks should unwind the stack before
-// using any other webrtc APIs; re-entrancy is not supported.
-class DataChannelObserver {
- public:
- // The data channel state have changed.
- virtual void OnStateChange() = 0;
- // A data buffer was successfully received.
- virtual void OnMessage(const DataBuffer& buffer) = 0;
- // The data channel's buffered_amount has changed.
- virtual void OnBufferedAmountChange(uint64_t previous_amount) {}
-
- protected:
- virtual ~DataChannelObserver() {}
-};
-
-class DataChannelInterface : public rtc::RefCountInterface {
- public:
- // C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate
- // Unlikely to change, but keep in sync with DataChannel.java:State and
- // RTCDataChannel.h:RTCDataChannelState.
- enum DataState {
- kConnecting,
- kOpen, // The DataChannel is ready to send data.
- kClosing,
- kClosed
- };
-
- static const char* DataStateString(DataState state) {
- switch (state) {
- case kConnecting:
- return "connecting";
- case kOpen:
- return "open";
- case kClosing:
- return "closing";
- case kClosed:
- return "closed";
- }
- RTC_CHECK(false) << "Unknown DataChannel state: " << state;
- return "";
- }
-
- // Used to receive events from the data channel. Only one observer can be
- // registered at a time. UnregisterObserver should be called before the
- // observer object is destroyed.
- virtual void RegisterObserver(DataChannelObserver* observer) = 0;
- virtual void UnregisterObserver() = 0;
-
- // The label attribute represents a label that can be used to distinguish this
- // DataChannel object from other DataChannel objects.
- virtual std::string label() const = 0;
-
- // The accessors below simply return the properties from the DataChannelInit
- // the data channel was constructed with.
- virtual bool reliable() const = 0;
- // TODO(deadbeef): Remove these dummy implementations when all classes have
- // implemented these APIs. They should all just return the values the
- // DataChannel was created with.
- virtual bool ordered() const { return false; }
- virtual uint16_t maxRetransmitTime() const { return 0; }
- virtual uint16_t maxRetransmits() const { return 0; }
- virtual std::string protocol() const { return std::string(); }
- virtual bool negotiated() const { return false; }
-
- // Returns the ID from the DataChannelInit, if it was negotiated out-of-band.
- // If negotiated in-band, this ID will be populated once the DTLS role is
- // determined, and until then this will return -1.
- virtual int id() const = 0;
- virtual DataState state() const = 0;
- virtual uint32_t messages_sent() const = 0;
- virtual uint64_t bytes_sent() const = 0;
- virtual uint32_t messages_received() const = 0;
- virtual uint64_t bytes_received() const = 0;
-
- // Returns the number of bytes of application data (UTF-8 text and binary
- // data) that have been queued using Send but have not yet been processed at
- // the SCTP level. See comment above Send below.
- virtual uint64_t buffered_amount() const = 0;
-
- // Begins the graceful data channel closing procedure. See:
- // https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.7
- virtual void Close() = 0;
-
- // Sends |data| to the remote peer. If the data can't be sent at the SCTP
- // level (due to congestion control), it's buffered at the data channel level,
- // up to a maximum of 16MB. If Send is called while this buffer is full, the
- // data channel will be closed abruptly.
- //
- // So, it's important to use buffered_amount() and OnBufferedAmountChange to
- // ensure the data channel is used efficiently but without filling this
- // buffer.
- virtual bool Send(const DataBuffer& buffer) = 0;
-
- protected:
- virtual ~DataChannelInterface() {}
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_DATACHANNELINTERFACE_H_
diff --git a/api/dtmfsenderinterface.h b/api/dtmfsenderinterface.h
deleted file mode 100644
index 68a08ff..0000000
--- a/api/dtmfsenderinterface.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2012 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 WEBRTC_API_DTMFSENDERINTERFACE_H_
-#define WEBRTC_API_DTMFSENDERINTERFACE_H_
-
-#include <string>
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/rtc_base/refcount.h"
-
-namespace webrtc {
-
-// DtmfSender callback interface, used to implement RTCDtmfSender events.
-// Applications should implement this interface to get notifications from the
-// DtmfSender.
-class DtmfSenderObserverInterface {
- public:
- // Triggered when DTMF |tone| is sent.
- // If |tone| is empty that means the DtmfSender has sent out all the given
- // tones.
- virtual void OnToneChange(const std::string& tone) = 0;
-
- protected:
- virtual ~DtmfSenderObserverInterface() {}
-};
-
-// The interface of native implementation of the RTCDTMFSender defined by the
-// WebRTC W3C Editor's Draft.
-// See: https://www.w3.org/TR/webrtc/#peer-to-peer-dtmf
-class DtmfSenderInterface : public rtc::RefCountInterface {
- public:
- // Used to receive events from the DTMF sender. Only one observer can be
- // registered at a time. UnregisterObserver should be called before the
- // observer object is destroyed.
- virtual void RegisterObserver(DtmfSenderObserverInterface* observer) = 0;
- virtual void UnregisterObserver() = 0;
-
- // Returns true if this DtmfSender is capable of sending DTMF. Otherwise
- // returns false. To be able to send DTMF, the associated RtpSender must be
- // able to send packets, and a "telephone-event" codec must be negotiated.
- virtual bool CanInsertDtmf() = 0;
-
- // Queues a task that sends the DTMF |tones|. The |tones| parameter is treated
- // as a series of characters. The characters 0 through 9, A through D, #, and
- // * generate the associated DTMF tones. The characters a to d are equivalent
- // to A to D. The character ',' indicates a delay of 2 seconds before
- // processing the next character in the tones parameter.
- //
- // Unrecognized characters are ignored.
- //
- // The |duration| parameter indicates the duration in ms to use for each
- // character passed in the |tones| parameter. The duration cannot be more
- // than 6000 or less than 70.
- //
- // The |inter_tone_gap| parameter indicates the gap between tones in ms. The
- // |inter_tone_gap| must be at least 50 ms but should be as short as
- // possible.
- //
- // If InsertDtmf is called on the same object while an existing task for this
- // object to generate DTMF is still running, the previous task is canceled.
- // Returns true on success and false on failure.
- virtual bool InsertDtmf(const std::string& tones, int duration,
- int inter_tone_gap) = 0;
-
- // Returns the track given as argument to the constructor. Only exists for
- // backwards compatibilty; now that DtmfSenders are tied to RtpSenders, it's
- // no longer relevant.
- virtual const AudioTrackInterface* track() const = 0;
-
- // Returns the tones remaining to be played out.
- virtual std::string tones() const = 0;
-
- // Returns the current tone duration value in ms.
- // This value will be the value last set via the InsertDtmf() method, or the
- // default value of 100 ms if InsertDtmf() was never called.
- virtual int duration() const = 0;
-
- // Returns the current value of the between-tone gap in ms.
- // This value will be the value last set via the InsertDtmf() method, or the
- // default value of 50 ms if InsertDtmf() was never called.
- virtual int inter_tone_gap() const = 0;
-
- protected:
- virtual ~DtmfSenderInterface() {}
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_DTMFSENDERINTERFACE_H_
diff --git a/api/fakemetricsobserver.cc b/api/fakemetricsobserver.cc
deleted file mode 100644
index d804f0d..0000000
--- a/api/fakemetricsobserver.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2015 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 "webrtc/api/fakemetricsobserver.h"
-#include "webrtc/rtc_base/checks.h"
-
-namespace webrtc {
-
-FakeMetricsObserver::FakeMetricsObserver() {
- Reset();
-}
-
-void FakeMetricsObserver::Reset() {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- counters_.clear();
- memset(histogram_samples_, 0, sizeof(histogram_samples_));
-}
-
-void FakeMetricsObserver::IncrementEnumCounter(
- PeerConnectionEnumCounterType type,
- int counter,
- int counter_max) {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (counters_.size() <= static_cast<size_t>(type)) {
- counters_.resize(type + 1);
- }
- auto& counters = counters_[type];
- ++counters[counter];
-}
-
-void FakeMetricsObserver::AddHistogramSample(PeerConnectionMetricsName type,
- int value) {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- RTC_DCHECK_EQ(histogram_samples_[type], 0);
- histogram_samples_[type] = value;
-}
-
-int FakeMetricsObserver::GetEnumCounter(PeerConnectionEnumCounterType type,
- int counter) const {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (counters_.size() <= static_cast<size_t>(type)) {
- return 0;
- }
- const auto& it = counters_[type].find(counter);
- if (it == counters_[type].end()) {
- return 0;
- }
- return it->second;
-}
-
-int FakeMetricsObserver::GetHistogramSample(
- PeerConnectionMetricsName type) const {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- return histogram_samples_[type];
-}
-
-} // namespace webrtc
diff --git a/api/fakemetricsobserver.h b/api/fakemetricsobserver.h
deleted file mode 100644
index 7608012..0000000
--- a/api/fakemetricsobserver.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2015 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 WEBRTC_API_FAKEMETRICSOBSERVER_H_
-#define WEBRTC_API_FAKEMETRICSOBSERVER_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "webrtc/api/peerconnectioninterface.h"
-#include "webrtc/rtc_base/thread_checker.h"
-
-namespace webrtc {
-
-class FakeMetricsObserver : public MetricsObserverInterface {
- public:
- FakeMetricsObserver();
- void Reset();
-
- void IncrementEnumCounter(PeerConnectionEnumCounterType,
- int counter,
- int counter_max) override;
- void AddHistogramSample(PeerConnectionMetricsName type,
- int value) override;
-
- // Accessors to be used by the tests.
- int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const;
- int GetHistogramSample(PeerConnectionMetricsName type) const;
-
- protected:
- ~FakeMetricsObserver() {}
-
- private:
- rtc::ThreadChecker thread_checker_;
- // The vector contains maps for each counter type. In the map, it's a mapping
- // from individual counter to its count, such that it's memory efficient when
- // comes to sparse enum types, like the SSL ciphers in the IANA registry.
- std::vector<std::map<int, int>> counters_;
- int histogram_samples_[kPeerConnectionMetricsName_Max];
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_FAKEMETRICSOBSERVER_H_
diff --git a/api/jsep.h b/api/jsep.h
deleted file mode 100644
index cfb604d..0000000
--- a/api/jsep.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2012 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.
- */
-
-// This file contains declarations of interfaces that wrap SDP-related
-// constructs; session descriptions and ICE candidates. The inner "cricket::"
-// objects shouldn't be accessed directly; the intention is that an application
-// using the PeerConnection API only creates these objects from strings, and
-// them passes them into the PeerConnection.
-//
-// Though in the future, we're planning to provide an SDP parsing API, with a
-// structure more friendly than cricket::SessionDescription.
-
-#ifndef WEBRTC_API_JSEP_H_
-#define WEBRTC_API_JSEP_H_
-
-#include <stddef.h>
-
-#include <string>
-#include <vector>
-
-#include "webrtc/rtc_base/refcount.h"
-
-namespace cricket {
-class Candidate;
-class SessionDescription;
-} // namespace cricket
-
-namespace webrtc {
-
-struct SdpParseError {
- public:
- // The sdp line that causes the error.
- std::string line;
- // Explains the error.
- std::string description;
-};
-
-// Class representation of an ICE candidate.
-//
-// An instance of this interface is supposed to be owned by one class at
-// a time and is therefore not expected to be thread safe.
-//
-// An instance can be created by CreateIceCandidate.
-class IceCandidateInterface {
- public:
- virtual ~IceCandidateInterface() {}
- // If present, this is the value of the "a=mid" attribute of the candidate's
- // m= section in SDP, which identifies the m= section.
- virtual std::string sdp_mid() const = 0;
- // This indicates the index (starting at zero) of m= section this candidate
- // is assocated with. Needed when an endpoint doesn't support MIDs.
- virtual int sdp_mline_index() const = 0;
- // Only for use internally.
- virtual const cricket::Candidate& candidate() const = 0;
- // The URL of the ICE server which this candidate was gathered from.
- // TODO(zhihuang): Remove the default implementation once the subclasses
- // implement this method.
- virtual std::string server_url() const { return ""; }
- // Creates a SDP-ized form of this candidate.
- virtual bool ToString(std::string* out) const = 0;
-};
-
-// Creates a IceCandidateInterface based on SDP string.
-// Returns null if the sdp string can't be parsed.
-// |error| may be null.
-IceCandidateInterface* CreateIceCandidate(const std::string& sdp_mid,
- int sdp_mline_index,
- const std::string& sdp,
- SdpParseError* error);
-
-// This class represents a collection of candidates for a specific m= section.
-// Used in SessionDescriptionInterface.
-class IceCandidateCollection {
- public:
- virtual ~IceCandidateCollection() {}
- virtual size_t count() const = 0;
- // Returns true if an equivalent |candidate| exist in the collection.
- virtual bool HasCandidate(const IceCandidateInterface* candidate) const = 0;
- virtual const IceCandidateInterface* at(size_t index) const = 0;
-};
-
-// Class representation of an SDP session description.
-//
-// An instance of this interface is supposed to be owned by one class at a time
-// and is therefore not expected to be thread safe.
-//
-// An instance can be created by CreateSessionDescription.
-class SessionDescriptionInterface {
- public:
- // Supported types:
- static const char kOffer[];
- static const char kPrAnswer[];
- static const char kAnswer[];
-
- virtual ~SessionDescriptionInterface() {}
-
- // Only for use internally.
- virtual cricket::SessionDescription* description() = 0;
- virtual const cricket::SessionDescription* description() const = 0;
-
- // Get the session id and session version, which are defined based on
- // RFC 4566 for the SDP o= line.
- virtual std::string session_id() const = 0;
- virtual std::string session_version() const = 0;
-
- // kOffer/kPrAnswer/kAnswer
- virtual std::string type() const = 0;
-
- // Adds the specified candidate to the description.
- //
- // Ownership is not transferred.
- //
- // Returns false if the session description does not have a media section
- // that corresponds to |candidate.sdp_mid()| or
- // |candidate.sdp_mline_index()|.
- virtual bool AddCandidate(const IceCandidateInterface* candidate) = 0;
-
- // Removes the candidates from the description, if found.
- //
- // Returns the number of candidates removed.
- virtual size_t RemoveCandidates(
- const std::vector<cricket::Candidate>& candidates) { return 0; }
-
- // Returns the number of m= sections in the session description.
- virtual size_t number_of_mediasections() const = 0;
-
- // Returns a collection of all candidates that belong to a certain m=
- // section.
- virtual const IceCandidateCollection* candidates(
- size_t mediasection_index) const = 0;
-
- // Serializes the description to SDP.
- virtual bool ToString(std::string* out) const = 0;
-};
-
-// Creates a SessionDescriptionInterface based on the SDP string and the type.
-// Returns null if the sdp string can't be parsed or the type is unsupported.
-// |error| may be null.
-SessionDescriptionInterface* CreateSessionDescription(const std::string& type,
- const std::string& sdp,
- SdpParseError* error);
-
-// CreateOffer and CreateAnswer callback interface.
-class CreateSessionDescriptionObserver : public rtc::RefCountInterface {
- public:
- // This callback transfers the ownership of the |desc|.
- // TODO(deadbeef): Make this take an std::unique_ptr<> to avoid confusion
- // around ownership.
- virtual void OnSuccess(SessionDescriptionInterface* desc) = 0;
- virtual void OnFailure(const std::string& error) = 0;
-
- protected:
- ~CreateSessionDescriptionObserver() {}
-};
-
-// SetLocalDescription and SetRemoteDescription callback interface.
-class SetSessionDescriptionObserver : public rtc::RefCountInterface {
- public:
- virtual void OnSuccess() = 0;
- virtual void OnFailure(const std::string& error) = 0;
-
- protected:
- ~SetSessionDescriptionObserver() {}
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_JSEP_H_
diff --git a/api/jsepicecandidate.h b/api/jsepicecandidate.h
deleted file mode 100644
index 0b34991..0000000
--- a/api/jsepicecandidate.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2012 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.
- */
-
-// TODO(deadbeef): Move this out of api/; it's an implementation detail and
-// shouldn't be used externally.
-
-#ifndef WEBRTC_API_JSEPICECANDIDATE_H_
-#define WEBRTC_API_JSEPICECANDIDATE_H_
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "webrtc/api/jsep.h"
-#include "webrtc/p2p/base/candidate.h"
-#include "webrtc/rtc_base/constructormagic.h"
-
-namespace webrtc {
-
-// Implementation of IceCandidateInterface.
-class JsepIceCandidate : public IceCandidateInterface {
- public:
- JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index);
- JsepIceCandidate(const std::string& sdp_mid, int sdp_mline_index,
- const cricket::Candidate& candidate);
- ~JsepIceCandidate();
- // |err| may be null.
- bool Initialize(const std::string& sdp, SdpParseError* err);
- void SetCandidate(const cricket::Candidate& candidate) {
- candidate_ = candidate;
- }
-
- virtual std::string sdp_mid() const { return sdp_mid_; }
- virtual int sdp_mline_index() const { return sdp_mline_index_; }
- virtual const cricket::Candidate& candidate() const {
- return candidate_;
- }
-
- virtual std::string server_url() const { return candidate_.url(); }
-
- virtual bool ToString(std::string* out) const;
-
- private:
- std::string sdp_mid_;
- int sdp_mline_index_;
- cricket::Candidate candidate_;
-
- RTC_DISALLOW_COPY_AND_ASSIGN(JsepIceCandidate);
-};
-
-// Implementation of IceCandidateCollection which stores JsepIceCandidates.
-class JsepCandidateCollection : public IceCandidateCollection {
- public:
- JsepCandidateCollection() {}
- // Move constructor is defined so that a vector of JsepCandidateCollections
- // can be resized.
- JsepCandidateCollection(JsepCandidateCollection&& o)
- : candidates_(std::move(o.candidates_)) {}
- ~JsepCandidateCollection();
- virtual size_t count() const {
- return candidates_.size();
- }
- virtual bool HasCandidate(const IceCandidateInterface* candidate) const;
- // Adds and takes ownership of the JsepIceCandidate.
- // TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
- // more clear.
- virtual void add(JsepIceCandidate* candidate) {
- candidates_.push_back(candidate);
- }
- virtual const IceCandidateInterface* at(size_t index) const {
- return candidates_[index];
- }
- // Removes the candidate that has a matching address and protocol.
- //
- // Returns the number of candidates that were removed.
- size_t remove(const cricket::Candidate& candidate);
-
- private:
- std::vector<JsepIceCandidate*> candidates_;
-
- RTC_DISALLOW_COPY_AND_ASSIGN(JsepCandidateCollection);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_JSEPICECANDIDATE_H_
diff --git a/api/jsepsessiondescription.h b/api/jsepsessiondescription.h
deleted file mode 100644
index 69945b4..0000000
--- a/api/jsepsessiondescription.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2012 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.
- */
-
-// TODO(deadbeef): Move this out of api/; it's an implementation detail and
-// shouldn't be used externally.
-
-#ifndef WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
-#define WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "webrtc/api/jsep.h"
-#include "webrtc/api/jsepicecandidate.h"
-#include "webrtc/p2p/base/candidate.h"
-#include "webrtc/rtc_base/constructormagic.h"
-
-namespace cricket {
-class SessionDescription;
-}
-
-namespace webrtc {
-
-// Implementation of SessionDescriptionInterface.
-class JsepSessionDescription : public SessionDescriptionInterface {
- public:
- explicit JsepSessionDescription(const std::string& type);
- virtual ~JsepSessionDescription();
-
- // Takes ownership of |description|.
- // TODO(deadbeef): Make this use an std::unique_ptr<>, so ownership logic is
- // more clear.
- bool Initialize(cricket::SessionDescription* description,
- const std::string& session_id,
- const std::string& session_version);
-
- virtual cricket::SessionDescription* description() {
- return description_.get();
- }
- virtual const cricket::SessionDescription* description() const {
- return description_.get();
- }
- virtual std::string session_id() const {
- return session_id_;
- }
- virtual std::string session_version() const {
- return session_version_;
- }
- virtual std::string type() const {
- return type_;
- }
- // Allows changing the type. Used for testing.
- void set_type(const std::string& type) { type_ = type; }
- virtual bool AddCandidate(const IceCandidateInterface* candidate);
- virtual size_t RemoveCandidates(
- const std::vector<cricket::Candidate>& candidates);
- virtual size_t number_of_mediasections() const;
- virtual const IceCandidateCollection* candidates(
- size_t mediasection_index) const;
- virtual bool ToString(std::string* out) const;
-
- static const int kDefaultVideoCodecId;
- static const char kDefaultVideoCodecName[];
-
- private:
- std::unique_ptr<cricket::SessionDescription> description_;
- std::string session_id_;
- std::string session_version_;
- std::string type_;
- std::vector<JsepCandidateCollection> candidate_collection_;
-
- bool GetMediasectionIndex(const IceCandidateInterface* candidate,
- size_t* index);
- int GetMediasectionIndex(const cricket::Candidate& candidate);
-
- RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription);
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
diff --git a/api/mediaconstraintsinterface.cc b/api/mediaconstraintsinterface.cc
deleted file mode 100644
index 15deebf..0000000
--- a/api/mediaconstraintsinterface.cc
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright 2013 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 "webrtc/api/mediaconstraintsinterface.h"
-
-#include "webrtc/api/peerconnectioninterface.h"
-#include "webrtc/rtc_base/stringencode.h"
-
-namespace {
-
-// Find the highest-priority instance of the T-valued constraint named by
-// |key| and return its value as |value|. |constraints| can be null.
-// If |mandatory_constraints| is non-null, it is incremented if the key appears
-// among the mandatory constraints.
-// Returns true if the key was found and has a valid value for type T.
-// If the key appears multiple times as an optional constraint, appearances
-// after the first are ignored.
-// Note: Because this uses FindFirst, repeated optional constraints whose
-// first instance has an unrecognized value are not handled precisely in
-// accordance with the specification.
-template <typename T>
-bool FindConstraint(const webrtc::MediaConstraintsInterface* constraints,
- const std::string& key,
- T* value,
- size_t* mandatory_constraints) {
- std::string string_value;
- if (!FindConstraint(constraints, key, &string_value, mandatory_constraints)) {
- return false;
- }
- return rtc::FromString(string_value, value);
-}
-
-// Specialization for std::string, since a string doesn't need conversion.
-template <>
-bool FindConstraint(const webrtc::MediaConstraintsInterface* constraints,
- const std::string& key,
- std::string* value,
- size_t* mandatory_constraints) {
- if (!constraints) {
- return false;
- }
- if (constraints->GetMandatory().FindFirst(key, value)) {
- if (mandatory_constraints) {
- ++*mandatory_constraints;
- }
- return true;
- }
- if (constraints->GetOptional().FindFirst(key, value)) {
- return true;
- }
- return false;
-}
-
-// Converts a constraint (mandatory takes precedence over optional) to an
-// rtc::Optional.
-template <typename T>
-void ConstraintToOptional(const webrtc::MediaConstraintsInterface* constraints,
- const std::string& key,
- rtc::Optional<T>* value_out) {
- T value;
- bool present = FindConstraint<T>(constraints, key, &value, nullptr);
- if (present) {
- *value_out = rtc::Optional<T>(value);
- }
-}
-} // namespace
-
-namespace webrtc {
-
-const char MediaConstraintsInterface::kValueTrue[] = "true";
-const char MediaConstraintsInterface::kValueFalse[] = "false";
-
-// Constraints declared as static members in mediastreaminterface.h
-// Specified by draft-alvestrand-constraints-resolution-00b
-const char MediaConstraintsInterface::kMinAspectRatio[] = "minAspectRatio";
-const char MediaConstraintsInterface::kMaxAspectRatio[] = "maxAspectRatio";
-const char MediaConstraintsInterface::kMaxWidth[] = "maxWidth";
-const char MediaConstraintsInterface::kMinWidth[] = "minWidth";
-const char MediaConstraintsInterface::kMaxHeight[] = "maxHeight";
-const char MediaConstraintsInterface::kMinHeight[] = "minHeight";
-const char MediaConstraintsInterface::kMaxFrameRate[] = "maxFrameRate";
-const char MediaConstraintsInterface::kMinFrameRate[] = "minFrameRate";
-
-// Audio constraints.
-const char MediaConstraintsInterface::kEchoCancellation[] =
- "echoCancellation";
-const char MediaConstraintsInterface::kGoogEchoCancellation[] =
- "googEchoCancellation";
-const char MediaConstraintsInterface::kExtendedFilterEchoCancellation[] =
- "googEchoCancellation2";
-const char MediaConstraintsInterface::kDAEchoCancellation[] =
- "googDAEchoCancellation";
-const char MediaConstraintsInterface::kAutoGainControl[] =
- "googAutoGainControl";
-const char MediaConstraintsInterface::kExperimentalAutoGainControl[] =
- "googAutoGainControl2";
-const char MediaConstraintsInterface::kNoiseSuppression[] =
- "googNoiseSuppression";
-const char MediaConstraintsInterface::kExperimentalNoiseSuppression[] =
- "googNoiseSuppression2";
-const char MediaConstraintsInterface::kIntelligibilityEnhancer[] =
- "intelligibilityEnhancer";
-const char MediaConstraintsInterface::kLevelControl[] = "levelControl";
-const char MediaConstraintsInterface::kLevelControlInitialPeakLevelDBFS[] =
- "levelControlInitialPeakLevelDBFS";
-const char MediaConstraintsInterface::kHighpassFilter[] =
- "googHighpassFilter";
-const char MediaConstraintsInterface::kTypingNoiseDetection[] =
- "googTypingNoiseDetection";
-const char MediaConstraintsInterface::kAudioMirroring[] = "googAudioMirroring";
-const char MediaConstraintsInterface::kAudioNetworkAdaptorConfig[] =
- "googAudioNetworkAdaptorConfig";
-
-// Google-specific constraint keys for a local video source (getUserMedia).
-const char MediaConstraintsInterface::kNoiseReduction[] = "googNoiseReduction";
-
-// Constraint keys for CreateOffer / CreateAnswer defined in W3C specification.
-const char MediaConstraintsInterface::kOfferToReceiveAudio[] =
- "OfferToReceiveAudio";
-const char MediaConstraintsInterface::kOfferToReceiveVideo[] =
- "OfferToReceiveVideo";
-const char MediaConstraintsInterface::kVoiceActivityDetection[] =
- "VoiceActivityDetection";
-const char MediaConstraintsInterface::kIceRestart[] =
- "IceRestart";
-// Google specific constraint for BUNDLE enable/disable.
-const char MediaConstraintsInterface::kUseRtpMux[] =
- "googUseRtpMUX";
-
-// Below constraints should be used during PeerConnection construction.
-const char MediaConstraintsInterface::kEnableDtlsSrtp[] =
- "DtlsSrtpKeyAgreement";
-const char MediaConstraintsInterface::kEnableRtpDataChannels[] =
- "RtpDataChannels";
-// Google-specific constraint keys.
-const char MediaConstraintsInterface::kEnableDscp[] = "googDscp";
-const char MediaConstraintsInterface::kEnableIPv6[] = "googIPv6";
-const char MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate[] =
- "googSuspendBelowMinBitrate";
-const char MediaConstraintsInterface::kCombinedAudioVideoBwe[] =
- "googCombinedAudioVideoBwe";
-const char MediaConstraintsInterface::kScreencastMinBitrate[] =
- "googScreencastMinBitrate";
-// TODO(ronghuawu): Remove once cpu overuse detection is stable.
-const char MediaConstraintsInterface::kCpuOveruseDetection[] =
- "googCpuOveruseDetection";
-const char MediaConstraintsInterface::kPayloadPadding[] = "googPayloadPadding";
-
-
-// Set |value| to the value associated with the first appearance of |key|, or
-// return false if |key| is not found.
-bool MediaConstraintsInterface::Constraints::FindFirst(
- const std::string& key, std::string* value) const {
- for (Constraints::const_iterator iter = begin(); iter != end(); ++iter) {
- if (iter->key == key) {
- *value = iter->value;
- return true;
- }
- }
- return false;
-}
-
-bool FindConstraint(const MediaConstraintsInterface* constraints,
- const std::string& key, bool* value,
- size_t* mandatory_constraints) {
- return ::FindConstraint<bool>(constraints, key, value, mandatory_constraints);
-}
-
-bool FindConstraint(const MediaConstraintsInterface* constraints,
- const std::string& key,
- int* value,
- size_t* mandatory_constraints) {
- return ::FindConstraint<int>(constraints, key, value, mandatory_constraints);
-}
-
-void CopyConstraintsIntoRtcConfiguration(
- const MediaConstraintsInterface* constraints,
- PeerConnectionInterface::RTCConfiguration* configuration) {
- // Copy info from constraints into configuration, if present.
- if (!constraints) {
- return;
- }
-
- bool enable_ipv6;
- if (FindConstraint(constraints, MediaConstraintsInterface::kEnableIPv6,
- &enable_ipv6, nullptr)) {
- configuration->disable_ipv6 = !enable_ipv6;
- }
- FindConstraint(constraints, MediaConstraintsInterface::kEnableDscp,
- &configuration->media_config.enable_dscp, nullptr);
- FindConstraint(
- constraints, MediaConstraintsInterface::kCpuOveruseDetection,
- &configuration->media_config.video.enable_cpu_overuse_detection, nullptr);
- FindConstraint(constraints, MediaConstraintsInterface::kEnableRtpDataChannels,
- &configuration->enable_rtp_data_channel, nullptr);
- // Find Suspend Below Min Bitrate constraint.
- FindConstraint(constraints,
- MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate,
- &configuration->media_config.video.suspend_below_min_bitrate,
- nullptr);
- ConstraintToOptional<int>(constraints,
- MediaConstraintsInterface::kScreencastMinBitrate,
- &configuration->screencast_min_bitrate);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kCombinedAudioVideoBwe,
- &configuration->combined_audio_video_bwe);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kEnableDtlsSrtp,
- &configuration->enable_dtls_srtp);
-}
-
-void CopyConstraintsIntoAudioOptions(
- const MediaConstraintsInterface* constraints,
- cricket::AudioOptions* options) {
- if (!constraints) {
- return;
- }
-
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kGoogEchoCancellation,
- &options->echo_cancellation);
- ConstraintToOptional<bool>(
- constraints, MediaConstraintsInterface::kExtendedFilterEchoCancellation,
- &options->extended_filter_aec);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kDAEchoCancellation,
- &options->delay_agnostic_aec);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kAutoGainControl,
- &options->auto_gain_control);
- ConstraintToOptional<bool>(
- constraints, MediaConstraintsInterface::kExperimentalAutoGainControl,
- &options->experimental_agc);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kNoiseSuppression,
- &options->noise_suppression);
- ConstraintToOptional<bool>(
- constraints, MediaConstraintsInterface::kExperimentalNoiseSuppression,
- &options->experimental_ns);
- ConstraintToOptional<bool>(
- constraints, MediaConstraintsInterface::kIntelligibilityEnhancer,
- &options->intelligibility_enhancer);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kLevelControl,
- &options->level_control);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kHighpassFilter,
- &options->highpass_filter);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kTypingNoiseDetection,
- &options->typing_detection);
- ConstraintToOptional<bool>(constraints,
- MediaConstraintsInterface::kAudioMirroring,
- &options->stereo_swapping);
- ConstraintToOptional<float>(
- constraints, MediaConstraintsInterface::kLevelControlInitialPeakLevelDBFS,
- &options->level_control_initial_peak_level_dbfs);
- ConstraintToOptional<std::string>(
- constraints, MediaConstraintsInterface::kAudioNetworkAdaptorConfig,
- &options->audio_network_adaptor_config);
- // When |kAudioNetworkAdaptorConfig| is defined, it both means that audio
- // network adaptor is desired, and provides the config string.
- if (options->audio_network_adaptor_config) {
- options->audio_network_adaptor = rtc::Optional<bool>(true);
- }
-}
-
-} // namespace webrtc
diff --git a/api/mediaconstraintsinterface.h b/api/mediaconstraintsinterface.h
deleted file mode 100644
index eb89b3e..0000000
--- a/api/mediaconstraintsinterface.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-// This file contains the interface for MediaConstraints, corresponding to
-// the definition at
-// http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also
-// used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints.
-
-// This interface is being deprecated in Chrome, and may be removed
-// from WebRTC too.
-// https://bugs.chromium.org/p/webrtc/issues/detail?id=5617
-
-#ifndef WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_
-#define WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_
-
-#include <string>
-#include <vector>
-
-#include "webrtc/api/optional.h"
-#include "webrtc/api/peerconnectioninterface.h"
-
-namespace webrtc {
-
-// Interface used for passing arguments about media constraints
-// to the MediaStream and PeerConnection implementation.
-//
-// Constraints may be either "mandatory", which means that unless satisfied,
-// the method taking the constraints should fail, or "optional", which means
-// they may not be satisfied..
-class MediaConstraintsInterface {
- public:
- struct Constraint {
- Constraint() {}
- Constraint(const std::string& key, const std::string value)
- : key(key), value(value) {
- }
- std::string key;
- std::string value;
- };
-
- class Constraints : public std::vector<Constraint> {
- public:
- bool FindFirst(const std::string& key, std::string* value) const;
- };
-
- virtual const Constraints& GetMandatory() const = 0;
- virtual const Constraints& GetOptional() const = 0;
-
- // Constraint keys used by a local video source.
- // Specified by draft-alvestrand-constraints-resolution-00b
- static const char kMinAspectRatio[]; // minAspectRatio
- static const char kMaxAspectRatio[]; // maxAspectRatio
- static const char kMaxWidth[]; // maxWidth
- static const char kMinWidth[]; // minWidth
- static const char kMaxHeight[]; // maxHeight
- static const char kMinHeight[]; // minHeight
- static const char kMaxFrameRate[]; // maxFrameRate
- static const char kMinFrameRate[]; // minFrameRate
-
- // Constraint keys used by a local audio source.
- static const char kEchoCancellation[]; // echoCancellation
-
- // These keys are google specific.
- static const char kGoogEchoCancellation[]; // googEchoCancellation
-
- static const char kExtendedFilterEchoCancellation[]; // googEchoCancellation2
- static const char kDAEchoCancellation[]; // googDAEchoCancellation
- static const char kAutoGainControl[]; // googAutoGainControl
- static const char kExperimentalAutoGainControl[]; // googAutoGainControl2
- static const char kNoiseSuppression[]; // googNoiseSuppression
- static const char kExperimentalNoiseSuppression[]; // googNoiseSuppression2
- static const char kIntelligibilityEnhancer[]; // intelligibilityEnhancer
- static const char kLevelControl[]; // levelControl
- static const char
- kLevelControlInitialPeakLevelDBFS[]; // levelControlInitialPeakLevelDBFS
- static const char kHighpassFilter[]; // googHighpassFilter
- static const char kTypingNoiseDetection[]; // googTypingNoiseDetection
- static const char kAudioMirroring[]; // googAudioMirroring
- static const char
- kAudioNetworkAdaptorConfig[]; // goodAudioNetworkAdaptorConfig
-
- // Google-specific constraint keys for a local video source
- static const char kNoiseReduction[]; // googNoiseReduction
-
- // Constraint keys for CreateOffer / CreateAnswer
- // Specified by the W3C PeerConnection spec
- static const char kOfferToReceiveVideo[]; // OfferToReceiveVideo
- static const char kOfferToReceiveAudio[]; // OfferToReceiveAudio
- static const char kVoiceActivityDetection[]; // VoiceActivityDetection
- static const char kIceRestart[]; // IceRestart
- // These keys are google specific.
- static const char kUseRtpMux[]; // googUseRtpMUX
-
- // Constraints values.
- static const char kValueTrue[]; // true
- static const char kValueFalse[]; // false
-
- // PeerConnection constraint keys.
- // Temporary pseudo-constraints used to enable DTLS-SRTP
- static const char kEnableDtlsSrtp[]; // Enable DTLS-SRTP
- // Temporary pseudo-constraints used to enable DataChannels
- static const char kEnableRtpDataChannels[]; // Enable RTP DataChannels
- // Google-specific constraint keys.
- // Temporary pseudo-constraint for enabling DSCP through JS.
- static const char kEnableDscp[]; // googDscp
- // Constraint to enable IPv6 through JS.
- static const char kEnableIPv6[]; // googIPv6
- // Temporary constraint to enable suspend below min bitrate feature.
- static const char kEnableVideoSuspendBelowMinBitrate[];
- // googSuspendBelowMinBitrate
- // Constraint to enable combined audio+video bandwidth estimation.
- static const char kCombinedAudioVideoBwe[]; // googCombinedAudioVideoBwe
- static const char kScreencastMinBitrate[]; // googScreencastMinBitrate
- static const char kCpuOveruseDetection[]; // googCpuOveruseDetection
- static const char kPayloadPadding[]; // googPayloadPadding
-
- // The prefix of internal-only constraints whose JS set values should be
- // stripped by Chrome before passed down to Libjingle.
- static const char kInternalConstraintPrefix[];
-
- protected:
- // Dtor protected as objects shouldn't be deleted via this interface
- virtual ~MediaConstraintsInterface() {}
-};
-
-bool FindConstraint(const MediaConstraintsInterface* constraints,
- const std::string& key, bool* value,
- size_t* mandatory_constraints);
-
-bool FindConstraint(const MediaConstraintsInterface* constraints,
- const std::string& key,
- int* value,
- size_t* mandatory_constraints);
-
-// Copy all relevant constraints into an RTCConfiguration object.
-void CopyConstraintsIntoRtcConfiguration(
- const MediaConstraintsInterface* constraints,
- PeerConnectionInterface::RTCConfiguration* configuration);
-
-// Copy all relevant constraints into an AudioOptions object.
-void CopyConstraintsIntoAudioOptions(
- const MediaConstraintsInterface* constraints,
- cricket::AudioOptions* options);
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_MEDIACONSTRAINTSINTERFACE_H_
diff --git a/api/mediastream.h b/api/mediastream.h
deleted file mode 100644
index e6556c5..0000000
--- a/api/mediastream.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2015 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 WEBRTC_API_MEDIASTREAM_H_
-#define WEBRTC_API_MEDIASTREAM_H_
-
-// Including this file is deprecated. It is no longer part of the public API.
-// This only includes the file in its new location for backwards compatibility.
-#include "webrtc/pc/mediastream.h"
-
-#endif // WEBRTC_API_MEDIASTREAM_H_
diff --git a/api/mediastreaminterface.cc b/api/mediastreaminterface.cc
deleted file mode 100644
index d4fe5cb..0000000
--- a/api/mediastreaminterface.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2017 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 "webrtc/api/mediastreaminterface.h"
-
-namespace webrtc {
-
-const char MediaStreamTrackInterface::kVideoKind[] = "video";
-const char MediaStreamTrackInterface::kAudioKind[] = "audio";
-
-} // namespace webrtc
diff --git a/api/mediastreaminterface.h b/api/mediastreaminterface.h
deleted file mode 100644
index c3966dc..0000000
--- a/api/mediastreaminterface.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright 2012 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.
- */
-
-// This file contains interfaces for MediaStream, MediaTrack and MediaSource.
-// These interfaces are used for implementing MediaStream and MediaTrack as
-// defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These
-// interfaces must be used only with PeerConnection. PeerConnectionManager
-// interface provides the factory methods to create MediaStream and MediaTracks.
-
-#ifndef WEBRTC_API_MEDIASTREAMINTERFACE_H_
-#define WEBRTC_API_MEDIASTREAMINTERFACE_H_
-
-#include <stddef.h>
-
-#include <string>
-#include <vector>
-
-#include "webrtc/api/optional.h"
-#include "webrtc/api/video/video_frame.h"
-// TODO(zhihuang): Remove unrelated headers once downstream applications stop
-// relying on them; they were previously transitively included by
-// mediachannel.h, which is no longer a dependency of this file.
-#include "webrtc/media/base/streamparams.h"
-#include "webrtc/media/base/videosinkinterface.h"
-#include "webrtc/media/base/videosourceinterface.h"
-#include "webrtc/rtc_base/ratetracker.h"
-#include "webrtc/rtc_base/refcount.h"
-#include "webrtc/rtc_base/scoped_ref_ptr.h"
-#include "webrtc/rtc_base/thread.h"
-#include "webrtc/rtc_base/timeutils.h"
-
-namespace webrtc {
-
-// Generic observer interface.
-class ObserverInterface {
- public:
- virtual void OnChanged() = 0;
-
- protected:
- virtual ~ObserverInterface() {}
-};
-
-class NotifierInterface {
- public:
- virtual void RegisterObserver(ObserverInterface* observer) = 0;
- virtual void UnregisterObserver(ObserverInterface* observer) = 0;
-
- virtual ~NotifierInterface() {}
-};
-
-// Base class for sources. A MediaStreamTrack has an underlying source that
-// provides media. A source can be shared by multiple tracks.
-class MediaSourceInterface : public rtc::RefCountInterface,
- public NotifierInterface {
- public:
- enum SourceState {
- kInitializing,
- kLive,
- kEnded,
- kMuted
- };
-
- virtual SourceState state() const = 0;
-
- virtual bool remote() const = 0;
-
- protected:
- virtual ~MediaSourceInterface() {}
-};
-
-// C++ version of MediaStreamTrack.
-// See: https://www.w3.org/TR/mediacapture-streams/#mediastreamtrack
-class MediaStreamTrackInterface : public rtc::RefCountInterface,
- public NotifierInterface {
- public:
- enum TrackState {
- kLive,
- kEnded,
- };
-
- static const char kAudioKind[];
- static const char kVideoKind[];
-
- // The kind() method must return kAudioKind only if the object is a
- // subclass of AudioTrackInterface, and kVideoKind only if the
- // object is a subclass of VideoTrackInterface. It is typically used
- // to protect a static_cast<> to the corresponding subclass.
- virtual std::string kind() const = 0;
-
- // Track identifier.
- virtual std::string id() const = 0;
-
- // A disabled track will produce silence (if audio) or black frames (if
- // video). Can be disabled and re-enabled.
- virtual bool enabled() const = 0;
- virtual bool set_enabled(bool enable) = 0;
-
- // Live or ended. A track will never be live again after becoming ended.
- virtual TrackState state() const = 0;
-
- protected:
- virtual ~MediaStreamTrackInterface() {}
-};
-
-// VideoTrackSourceInterface is a reference counted source used for
-// VideoTracks. The same source can be used by multiple VideoTracks.
-// VideoTrackSourceInterface is designed to be invoked on the signaling thread
-// except for rtc::VideoSourceInterface<VideoFrame> methods that will be invoked
-// on the worker thread via a VideoTrack. A custom implementation of a source
-// can inherit AdaptedVideoTrackSource instead of directly implementing this
-// interface.
-class VideoTrackSourceInterface
- : public MediaSourceInterface,
- public rtc::VideoSourceInterface<VideoFrame> {
- public:
- struct Stats {
- // Original size of captured frame, before video adaptation.
- int input_width;
- int input_height;
- };
-
- // Indicates that parameters suitable for screencasts should be automatically
- // applied to RtpSenders.
- // TODO(perkj): Remove these once all known applications have moved to
- // explicitly setting suitable parameters for screencasts and don't need this
- // implicit behavior.
- virtual bool is_screencast() const = 0;
-
- // Indicates that the encoder should denoise video before encoding it.
- // If it is not set, the default configuration is used which is different
- // depending on video codec.
- // TODO(perkj): Remove this once denoising is done by the source, and not by
- // the encoder.
- virtual rtc::Optional<bool> needs_denoising() const = 0;
-
- // Returns false if no stats are available, e.g, for a remote source, or a
- // source which has not seen its first frame yet.
- //
- // Implementation should avoid blocking.
- virtual bool GetStats(Stats* stats) = 0;
-
- protected:
- virtual ~VideoTrackSourceInterface() {}
-};
-
-// VideoTrackInterface is designed to be invoked on the signaling thread except
-// for rtc::VideoSourceInterface<VideoFrame> methods that must be invoked
-// on the worker thread.
-// PeerConnectionFactory::CreateVideoTrack can be used for creating a VideoTrack
-// that ensures thread safety and that all methods are called on the right
-// thread.
-class VideoTrackInterface
- : public MediaStreamTrackInterface,
- public rtc::VideoSourceInterface<VideoFrame> {
- public:
- // Video track content hint, used to override the source is_screencast
- // property.
- // See https://crbug.com/653531 and https://github.com/WICG/mst-content-hint.
- enum class ContentHint { kNone, kFluid, kDetailed };
-
- // Register a video sink for this track. Used to connect the track to the
- // underlying video engine.
- void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
- const rtc::VideoSinkWants& wants) override {}
- void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {}
-
- virtual VideoTrackSourceInterface* GetSource() const = 0;
-
- virtual ContentHint content_hint() const { return ContentHint::kNone; }
- virtual void set_content_hint(ContentHint hint) {}
-
- protected:
- virtual ~VideoTrackInterface() {}
-};
-
-// Interface for receiving audio data from a AudioTrack.
-class AudioTrackSinkInterface {
- public:
- virtual void OnData(const void* audio_data,
- int bits_per_sample,
- int sample_rate,
- size_t number_of_channels,
- size_t number_of_frames) = 0;
-
- protected:
- virtual ~AudioTrackSinkInterface() {}
-};
-
-// AudioSourceInterface is a reference counted source used for AudioTracks.
-// The same source can be used by multiple AudioTracks.
-class AudioSourceInterface : public MediaSourceInterface {
- public:
- class AudioObserver {
- public:
- virtual void OnSetVolume(double volume) = 0;
-
- protected:
- virtual ~AudioObserver() {}
- };
-
- // TODO(deadbeef): Makes all the interfaces pure virtual after they're
- // implemented in chromium.
-
- // Sets the volume of the source. |volume| is in the range of [0, 10].
- // TODO(tommi): This method should be on the track and ideally volume should
- // be applied in the track in a way that does not affect clones of the track.
- virtual void SetVolume(double volume) {}
-
- // Registers/unregisters observers to the audio source.
- virtual void RegisterAudioObserver(AudioObserver* observer) {}
- virtual void UnregisterAudioObserver(AudioObserver* observer) {}
-
- // TODO(tommi): Make pure virtual.
- virtual void AddSink(AudioTrackSinkInterface* sink) {}
- virtual void RemoveSink(AudioTrackSinkInterface* sink) {}
-};
-
-// Interface of the audio processor used by the audio track to collect
-// statistics.
-class AudioProcessorInterface : public rtc::RefCountInterface {
- public:
- struct AudioProcessorStats {
- AudioProcessorStats()
- : typing_noise_detected(false),
- echo_return_loss(0),
- echo_return_loss_enhancement(0),
- echo_delay_median_ms(0),
- echo_delay_std_ms(0),
- aec_quality_min(0.0),
- residual_echo_likelihood(0.0f),
- residual_echo_likelihood_recent_max(0.0f),
- aec_divergent_filter_fraction(0.0) {}
- ~AudioProcessorStats() {}
-
- bool typing_noise_detected;
- int echo_return_loss;
- int echo_return_loss_enhancement;
- int echo_delay_median_ms;
- int echo_delay_std_ms;
- float aec_quality_min;
- float residual_echo_likelihood;
- float residual_echo_likelihood_recent_max;
- float aec_divergent_filter_fraction;
- };
-
- // Get audio processor statistics.
- virtual void GetStats(AudioProcessorStats* stats) = 0;
-
- protected:
- virtual ~AudioProcessorInterface() {}
-};
-
-class AudioTrackInterface : public MediaStreamTrackInterface {
- public:
- // TODO(deadbeef): Figure out if the following interface should be const or
- // not.
- virtual AudioSourceInterface* GetSource() const = 0;
-
- // Add/Remove a sink that will receive the audio data from the track.
- virtual void AddSink(AudioTrackSinkInterface* sink) = 0;
- virtual void RemoveSink(AudioTrackSinkInterface* sink) = 0;
-
- // Get the signal level from the audio track.
- // Return true on success, otherwise false.
- // TODO(deadbeef): Change the interface to int GetSignalLevel() and pure
- // virtual after it's implemented in chromium.
- virtual bool GetSignalLevel(int* level) { return false; }
-
- // Get the audio processor used by the audio track. Return null if the track
- // does not have any processor.
- // TODO(deadbeef): Make the interface pure virtual.
- virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor() {
- return nullptr;
- }
-
- protected:
- virtual ~AudioTrackInterface() {}
-};
-
-typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> >
- AudioTrackVector;
-typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> >
- VideoTrackVector;
-
-// C++ version of https://www.w3.org/TR/mediacapture-streams/#mediastream.
-//
-// A major difference is that remote audio/video tracks (received by a
-// PeerConnection/RtpReceiver) are not synchronized simply by adding them to
-// the same stream; a session description with the correct "a=msid" attributes
-// must be pushed down.
-//
-// Thus, this interface acts as simply a container for tracks.
-class MediaStreamInterface : public rtc::RefCountInterface,
- public NotifierInterface {
- public:
- // TODO(steveanton): This could be renamed to id() to match the spec.
- virtual std::string label() const = 0;
-
- virtual AudioTrackVector GetAudioTracks() = 0;
- virtual VideoTrackVector GetVideoTracks() = 0;
- virtual rtc::scoped_refptr<AudioTrackInterface>
- FindAudioTrack(const std::string& track_id) = 0;
- virtual rtc::scoped_refptr<VideoTrackInterface>
- FindVideoTrack(const std::string& track_id) = 0;
-
- virtual bool AddTrack(AudioTrackInterface* track) = 0;
- virtual bool AddTrack(VideoTrackInterface* track) = 0;
- virtual bool RemoveTrack(AudioTrackInterface* track) = 0;
- virtual bool RemoveTrack(VideoTrackInterface* track) = 0;
-
- protected:
- virtual ~MediaStreamInterface() {}
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_
diff --git a/api/mediastreamproxy.h b/api/mediastreamproxy.h
deleted file mode 100644
index 15b40ed..0000000
--- a/api/mediastreamproxy.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2011 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 WEBRTC_API_MEDIASTREAMPROXY_H_
-#define WEBRTC_API_MEDIASTREAMPROXY_H_
-
-#include <string>
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/api/proxy.h"
-
-namespace webrtc {
-
-// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
-// are called on is an implementation detail.
-BEGIN_SIGNALING_PROXY_MAP(MediaStream)
- PROXY_SIGNALING_THREAD_DESTRUCTOR()
- PROXY_CONSTMETHOD0(std::string, label)
- PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
- PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
- PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
- FindAudioTrack,
- const std::string&)
- PROXY_METHOD1(rtc::scoped_refptr<VideoTrackInterface>,
- FindVideoTrack,
- const std::string&)
- PROXY_METHOD1(bool, AddTrack, AudioTrackInterface*)
- PROXY_METHOD1(bool, AddTrack, VideoTrackInterface*)
- PROXY_METHOD1(bool, RemoveTrack, AudioTrackInterface*)
- PROXY_METHOD1(bool, RemoveTrack, VideoTrackInterface*)
- PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
- PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
-END_PROXY_MAP()
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_MEDIASTREAMPROXY_H_
diff --git a/api/mediastreamtrack.h b/api/mediastreamtrack.h
deleted file mode 100644
index 6075abe..0000000
--- a/api/mediastreamtrack.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2011 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 WEBRTC_API_MEDIASTREAMTRACK_H_
-#define WEBRTC_API_MEDIASTREAMTRACK_H_
-
-// Including this file is deprecated. It is no longer part of the public API.
-// This only includes the file in its new location for backwards compatibility.
-#include "webrtc/pc/mediastreamtrack.h"
-
-#endif // WEBRTC_API_MEDIASTREAMTRACK_H_
diff --git a/api/mediastreamtrackproxy.h b/api/mediastreamtrackproxy.h
deleted file mode 100644
index 605f3f2..0000000
--- a/api/mediastreamtrackproxy.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2011 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.
- */
-
-// This file includes proxy classes for tracks. The purpose is
-// to make sure tracks are only accessed from the signaling thread.
-
-#ifndef WEBRTC_API_MEDIASTREAMTRACKPROXY_H_
-#define WEBRTC_API_MEDIASTREAMTRACKPROXY_H_
-
-#include <string>
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/api/proxy.h"
-
-namespace webrtc {
-
-// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
-// are called on is an implementation detail.
-
-BEGIN_SIGNALING_PROXY_MAP(AudioTrack)
- PROXY_SIGNALING_THREAD_DESTRUCTOR()
- PROXY_CONSTMETHOD0(std::string, kind)
- PROXY_CONSTMETHOD0(std::string, id)
- PROXY_CONSTMETHOD0(TrackState, state)
- PROXY_CONSTMETHOD0(bool, enabled)
- PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
- PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*)
- PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*)
- PROXY_METHOD1(bool, GetSignalLevel, int*)
- PROXY_METHOD0(rtc::scoped_refptr<AudioProcessorInterface>, GetAudioProcessor)
- PROXY_METHOD1(bool, set_enabled, bool)
- PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
- PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
-END_PROXY_MAP()
-
-BEGIN_PROXY_MAP(VideoTrack)
- PROXY_SIGNALING_THREAD_DESTRUCTOR()
- PROXY_CONSTMETHOD0(std::string, kind)
- PROXY_CONSTMETHOD0(std::string, id)
- PROXY_CONSTMETHOD0(TrackState, state)
- PROXY_CONSTMETHOD0(bool, enabled)
- PROXY_METHOD1(bool, set_enabled, bool)
- PROXY_CONSTMETHOD0(ContentHint, content_hint)
- PROXY_METHOD1(void, set_content_hint, ContentHint)
- PROXY_WORKER_METHOD2(void,
- AddOrUpdateSink,
- rtc::VideoSinkInterface<VideoFrame>*,
- const rtc::VideoSinkWants&)
- PROXY_WORKER_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
- PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
-
- PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
- PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
-END_PROXY_MAP()
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_MEDIASTREAMTRACKPROXY_H_
diff --git a/api/mediatypes.cc b/api/mediatypes.cc
deleted file mode 100644
index 108b697..0000000
--- a/api/mediatypes.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2016 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 "webrtc/api/mediatypes.h"
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/rtc_base/checks.h"
-
-namespace {
-static const char* kMediaTypeData = "data";
-} // namespace
-
-namespace cricket {
-
-std::string MediaTypeToString(MediaType type) {
- switch (type) {
- case MEDIA_TYPE_AUDIO:
- return webrtc::MediaStreamTrackInterface::kAudioKind;
- case MEDIA_TYPE_VIDEO:
- return webrtc::MediaStreamTrackInterface::kVideoKind;
- case MEDIA_TYPE_DATA:
- return kMediaTypeData;
- }
- FATAL();
- // Not reachable; avoids compile warning.
- return "";
-}
-
-MediaType MediaTypeFromString(const std::string& type_str) {
- if (type_str == webrtc::MediaStreamTrackInterface::kAudioKind) {
- return MEDIA_TYPE_AUDIO;
- } else if (type_str == webrtc::MediaStreamTrackInterface::kVideoKind) {
- return MEDIA_TYPE_VIDEO;
- } else if (type_str == kMediaTypeData) {
- return MEDIA_TYPE_DATA;
- }
- FATAL();
- // Not reachable; avoids compile warning.
- return static_cast<MediaType>(-1);
-}
-
-} // namespace cricket
diff --git a/api/mediatypes.h b/api/mediatypes.h
deleted file mode 100644
index ec3a70a..0000000
--- a/api/mediatypes.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016 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 WEBRTC_API_MEDIATYPES_H_
-#define WEBRTC_API_MEDIATYPES_H_
-
-#include <string>
-
-namespace cricket {
-
-enum MediaType {
- MEDIA_TYPE_AUDIO,
- MEDIA_TYPE_VIDEO,
- MEDIA_TYPE_DATA
-};
-
-std::string MediaTypeToString(MediaType type);
-// Aborts on invalid string. Only expected to be used on strings that are
-// guaranteed to be valid, such as MediaStreamTrackInterface::kind().
-MediaType MediaTypeFromString(const std::string& type_str);
-
-} // namespace cricket
-
-#endif // WEBRTC_API_MEDIATYPES_H_
diff --git a/api/notifier.h b/api/notifier.h
deleted file mode 100644
index e142d14..0000000
--- a/api/notifier.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2011 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 WEBRTC_API_NOTIFIER_H_
-#define WEBRTC_API_NOTIFIER_H_
-
-#include <list>
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/rtc_base/checks.h"
-
-namespace webrtc {
-
-// Implements a template version of a notifier.
-// TODO(deadbeef): This is an implementation detail; move out of api/.
-template <class T>
-class Notifier : public T {
- public:
- Notifier() {
- }
-
- virtual void RegisterObserver(ObserverInterface* observer) {
- RTC_DCHECK(observer != nullptr);
- observers_.push_back(observer);
- }
-
- virtual void UnregisterObserver(ObserverInterface* observer) {
- for (std::list<ObserverInterface*>::iterator it = observers_.begin();
- it != observers_.end(); it++) {
- if (*it == observer) {
- observers_.erase(it);
- break;
- }
- }
- }
-
- void FireOnChanged() {
- // Copy the list of observers to avoid a crash if the observer object
- // unregisters as a result of the OnChanged() call. If the same list is used
- // UnregisterObserver will affect the list make the iterator invalid.
- std::list<ObserverInterface*> observers = observers_;
- for (std::list<ObserverInterface*>::iterator it = observers.begin();
- it != observers.end(); ++it) {
- (*it)->OnChanged();
- }
- }
-
- protected:
- std::list<ObserverInterface*> observers_;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_NOTIFIER_H_
diff --git a/api/optional.cc b/api/optional.cc
deleted file mode 100644
index ec86966..0000000
--- a/api/optional.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2016 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 "webrtc/api/optional.h"
-
-namespace rtc {
-namespace optional_internal {
-
-#if RTC_HAS_ASAN
-
-void* FunctionThatDoesNothingImpl(void* x) {
- return x;
-}
-
-#endif
-
-} // namespace optional_internal
-} // namespace rtc
diff --git a/api/optional.h b/api/optional.h
deleted file mode 100644
index de1ec76..0000000
--- a/api/optional.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright 2015 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 WEBRTC_API_OPTIONAL_H_
-#define WEBRTC_API_OPTIONAL_H_
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-
-#ifdef UNIT_TEST
-#include <iomanip>
-#include <ostream>
-#endif // UNIT_TEST
-
-#include "webrtc/api/array_view.h"
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/sanitizer.h"
-
-namespace rtc {
-
-namespace optional_internal {
-
-#if RTC_HAS_ASAN
-
-// This is a non-inlined function. The optimizer can't see inside it. It
-// prevents the compiler from generating optimized code that reads value_ even
-// if it is unset. Although safe, this causes memory sanitizers to complain.
-void* FunctionThatDoesNothingImpl(void*);
-
-template <typename T>
-inline T* FunctionThatDoesNothing(T* x) {
- return reinterpret_cast<T*>(
- FunctionThatDoesNothingImpl(reinterpret_cast<void*>(x)));
-}
-
-#else
-
-template <typename T>
-inline T* FunctionThatDoesNothing(T* x) {
- return x;
-}
-
-#endif
-
-} // namespace optional_internal
-
-// Simple std::optional-wannabe. It either contains a T or not.
-//
-// A moved-from Optional<T> may only be destroyed, and assigned to if T allows
-// being assigned to after having been moved from. Specifically, you may not
-// assume that it just doesn't contain a value anymore.
-//
-// Examples of good places to use Optional:
-//
-// - As a class or struct member, when the member doesn't always have a value:
-// struct Prisoner {
-// std::string name;
-// Optional<int> cell_number; // Empty if not currently incarcerated.
-// };
-//
-// - As a return value for functions that may fail to return a value on all
-// allowed inputs. For example, a function that searches an array might
-// return an Optional<size_t> (the index where it found the element, or
-// nothing if it didn't find it); and a function that parses numbers might
-// return Optional<double> (the parsed number, or nothing if parsing failed).
-//
-// Examples of bad places to use Optional:
-//
-// - As a return value for functions that may fail because of disallowed
-// inputs. For example, a string length function should not return
-// Optional<size_t> so that it can return nothing in case the caller passed
-// it a null pointer; the function should probably use RTC_[D]CHECK instead,
-// and return plain size_t.
-//
-// - As a return value for functions that may fail to return a value on all
-// allowed inputs, but need to tell the caller what went wrong. Returning
-// Optional<double> when parsing a single number as in the example above
-// might make sense, but any larger parse job is probably going to need to
-// tell the caller what the problem was, not just that there was one.
-//
-// - As a non-mutable function argument. When you want to pass a value of a
-// type T that can fail to be there, const T* is almost always both fastest
-// and cleanest. (If you're *sure* that the the caller will always already
-// have an Optional<T>, const Optional<T>& is slightly faster than const T*,
-// but this is a micro-optimization. In general, stick to const T*.)
-//
-// TODO(kwiberg): Get rid of this class when the standard library has
-// std::optional (and we're allowed to use it).
-template <typename T>
-class Optional final {
- public:
- // Construct an empty Optional.
- Optional() : has_value_(false), empty_('\0') { PoisonValue(); }
-
- // Construct an Optional that contains a value.
- explicit Optional(const T& value) : has_value_(true) {
- new (&value_) T(value);
- }
- explicit Optional(T&& value) : has_value_(true) {
- new (&value_) T(std::move(value));
- }
-
- // Copy constructor: copies the value from m if it has one.
- Optional(const Optional& m) : has_value_(m.has_value_) {
- if (has_value_)
- new (&value_) T(m.value_);
- else
- PoisonValue();
- }
-
- // Move constructor: if m has a value, moves the value from m, leaving m
- // still in a state where it has a value, but a moved-from one (the
- // properties of which depends on T; the only general guarantee is that we
- // can destroy m).
- Optional(Optional&& m) : has_value_(m.has_value_) {
- if (has_value_)
- new (&value_) T(std::move(m.value_));
- else
- PoisonValue();
- }
-
- ~Optional() {
- if (has_value_)
- value_.~T();
- else
- UnpoisonValue();
- }
-
- // Copy assignment. Uses T's copy assignment if both sides have a value, T's
- // copy constructor if only the right-hand side has a value.
- Optional& operator=(const Optional& m) {
- if (m.has_value_) {
- if (has_value_) {
- value_ = m.value_; // T's copy assignment.
- } else {
- UnpoisonValue();
- new (&value_) T(m.value_); // T's copy constructor.
- has_value_ = true;
- }
- } else {
- reset();
- }
- return *this;
- }
-
- // Move assignment. Uses T's move assignment if both sides have a value, T's
- // move constructor if only the right-hand side has a value. The state of m
- // after it's been moved from is as for the move constructor.
- Optional& operator=(Optional&& m) {
- if (m.has_value_) {
- if (has_value_) {
- value_ = std::move(m.value_); // T's move assignment.
- } else {
- UnpoisonValue();
- new (&value_) T(std::move(m.value_)); // T's move constructor.
- has_value_ = true;
- }
- } else {
- reset();
- }
- return *this;
- }
-
- // Swap the values if both m1 and m2 have values; move the value if only one
- // of them has one.
- friend void swap(Optional& m1, Optional& m2) {
- if (m1.has_value_) {
- if (m2.has_value_) {
- // Both have values: swap.
- using std::swap;
- swap(m1.value_, m2.value_);
- } else {
- // Only m1 has a value: move it to m2.
- m2.UnpoisonValue();
- new (&m2.value_) T(std::move(m1.value_));
- m1.value_.~T(); // Destroy the moved-from value.
- m1.has_value_ = false;
- m2.has_value_ = true;
- m1.PoisonValue();
- }
- } else if (m2.has_value_) {
- // Only m2 has a value: move it to m1.
- m1.UnpoisonValue();
- new (&m1.value_) T(std::move(m2.value_));
- m2.value_.~T(); // Destroy the moved-from value.
- m1.has_value_ = true;
- m2.has_value_ = false;
- m2.PoisonValue();
- }
- }
-
- // Destroy any contained value. Has no effect if we have no value.
- void reset() {
- if (!has_value_)
- return;
- value_.~T();
- has_value_ = false;
- PoisonValue();
- }
-
- template <class... Args>
- void emplace(Args&&... args) {
- if (has_value_)
- value_.~T();
- else
- UnpoisonValue();
- new (&value_) T(std::forward<Args>(args)...);
- has_value_ = true;
- }
-
- // Conversion to bool to test if we have a value.
- explicit operator bool() const { return has_value_; }
- bool has_value() const { return has_value_; }
-
- // Dereferencing. Only allowed if we have a value.
- const T* operator->() const {
- RTC_DCHECK(has_value_);
- return &value_;
- }
- T* operator->() {
- RTC_DCHECK(has_value_);
- return &value_;
- }
- const T& operator*() const {
- RTC_DCHECK(has_value_);
- return value_;
- }
- T& operator*() {
- RTC_DCHECK(has_value_);
- return value_;
- }
- const T& value() const {
- RTC_DCHECK(has_value_);
- return value_;
- }
- T& value() {
- RTC_DCHECK(has_value_);
- return value_;
- }
-
- // Dereference with a default value in case we don't have a value.
- const T& value_or(const T& default_val) const {
- // The no-op call prevents the compiler from generating optimized code that
- // reads value_ even if !has_value_, but only if FunctionThatDoesNothing is
- // not completely inlined; see its declaration.).
- return has_value_ ? *optional_internal::FunctionThatDoesNothing(&value_)
- : default_val;
- }
-
- // Dereference and move value.
- T MoveValue() {
- RTC_DCHECK(has_value_);
- return std::move(value_);
- }
-
- // Equality tests. Two Optionals are equal if they contain equivalent values,
- // or if they're both empty.
- friend bool operator==(const Optional& m1, const Optional& m2) {
- return m1.has_value_ && m2.has_value_ ? m1.value_ == m2.value_
- : m1.has_value_ == m2.has_value_;
- }
- friend bool operator==(const Optional& opt, const T& value) {
- return opt.has_value_ && opt.value_ == value;
- }
- friend bool operator==(const T& value, const Optional& opt) {
- return opt.has_value_ && value == opt.value_;
- }
-
- friend bool operator!=(const Optional& m1, const Optional& m2) {
- return m1.has_value_ && m2.has_value_ ? m1.value_ != m2.value_
- : m1.has_value_ != m2.has_value_;
- }
- friend bool operator!=(const Optional& opt, const T& value) {
- return !opt.has_value_ || opt.value_ != value;
- }
- friend bool operator!=(const T& value, const Optional& opt) {
- return !opt.has_value_ || value != opt.value_;
- }
-
- private:
- // Tell sanitizers that value_ shouldn't be touched.
- void PoisonValue() {
- rtc::AsanPoison(rtc::MakeArrayView(&value_, 1));
- rtc::MsanMarkUninitialized(rtc::MakeArrayView(&value_, 1));
- }
-
- // Tell sanitizers that value_ is OK to touch again.
- void UnpoisonValue() { rtc::AsanUnpoison(rtc::MakeArrayView(&value_, 1)); }
-
- bool has_value_; // True iff value_ contains a live value.
- union {
- // empty_ exists only to make it possible to initialize the union, even when
- // it doesn't contain any data. If the union goes uninitialized, it may
- // trigger compiler warnings.
- char empty_;
- // By placing value_ in a union, we get to manage its construction and
- // destruction manually: the Optional constructors won't automatically
- // construct it, and the Optional destructor won't automatically destroy
- // it. Basically, this just allocates a properly sized and aligned block of
- // memory in which we can manually put a T with placement new.
- T value_;
- };
-};
-
-#ifdef UNIT_TEST
-namespace optional_internal {
-
-// Checks if there's a valid PrintTo(const T&, std::ostream*) call for T.
-template <typename T>
-struct HasPrintTo {
- private:
- struct No {};
-
- template <typename T2>
- static auto Test(const T2& obj)
- -> decltype(PrintTo(obj, std::declval<std::ostream*>()));
-
- template <typename>
- static No Test(...);
-
- public:
- static constexpr bool value =
- !std::is_same<decltype(Test<T>(std::declval<const T&>())), No>::value;
-};
-
-// Checks if there's a valid operator<<(std::ostream&, const T&) call for T.
-template <typename T>
-struct HasOstreamOperator {
- private:
- struct No {};
-
- template <typename T2>
- static auto Test(const T2& obj)
- -> decltype(std::declval<std::ostream&>() << obj);
-
- template <typename>
- static No Test(...);
-
- public:
- static constexpr bool value =
- !std::is_same<decltype(Test<T>(std::declval<const T&>())), No>::value;
-};
-
-// Prefer using PrintTo to print the object.
-template <typename T>
-typename std::enable_if<HasPrintTo<T>::value, void>::type OptionalPrintToHelper(
- const T& value,
- std::ostream* os) {
- PrintTo(value, os);
-}
-
-// Fall back to operator<<(std::ostream&, ...) if it exists.
-template <typename T>
-typename std::enable_if<HasOstreamOperator<T>::value && !HasPrintTo<T>::value,
- void>::type
-OptionalPrintToHelper(const T& value, std::ostream* os) {
- *os << value;
-}
-
-inline void OptionalPrintObjectBytes(const unsigned char* bytes,
- size_t size,
- std::ostream* os) {
- *os << "<optional with " << size << "-byte object [";
- for (size_t i = 0; i != size; ++i) {
- *os << (i == 0 ? "" : ((i & 1) ? "-" : " "));
- *os << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<int>(bytes[i]);
- }
- *os << "]>";
-}
-
-// As a final back-up, just print the contents of the objcets byte-wise.
-template <typename T>
-typename std::enable_if<!HasOstreamOperator<T>::value && !HasPrintTo<T>::value,
- void>::type
-OptionalPrintToHelper(const T& value, std::ostream* os) {
- OptionalPrintObjectBytes(reinterpret_cast<const unsigned char*>(&value),
- sizeof(value), os);
-}
-
-} // namespace optional_internal
-
-// PrintTo is used by gtest to print out the results of tests. We want to ensure
-// the object contained in an Optional can be printed out if it's set, while
-// avoiding touching the object's storage if it is undefined.
-template <typename T>
-void PrintTo(const rtc::Optional<T>& opt, std::ostream* os) {
- if (opt) {
- optional_internal::OptionalPrintToHelper(*opt, os);
- } else {
- *os << "<empty optional>";
- }
-}
-
-#endif // UNIT_TEST
-
-} // namespace rtc
-
-#endif // WEBRTC_API_OPTIONAL_H_
diff --git a/api/optional_unittest.cc b/api/optional_unittest.cc
deleted file mode 100644
index f8f9cf3..0000000
--- a/api/optional_unittest.cc
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
- * Copyright 2015 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 <memory>
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "webrtc/api/optional.h"
-#include "webrtc/rtc_base/gunit.h"
-
-namespace rtc {
-
-namespace {
-
-struct MyUnprintableType {
- int value;
-};
-
-struct MyPrintableType {
- int value;
-};
-
-struct MyOstreamPrintableType {
- int value;
-};
-
-void PrintTo(const MyPrintableType& mpt, std::ostream* os) {
- *os << "The value is " << mpt.value;
-}
-
-std::ostream& operator<<(std::ostream& os, const MyPrintableType& mpt) {
- os << mpt.value;
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const MyOstreamPrintableType& mpt) {
- os << mpt.value;
- return os;
-}
-
-// Class whose instances logs various method calls (constructor, destructor,
-// etc.). Each instance has a unique ID (a simple global sequence number) and
-// an origin ID. When a copy is made, the new object gets a fresh ID but copies
-// the origin ID from the original. When a new Logger is created from scratch,
-// it gets a fresh ID, and the origin ID is the same as the ID (default
-// constructor) or given as an argument (explicit constructor).
-class Logger {
- public:
- Logger() : id_(g_next_id++), origin_(id_) { Log("default constructor"); }
- explicit Logger(int origin) : id_(g_next_id++), origin_(origin) {
- Log("explicit constructor");
- }
- Logger(int origin, const Logger& pass_by_ref, Logger pass_by_value)
- : id_(g_next_id++), origin_(origin) {
- Log("multi parameter constructor");
- }
- Logger(const Logger& other) : id_(g_next_id++), origin_(other.origin_) {
- LogFrom("copy constructor", other);
- }
- Logger(Logger&& other) : id_(g_next_id++), origin_(other.origin_) {
- LogFrom("move constructor", other);
- }
- ~Logger() { Log("destructor"); }
- Logger& operator=(const Logger& other) {
- origin_ = other.origin_;
- LogFrom("operator= copy", other);
- return *this;
- }
- Logger& operator=(Logger&& other) {
- origin_ = other.origin_;
- LogFrom("operator= move", other);
- return *this;
- }
- friend void swap(Logger& a, Logger& b) {
- using std::swap;
- swap(a.origin_, b.origin_);
- Log2("swap", a, b);
- }
- friend bool operator==(const Logger& a, const Logger& b) {
- Log2("operator==", a, b);
- return a.origin_ == b.origin_;
- }
- friend bool operator!=(const Logger& a, const Logger& b) {
- Log2("operator!=", a, b);
- return a.origin_ != b.origin_;
- }
- void Foo() { Log("Foo()"); }
- void Foo() const { Log("Foo() const"); }
- static std::unique_ptr<std::vector<std::string>> Setup() {
- std::unique_ptr<std::vector<std::string>> s(new std::vector<std::string>);
- g_log = s.get();
- g_next_id = 0;
- return s;
- }
-
- private:
- int id_;
- int origin_;
- static std::vector<std::string>* g_log;
- static int g_next_id;
- void Log(const char* msg) const {
- std::ostringstream oss;
- oss << id_ << ':' << origin_ << ". " << msg;
- g_log->push_back(oss.str());
- }
- void LogFrom(const char* msg, const Logger& other) const {
- std::ostringstream oss;
- oss << id_ << ':' << origin_ << ". " << msg << " (from " << other.id_ << ':'
- << other.origin_ << ")";
- g_log->push_back(oss.str());
- }
- static void Log2(const char* msg, const Logger& a, const Logger& b) {
- std::ostringstream oss;
- oss << msg << ' ' << a.id_ << ':' << a.origin_ << ", " << b.id_ << ':'
- << b.origin_;
- g_log->push_back(oss.str());
- }
-};
-
-std::vector<std::string>* Logger::g_log = nullptr;
-int Logger::g_next_id = 0;
-
-// Append all the other args to the vector pointed to by the first arg.
-template <typename T>
-void VectorAppend(std::vector<T>* v) {}
-template <typename T, typename... Ts>
-void VectorAppend(std::vector<T>* v, const T& e, Ts... es) {
- v->push_back(e);
- VectorAppend(v, es...);
-}
-
-// Create a vector of strings. Because we're not allowed to use
-// std::initializer_list.
-template <typename... Ts>
-std::vector<std::string> V(Ts... es) {
- std::vector<std::string> strings;
- VectorAppend(&strings, static_cast<std::string>(es)...);
- return strings;
-}
-
-} // namespace
-
-TEST(OptionalTest, TestConstructDefault) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- EXPECT_FALSE(x);
- EXPECT_FALSE(x.has_value());
- }
- EXPECT_EQ(V(), *log);
-}
-
-TEST(OptionalTest, TestConstructCopyEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- EXPECT_FALSE(x);
- EXPECT_FALSE(x.has_value());
- auto y = x;
- EXPECT_FALSE(y);
- EXPECT_FALSE(y.has_value());
- }
- EXPECT_EQ(V(), *log);
-}
-
-TEST(OptionalTest, TestConstructCopyFull) {
- auto log = Logger::Setup();
- {
- Logger a;
- Optional<Logger> x(a);
- EXPECT_TRUE(x);
- EXPECT_TRUE(x.has_value());
- log->push_back("---");
- auto y = x;
- EXPECT_TRUE(y);
- EXPECT_TRUE(y.has_value());
- log->push_back("---");
- }
- EXPECT_EQ(V("0:0. default constructor", "1:0. copy constructor (from 0:0)",
- "---", "2:0. copy constructor (from 1:0)", "---",
- "2:0. destructor", "1:0. destructor", "0:0. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestConstructMoveEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- EXPECT_FALSE(x);
- EXPECT_FALSE(x.has_value());
- auto y = std::move(x);
- EXPECT_FALSE(y);
- EXPECT_FALSE(y.has_value());
- }
- EXPECT_EQ(V(), *log);
-}
-
-TEST(OptionalTest, TestConstructMoveFull) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- EXPECT_TRUE(x);
- EXPECT_TRUE(x.has_value());
- log->push_back("---");
- auto y = std::move(x);
- EXPECT_TRUE(x);
- EXPECT_TRUE(x.has_value());
- EXPECT_TRUE(y);
- EXPECT_TRUE(y.has_value());
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "---", "2:17. move constructor (from 1:17)", "---",
- "2:17. destructor", "1:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestCopyAssignToEmptyFromEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x, y;
- x = y;
- }
- EXPECT_EQ(V(), *log);
-}
-
-TEST(OptionalTest, TestCopyAssignToFullFromEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Optional<Logger> y;
- log->push_back("---");
- x = y;
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "---", "1:17. destructor", "---"),
- *log);
-}
-
-TEST(OptionalTest, TestCopyAssignToEmptyFromFull) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Optional<Logger> y(Logger(17));
- log->push_back("---");
- x = y;
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "---", "2:17. copy constructor (from 1:17)", "---",
- "1:17. destructor", "2:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestCopyAssignToFullFromFull) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Optional<Logger> y(Logger(42));
- log->push_back("---");
- x = y;
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "2:42. explicit constructor",
- "3:42. move constructor (from 2:42)", "2:42. destructor", "---",
- "1:42. operator= copy (from 3:42)", "---", "3:42. destructor",
- "1:42. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestCopyAssignToEmptyFromT) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Logger y(17);
- log->push_back("---");
- x = Optional<Logger>(y);
- log->push_back("---");
- }
- EXPECT_EQ(V("0:17. explicit constructor", "---",
- "1:17. copy constructor (from 0:17)",
- "2:17. move constructor (from 1:17)", "1:17. destructor", "---",
- "0:17. destructor", "2:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestCopyAssignToFullFromT) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Logger y(42);
- log->push_back("---");
- x = Optional<Logger>(y);
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "2:42. explicit constructor", "---",
- "3:42. copy constructor (from 2:42)",
- "1:42. operator= move (from 3:42)", "3:42. destructor", "---",
- "2:42. destructor", "1:42. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestMoveAssignToEmptyFromEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x, y;
- x = std::move(y);
- }
- EXPECT_EQ(V(), *log);
-}
-
-TEST(OptionalTest, TestMoveAssignToFullFromEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Optional<Logger> y;
- log->push_back("---");
- x = std::move(y);
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "---", "1:17. destructor", "---"),
- *log);
-}
-
-TEST(OptionalTest, TestMoveAssignToEmptyFromFull) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Optional<Logger> y(Logger(17));
- log->push_back("---");
- x = std::move(y);
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "---", "2:17. move constructor (from 1:17)", "---",
- "1:17. destructor", "2:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestMoveAssignToFullFromFull) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Optional<Logger> y(Logger(42));
- log->push_back("---");
- x = std::move(y);
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "2:42. explicit constructor",
- "3:42. move constructor (from 2:42)", "2:42. destructor", "---",
- "1:42. operator= move (from 3:42)", "---", "3:42. destructor",
- "1:42. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestMoveAssignToEmptyFromT) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Logger y(17);
- log->push_back("---");
- x = Optional<Logger>(std::move(y));
- log->push_back("---");
- }
- EXPECT_EQ(V("0:17. explicit constructor", "---",
- "1:17. move constructor (from 0:17)",
- "2:17. move constructor (from 1:17)", "1:17. destructor", "---",
- "0:17. destructor", "2:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestMoveAssignToFullFromT) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Logger y(42);
- log->push_back("---");
- x = Optional<Logger>(std::move(y));
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "2:42. explicit constructor", "---",
- "3:42. move constructor (from 2:42)",
- "1:42. operator= move (from 3:42)", "3:42. destructor", "---",
- "2:42. destructor", "1:42. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestResetEmpty) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- x.reset();
- }
- EXPECT_EQ(V(), *log);
-}
-
-TEST(OptionalTest, TestResetFull) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- log->push_back("---");
- x.reset();
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
- "0:17. destructor", "---", "1:17. destructor", "---"),
- *log);
-}
-
-TEST(OptionalTest, TestEmplaceEmptyWithExplicit) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- log->push_back("---");
- x.emplace(42);
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("---",
- "0:42. explicit constructor",
- "---",
- "0:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceEmptyWithMultipleParameters) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Logger ref(21);
- Logger value(35);
- log->push_back("---");
- x.emplace(42, ref, std::move(value));
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:21. explicit constructor",
- "1:35. explicit constructor",
- "---",
- "2:35. move constructor (from 1:35)",
- "3:42. multi parameter constructor",
- "2:35. destructor",
- "---",
- "1:35. destructor",
- "0:21. destructor",
- "3:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceEmptyWithCopy) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Logger y(42);
- log->push_back("---");
- x.emplace(y);
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:42. explicit constructor",
- "---",
- "1:42. copy constructor (from 0:42)",
- "---",
- "0:42. destructor",
- "1:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceEmptyWithMove) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x;
- Logger y(42);
- log->push_back("---");
- x.emplace(std::move(y));
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:42. explicit constructor",
- "---",
- "1:42. move constructor (from 0:42)",
- "---",
- "0:42. destructor",
- "1:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceFullWithExplicit) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- log->push_back("---");
- x.emplace(42);
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(
- V("0:17. explicit constructor",
- "1:17. move constructor (from 0:17)",
- "0:17. destructor",
- "---",
- "1:17. destructor",
- "2:42. explicit constructor",
- "---",
- "2:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceFullWithMultipleParameters) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Logger ref(21);
- Logger value(35);
- log->push_back("---");
- x.emplace(42, ref, std::move(value));
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:17. explicit constructor",
- "1:17. move constructor (from 0:17)",
- "0:17. destructor",
- "2:21. explicit constructor",
- "3:35. explicit constructor",
- "---",
- "1:17. destructor",
- "4:35. move constructor (from 3:35)",
- "5:42. multi parameter constructor",
- "4:35. destructor",
- "---",
- "3:35. destructor",
- "2:21. destructor",
- "5:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceFullWithCopy) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Logger y(42);
- log->push_back("---");
- x.emplace(y);
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:17. explicit constructor",
- "1:17. move constructor (from 0:17)",
- "0:17. destructor",
- "2:42. explicit constructor",
- "---",
- "1:17. destructor",
- "3:42. copy constructor (from 2:42)",
- "---",
- "2:42. destructor",
- "3:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestEmplaceFullWithMove) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(17));
- Logger y(42);
- log->push_back("---");
- x.emplace(std::move(y));
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:17. explicit constructor",
- "1:17. move constructor (from 0:17)",
- "0:17. destructor",
- "2:42. explicit constructor",
- "---",
- "1:17. destructor",
- "3:42. move constructor (from 2:42)",
- "---",
- "2:42. destructor",
- "3:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestDereference) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(42));
- const auto& y = x;
- log->push_back("---");
- x->Foo();
- y->Foo();
- std::move(x)->Foo();
- std::move(y)->Foo();
- log->push_back("---");
- (*x).Foo();
- (*y).Foo();
- (*std::move(x)).Foo();
- (*std::move(y)).Foo();
- log->push_back("---");
- x.value().Foo();
- y.value().Foo();
- std::move(x).value().Foo();
- std::move(y).value().Foo();
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:42. explicit constructor",
- "1:42. move constructor (from 0:42)",
- "0:42. destructor",
- "---",
- "1:42. Foo()",
- "1:42. Foo() const",
- "1:42. Foo()",
- "1:42. Foo() const",
- "---",
- "1:42. Foo()",
- "1:42. Foo() const",
- "1:42. Foo()",
- "1:42. Foo() const",
- "---",
- "1:42. Foo()",
- "1:42. Foo() const",
- "1:42. Foo()",
- "1:42. Foo() const",
- "---",
- "1:42. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestDereferenceWithDefault) {
- auto log = Logger::Setup();
- {
- const Logger a(17), b(42);
- Optional<Logger> x(a);
- Optional<Logger> y;
- log->push_back("-1-");
- EXPECT_EQ(a, x.value_or(Logger(42)));
- log->push_back("-2-");
- EXPECT_EQ(b, y.value_or(Logger(42)));
- log->push_back("-3-");
- EXPECT_EQ(a, Optional<Logger>(Logger(17)).value_or(b));
- log->push_back("-4-");
- EXPECT_EQ(b, Optional<Logger>().value_or(b));
- log->push_back("-5-");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:42. explicit constructor",
- "2:17. copy constructor (from 0:17)", "-1-",
- "3:42. explicit constructor", "operator== 0:17, 2:17",
- "3:42. destructor", "-2-", "4:42. explicit constructor",
- "operator== 1:42, 4:42", "4:42. destructor", "-3-",
- "5:17. explicit constructor", "6:17. move constructor (from 5:17)",
- "operator== 0:17, 6:17", "6:17. destructor", "5:17. destructor", "-4-",
- "operator== 1:42, 1:42", "-5-", "2:17. destructor", "1:42. destructor",
- "0:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestEquality) {
- auto log = Logger::Setup();
- {
- Logger a(17), b(42);
- Optional<Logger> ma1(a), ma2(a), mb(b), me1, me2;
- log->push_back("---");
- EXPECT_EQ(ma1, ma1);
- EXPECT_EQ(ma1, ma2);
- EXPECT_NE(ma1, mb);
- EXPECT_NE(ma1, me1);
- EXPECT_EQ(me1, me1);
- EXPECT_EQ(me1, me2);
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:17. explicit constructor", "1:42. explicit constructor",
- "2:17. copy constructor (from 0:17)",
- "3:17. copy constructor (from 0:17)",
- "4:42. copy constructor (from 1:42)", "---", "operator== 2:17, 2:17",
- "operator== 2:17, 3:17", "operator!= 2:17, 4:42", "---",
- "4:42. destructor", "3:17. destructor", "2:17. destructor",
- "1:42. destructor", "0:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestEqualityWithObject) {
- auto log = Logger::Setup();
- {
- Logger a(17), b(42);
- Optional<Logger> ma(a), me;
- // Using operator== and operator!= explicetly instead of EXPECT_EQ/EXPECT_NE
- // macros because those operators are under test.
- log->push_back("---");
-
- EXPECT_TRUE(ma == a);
- EXPECT_TRUE(a == ma);
- EXPECT_FALSE(ma == b);
- EXPECT_FALSE(b == ma);
- EXPECT_FALSE(me == a);
- EXPECT_FALSE(a == me);
-
- EXPECT_FALSE(ma != a);
- EXPECT_FALSE(a != ma);
- EXPECT_TRUE(ma != b);
- EXPECT_TRUE(b != ma);
- EXPECT_TRUE(me != a);
- EXPECT_TRUE(a != me);
-
- log->push_back("---");
- }
- // clang-format off
- EXPECT_EQ(V("0:17. explicit constructor",
- "1:42. explicit constructor",
- "2:17. copy constructor (from 0:17)",
- "---",
- "operator== 2:17, 0:17",
- "operator== 0:17, 2:17",
- "operator== 2:17, 1:42",
- "operator== 1:42, 2:17",
- // No operator should be called when comparing to empty.
- "operator!= 2:17, 0:17",
- "operator!= 0:17, 2:17",
- "operator!= 2:17, 1:42",
- "operator!= 1:42, 2:17",
- // No operator should be called when comparing to empty.
- "---",
- "2:17. destructor",
- "1:42. destructor",
- "0:17. destructor"),
- *log);
- // clang-format on
-}
-
-TEST(OptionalTest, TestSwap) {
- auto log = Logger::Setup();
- {
- Logger a(17), b(42);
- Optional<Logger> x1(a), x2(b), y1(a), y2, z1, z2;
- log->push_back("---");
- swap(x1, x2); // Swap full <-> full.
- swap(y1, y2); // Swap full <-> empty.
- swap(z1, z2); // Swap empty <-> empty.
- log->push_back("---");
- }
- EXPECT_EQ(V("0:17. explicit constructor", "1:42. explicit constructor",
- "2:17. copy constructor (from 0:17)",
- "3:42. copy constructor (from 1:42)",
- "4:17. copy constructor (from 0:17)", "---", "swap 2:42, 3:17",
- "5:17. move constructor (from 4:17)", "4:17. destructor", "---",
- "5:17. destructor", "3:17. destructor", "2:42. destructor",
- "1:42. destructor", "0:17. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestMoveValue) {
- auto log = Logger::Setup();
- {
- Optional<Logger> x(Logger(42));
- log->push_back("---");
- Logger moved = x.MoveValue();
- log->push_back("---");
- }
- EXPECT_EQ(
- V("0:42. explicit constructor", "1:42. move constructor (from 0:42)",
- "0:42. destructor", "---", "2:42. move constructor (from 1:42)", "---",
- "2:42. destructor", "1:42. destructor"),
- *log);
-}
-
-TEST(OptionalTest, TestPrintTo) {
- constexpr char kEmptyOptionalMessage[] = "<empty optional>";
- const Optional<MyUnprintableType> empty_unprintable;
- const Optional<MyPrintableType> empty_printable;
- const Optional<MyOstreamPrintableType> empty_ostream_printable;
- EXPECT_EQ(kEmptyOptionalMessage, ::testing::PrintToString(empty_unprintable));
- EXPECT_EQ(kEmptyOptionalMessage, ::testing::PrintToString(empty_printable));
- EXPECT_EQ(kEmptyOptionalMessage,
- ::testing::PrintToString(empty_ostream_printable));
- EXPECT_NE("1", ::testing::PrintToString(Optional<MyUnprintableType>({1})));
- EXPECT_NE("1", ::testing::PrintToString(Optional<MyPrintableType>({1})));
- EXPECT_EQ("The value is 1",
- ::testing::PrintToString(Optional<MyPrintableType>({1})));
- EXPECT_EQ("1",
- ::testing::PrintToString(Optional<MyOstreamPrintableType>({1})));
-}
-
-void UnusedFunctionWorkaround() {
- // These are here to ensure we don't get warnings about ostream and PrintTo
- // for MyPrintableType never getting called.
- const MyPrintableType dont_warn{17};
- const MyOstreamPrintableType dont_warn2{18};
- std::stringstream sstr;
- sstr << dont_warn;
- PrintTo(dont_warn, &sstr);
- sstr << dont_warn2;
-}
-
-} // namespace rtc
diff --git a/api/ortc/mediadescription.cc b/api/ortc/mediadescription.cc
deleted file mode 100644
index 9fca55c..0000000
--- a/api/ortc/mediadescription.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright 2017 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 "webrtc/api/ortc/mediadescription.h"
-
-namespace webrtc {}
diff --git a/api/ortc/mediadescription.h b/api/ortc/mediadescription.h
deleted file mode 100644
index d638dfc..0000000
--- a/api/ortc/mediadescription.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_MEDIADESCRIPTION_H_
-#define WEBRTC_API_ORTC_MEDIADESCRIPTION_H_
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "webrtc/api/optional.h"
-#include "webrtc/media/base/cryptoparams.h"
-
-namespace webrtc {
-
-// A structured representation of a media description within an SDP session
-// description.
-class MediaDescription {
- public:
- explicit MediaDescription(std::string mid) : mid_(std::move(mid)) {}
-
- ~MediaDescription() {}
-
- // The mid(media stream identification) is used for identifying media streams
- // within a session description.
- // https://tools.ietf.org/html/rfc5888#section-6
- rtc::Optional<std::string> mid() const { return mid_; }
- void set_mid(std::string mid) { mid_.emplace(std::move(mid)); }
-
- // Security keys and parameters for this media stream. Can be used to
- // negotiate parameters for SRTP.
- // https://tools.ietf.org/html/rfc4568#page-5
- std::vector<cricket::CryptoParams>& sdes_params() { return sdes_params_; }
- const std::vector<cricket::CryptoParams>& sdes_params() const {
- return sdes_params_;
- }
-
- private:
- rtc::Optional<std::string> mid_;
-
- std::vector<cricket::CryptoParams> sdes_params_;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_MEDIADESCRIPTION_H_
diff --git a/api/ortc/mediadescription_unittest.cc b/api/ortc/mediadescription_unittest.cc
deleted file mode 100644
index d033a4e..0000000
--- a/api/ortc/mediadescription_unittest.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2017 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 "webrtc/api/ortc/mediadescription.h"
-#include "webrtc/test/gtest.h"
-
-namespace webrtc {
-
-class MediaDescriptionTest : public testing::Test {};
-
-TEST_F(MediaDescriptionTest, CreateMediaDescription) {
- MediaDescription m("a");
- EXPECT_EQ("a", m.mid());
-}
-
-TEST_F(MediaDescriptionTest, AddSdesParam) {
- MediaDescription m("a");
- m.sdes_params().push_back(cricket::CryptoParams());
- const std::vector<cricket::CryptoParams>& params = m.sdes_params();
- EXPECT_EQ(1u, params.size());
-}
-
-} // namespace webrtc
diff --git a/api/ortc/ortcfactoryinterface.h b/api/ortc/ortcfactoryinterface.h
deleted file mode 100644
index 4880d9d..0000000
--- a/api/ortc/ortcfactoryinterface.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_ORTCFACTORYINTERFACE_H_
-#define WEBRTC_API_ORTC_ORTCFACTORYINTERFACE_H_
-
-#include <memory>
-#include <string>
-#include <utility> // For std::move.
-
-#include "webrtc/api/mediaconstraintsinterface.h"
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/api/mediatypes.h"
-#include "webrtc/api/ortc/ortcrtpreceiverinterface.h"
-#include "webrtc/api/ortc/ortcrtpsenderinterface.h"
-#include "webrtc/api/ortc/packettransportinterface.h"
-#include "webrtc/api/ortc/rtptransportcontrollerinterface.h"
-#include "webrtc/api/ortc/rtptransportinterface.h"
-#include "webrtc/api/ortc/srtptransportinterface.h"
-#include "webrtc/api/ortc/udptransportinterface.h"
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/api/rtpparameters.h"
-#include "webrtc/p2p/base/packetsocketfactory.h"
-#include "webrtc/rtc_base/network.h"
-#include "webrtc/rtc_base/scoped_ref_ptr.h"
-#include "webrtc/rtc_base/thread.h"
-
-namespace webrtc {
-
-// TODO(deadbeef): This should be part of /api/, but currently it's not and
-// including its header violates checkdeps rules.
-class AudioDeviceModule;
-
-// WARNING: This is experimental/under development, so use at your own risk; no
-// guarantee about API stability is guaranteed here yet.
-//
-// This class is the ORTC analog of PeerConnectionFactory. It acts as a factory
-// for ORTC objects that can be connected to each other.
-//
-// Some of these objects may not be represented by the ORTC specification, but
-// follow the same general principles.
-//
-// If one of the factory methods takes another object as an argument, it MUST
-// have been created by the same OrtcFactory.
-//
-// On object lifetimes: objects should be destroyed in this order:
-// 1. Objects created by the factory.
-// 2. The factory itself.
-// 3. Objects passed into OrtcFactoryInterface::Create.
-class OrtcFactoryInterface {
- public:
- // |network_thread| is the thread on which packets are sent and received.
- // If null, a new rtc::Thread with a default socket server is created.
- //
- // |signaling_thread| is used for callbacks to the consumer of the API. If
- // null, the current thread will be used, which assumes that the API consumer
- // is running a message loop on this thread (either using an existing
- // rtc::Thread, or by calling rtc::Thread::Current()->ProcessMessages).
- //
- // |network_manager| is used to determine which network interfaces are
- // available. This is used for ICE, for example. If null, a default
- // implementation will be used. Only accessed on |network_thread|.
- //
- // |socket_factory| is used (on the network thread) for creating sockets. If
- // it's null, a default implementation will be used, which assumes
- // |network_thread| is a normal rtc::Thread.
- //
- // |adm| is optional, and allows a different audio device implementation to
- // be injected; otherwise a platform-specific module will be used that will
- // use the default audio input.
- //
- // Note that the OrtcFactoryInterface does not take ownership of any of the
- // objects passed in, and as previously stated, these objects can't be
- // destroyed before the factory is.
- static RTCErrorOr<std::unique_ptr<OrtcFactoryInterface>> Create(
- rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
- rtc::NetworkManager* network_manager,
- rtc::PacketSocketFactory* socket_factory,
- AudioDeviceModule* adm);
-
- // Constructor for convenience which uses default implementations of
- // everything (though does still require that the current thread runs a
- // message loop; see above).
- static RTCErrorOr<std::unique_ptr<OrtcFactoryInterface>> Create() {
- return Create(nullptr, nullptr, nullptr, nullptr, nullptr);
- }
-
- virtual ~OrtcFactoryInterface() {}
-
- // Creates an RTP transport controller, which is used in calls to
- // CreateRtpTransport methods. If your application has some notion of a
- // "call", you should create one transport controller per call.
- //
- // However, if you only are using one RtpTransport object, this doesn't need
- // to be called explicitly; CreateRtpTransport will create one automatically
- // if |rtp_transport_controller| is null. See below.
- //
- // TODO(deadbeef): Add MediaConfig and RtcEventLog arguments?
- virtual RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>
- CreateRtpTransportController() = 0;
-
- // Creates an RTP transport using the provided packet transports and
- // transport controller.
- //
- // |rtp| will be used for sending RTP packets, and |rtcp| for RTCP packets.
- //
- // |rtp| can't be null. |rtcp| must be non-null if and only if
- // |rtp_parameters.rtcp.mux| is false, indicating that RTCP muxing isn't used.
- // Note that if RTCP muxing isn't enabled initially, it can still enabled
- // later through SetParameters.
- //
- // If |transport_controller| is null, one will automatically be created, and
- // its lifetime managed by the returned RtpTransport. This should only be
- // done if a single RtpTransport is being used to communicate with the remote
- // endpoint.
- virtual RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateRtpTransport(
- const RtpTransportParameters& rtp_parameters,
- PacketTransportInterface* rtp,
- PacketTransportInterface* rtcp,
- RtpTransportControllerInterface* transport_controller) = 0;
-
- // Creates an SrtpTransport which is an RTP transport that uses SRTP.
- virtual RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>
- CreateSrtpTransport(
- const RtpTransportParameters& rtp_parameters,
- PacketTransportInterface* rtp,
- PacketTransportInterface* rtcp,
- RtpTransportControllerInterface* transport_controller) = 0;
-
- // Returns the capabilities of an RTP sender of type |kind|. These
- // capabilities can be used to determine what RtpParameters to use to create
- // an RtpSender.
- //
- // If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure.
- virtual RtpCapabilities GetRtpSenderCapabilities(
- cricket::MediaType kind) const = 0;
-
- // Creates an RTP sender with |track|. Will not start sending until Send is
- // called. This is provided as a convenience; it's equivalent to calling
- // CreateRtpSender with a kind (see below), followed by SetTrack.
- //
- // |track| and |transport| must not be null.
- virtual RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
- rtc::scoped_refptr<MediaStreamTrackInterface> track,
- RtpTransportInterface* transport) = 0;
-
- // Overload of CreateRtpSender allows creating the sender without a track.
- //
- // |kind| must be MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO.
- virtual RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
- cricket::MediaType kind,
- RtpTransportInterface* transport) = 0;
-
- // Returns the capabilities of an RTP receiver of type |kind|. These
- // capabilities can be used to determine what RtpParameters to use to create
- // an RtpReceiver.
- //
- // If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure.
- virtual RtpCapabilities GetRtpReceiverCapabilities(
- cricket::MediaType kind) const = 0;
-
- // Creates an RTP receiver of type |kind|. Will not start receiving media
- // until Receive is called.
- //
- // |kind| must be MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO.
- //
- // |transport| must not be null.
- virtual RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>>
- CreateRtpReceiver(cricket::MediaType kind,
- RtpTransportInterface* transport) = 0;
-
- // Create a UDP transport with IP address family |family|, using a port
- // within the specified range.
- //
- // |family| must be AF_INET or AF_INET6.
- //
- // |min_port|/|max_port| values of 0 indicate no range restriction.
- //
- // Returns an error if the transport wasn't successfully created.
- virtual RTCErrorOr<std::unique_ptr<UdpTransportInterface>>
- CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) = 0;
-
- // Method for convenience that has no port range restrictions.
- RTCErrorOr<std::unique_ptr<UdpTransportInterface>> CreateUdpTransport(
- int family) {
- return CreateUdpTransport(family, 0, 0);
- }
-
- // NOTE: The methods below to create tracks/sources return scoped_refptrs
- // rather than unique_ptrs, because these interfaces are also used with
- // PeerConnection, where everything is ref-counted.
-
- // Creates a audio source representing the default microphone input.
- // |options| decides audio processing settings.
- virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
- const cricket::AudioOptions& options) = 0;
-
- // Version of the above method that uses default options.
- rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource() {
- return CreateAudioSource(cricket::AudioOptions());
- }
-
- // Creates a video source object wrapping and taking ownership of |capturer|.
- //
- // |constraints| can be used for selection of resolution and frame rate, and
- // may be null if no constraints are desired.
- virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
- std::unique_ptr<cricket::VideoCapturer> capturer,
- const MediaConstraintsInterface* constraints) = 0;
-
- // Version of the above method that omits |constraints|.
- rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
- std::unique_ptr<cricket::VideoCapturer> capturer) {
- return CreateVideoSource(std::move(capturer), nullptr);
- }
-
- // Creates a new local video track wrapping |source|. The same |source| can
- // be used in several tracks.
- virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
- const std::string& id,
- VideoTrackSourceInterface* source) = 0;
-
- // Creates an new local audio track wrapping |source|.
- virtual rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack(
- const std::string& id,
- AudioSourceInterface* source) = 0;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_ORTCFACTORYINTERFACE_H_
diff --git a/api/ortc/ortcrtpreceiverinterface.h b/api/ortc/ortcrtpreceiverinterface.h
deleted file mode 100644
index 1fad29c..0000000
--- a/api/ortc/ortcrtpreceiverinterface.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2017 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.
- */
-
-// This file contains interfaces for RtpReceivers:
-// http://publications.ortc.org/2016/20161202/#rtcrtpreceiver*
-//
-// However, underneath the RtpReceiver is an RtpTransport, rather than a
-// DtlsTransport. This is to allow different types of RTP transports (besides
-// DTLS-SRTP) to be used.
-
-#ifndef WEBRTC_API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
-#define WEBRTC_API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/api/mediatypes.h"
-#include "webrtc/api/ortc/rtptransportinterface.h"
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/api/rtpparameters.h"
-
-namespace webrtc {
-
-// Note: Since receiver capabilities may depend on how the OrtcFactory was
-// created, instead of a static "GetCapabilities" method on this interface,
-// there is a "GetRtpReceiverCapabilities" method on the OrtcFactory.
-class OrtcRtpReceiverInterface {
- public:
- virtual ~OrtcRtpReceiverInterface() {}
-
- // Returns a track representing the media received by this receiver.
- //
- // Currently, this will return null until Receive has been successfully
- // called. Also, a new track will be created every time the primary SSRC
- // changes.
- //
- // If encodings are removed, GetTrack will return null. Though deactivating
- // an encoding (setting |active| to false) will not do this.
- //
- // In the future, these limitations will be fixed, and GetTrack will return
- // the same track for the lifetime of the RtpReceiver. So it's not
- // recommended to write code that depends on this non-standard behavior.
- virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
-
- // Once supported, will switch to receiving media on a new transport.
- // However, this is not currently supported and will always return an error.
- virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
- // Returns previously set (or constructed-with) transport.
- virtual RtpTransportInterface* GetTransport() const = 0;
-
- // Start receiving media with |parameters| (if |parameters| contains an
- // active encoding).
- //
- // There are no limitations to how the parameters can be changed after the
- // initial call to Receive, as long as they're valid (for example, they can't
- // use the same payload type for two codecs).
- virtual RTCError Receive(const RtpParameters& parameters) = 0;
- // Returns parameters that were last successfully passed into Receive, or
- // empty parameters if that hasn't yet occurred.
- //
- // Note that for parameters that are described as having an "implementation
- // default" value chosen, GetParameters() will return those chosen defaults,
- // with the exception of SSRCs which have special behavior. See
- // rtpparameters.h for more details.
- virtual RtpParameters GetParameters() const = 0;
-
- // Audio or video receiver?
- //
- // Once GetTrack() starts always returning a track, this method will be
- // redundant, as one can call "GetTrack()->kind()". However, it's still a
- // nice convenience, and is symmetric with OrtcRtpSenderInterface::GetKind.
- virtual cricket::MediaType GetKind() const = 0;
-
- // TODO(deadbeef): GetContributingSources
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
diff --git a/api/ortc/ortcrtpsenderinterface.h b/api/ortc/ortcrtpsenderinterface.h
deleted file mode 100644
index a0fc208..0000000
--- a/api/ortc/ortcrtpsenderinterface.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2017 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.
- */
-
-// This file contains interfaces for RtpSenders:
-// http://publications.ortc.org/2016/20161202/#rtcrtpsender*
-//
-// However, underneath the RtpSender is an RtpTransport, rather than a
-// DtlsTransport. This is to allow different types of RTP transports (besides
-// DTLS-SRTP) to be used.
-
-#ifndef WEBRTC_API_ORTC_ORTCRTPSENDERINTERFACE_H_
-#define WEBRTC_API_ORTC_ORTCRTPSENDERINTERFACE_H_
-
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/api/mediatypes.h"
-#include "webrtc/api/ortc/rtptransportinterface.h"
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/api/rtpparameters.h"
-
-namespace webrtc {
-
-// Note: Since sender capabilities may depend on how the OrtcFactory was
-// created, instead of a static "GetCapabilities" method on this interface,
-// there is a "GetRtpSenderCapabilities" method on the OrtcFactory.
-class OrtcRtpSenderInterface {
- public:
- virtual ~OrtcRtpSenderInterface() {}
-
- // Sets the source of media that will be sent by this sender.
- //
- // If Send has already been called, will immediately switch to sending this
- // track. If |track| is null, will stop sending media.
- //
- // Returns INVALID_PARAMETER error if an audio track is set on a video
- // RtpSender, or vice-versa.
- virtual RTCError SetTrack(MediaStreamTrackInterface* track) = 0;
- // Returns previously set (or constructed-with) track.
- virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
-
- // Once supported, will switch to sending media on a new transport. However,
- // this is not currently supported and will always return an error.
- virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
- // Returns previously set (or constructed-with) transport.
- virtual RtpTransportInterface* GetTransport() const = 0;
-
- // Start sending media with |parameters| (if |parameters| contains an active
- // encoding).
- //
- // There are no limitations to how the parameters can be changed after the
- // initial call to Send, as long as they're valid (for example, they can't
- // use the same payload type for two codecs).
- virtual RTCError Send(const RtpParameters& parameters) = 0;
- // Returns parameters that were last successfully passed into Send, or empty
- // parameters if that hasn't yet occurred.
- //
- // Note that for parameters that are described as having an "implementation
- // default" value chosen, GetParameters() will return those chosen defaults,
- // with the exception of SSRCs which have special behavior. See
- // rtpparameters.h for more details.
- virtual RtpParameters GetParameters() const = 0;
-
- // Audio or video sender?
- virtual cricket::MediaType GetKind() const = 0;
-
- // TODO(deadbeef): SSRC conflict signal.
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_ORTCRTPSENDERINTERFACE_H_
diff --git a/api/ortc/packettransportinterface.h b/api/ortc/packettransportinterface.h
deleted file mode 100644
index 2677ce6..0000000
--- a/api/ortc/packettransportinterface.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_PACKETTRANSPORTINTERFACE_H_
-#define WEBRTC_API_ORTC_PACKETTRANSPORTINTERFACE_H_
-
-namespace rtc {
-
-class PacketTransportInternal;
-
-} // namespace rtc
-
-namespace webrtc {
-
-// Base class for different packet-based transports.
-class PacketTransportInterface {
- public:
- virtual ~PacketTransportInterface() {}
-
- protected:
- // Only for internal use. Returns a pointer to an internal interface, for use
- // by the implementation.
- virtual rtc::PacketTransportInternal* GetInternal() = 0;
-
- // Classes that can use this internal interface.
- friend class RtpTransportControllerAdapter;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_PACKETTRANSPORTINTERFACE_H_
diff --git a/api/ortc/rtptransportcontrollerinterface.h b/api/ortc/rtptransportcontrollerinterface.h
deleted file mode 100644
index d1d0e44..0000000
--- a/api/ortc/rtptransportcontrollerinterface.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
-#define WEBRTC_API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
-
-#include <vector>
-
-#include "webrtc/api/ortc/rtptransportinterface.h"
-
-namespace webrtc {
-
-class RtpTransportControllerAdapter;
-
-// Used to group RTP transports between a local endpoint and the same remote
-// endpoint, for the purpose of sharing bandwidth estimation and other things.
-//
-// Comparing this to the PeerConnection model, non-budled audio/video would use
-// two RtpTransports with a single RtpTransportController, whereas bundled
-// media would use a single RtpTransport, and two PeerConnections would use
-// independent RtpTransportControllers.
-//
-// RtpTransports are associated with this controller when they're created, by
-// passing the controller into OrtcFactory's relevant "CreateRtpTransport"
-// method. When a transport is destroyed, it's automatically disassociated.
-// GetTransports returns all currently associated transports.
-//
-// This is the RTP equivalent of "IceTransportController" in ORTC; RtpTransport
-// is to RtpTransportController as IceTransport is to IceTransportController.
-class RtpTransportControllerInterface {
- public:
- virtual ~RtpTransportControllerInterface() {}
-
- // Returns all transports associated with this controller (see explanation
- // above). No ordering is guaranteed.
- virtual std::vector<RtpTransportInterface*> GetTransports() const = 0;
-
- protected:
- // Only for internal use. Returns a pointer to an internal interface, for use
- // by the implementation.
- virtual RtpTransportControllerAdapter* GetInternal() = 0;
-
- // Classes that can use this internal interface.
- friend class OrtcFactory;
- friend class RtpTransportAdapter;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
diff --git a/api/ortc/rtptransportinterface.h b/api/ortc/rtptransportinterface.h
deleted file mode 100644
index 1fdc12c..0000000
--- a/api/ortc/rtptransportinterface.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_
-#define WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_
-
-#include <string>
-
-#include "webrtc/api/optional.h"
-#include "webrtc/api/ortc/packettransportinterface.h"
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/common_types.h"
-
-namespace webrtc {
-
-class RtpTransportAdapter;
-
-struct RtcpParameters final {
- // The SSRC to be used in the "SSRC of packet sender" field. If not set, one
- // will be chosen by the implementation.
- // TODO(deadbeef): Not implemented.
- rtc::Optional<uint32_t> ssrc;
-
- // The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
- //
- // If empty in the construction of the RtpTransport, one will be generated by
- // the implementation, and returned in GetRtcpParameters. Multiple
- // RtpTransports created by the same OrtcFactory will use the same generated
- // CNAME.
- //
- // If empty when passed into SetParameters, the CNAME simply won't be
- // modified.
- std::string cname;
-
- // Send reduced-size RTCP?
- bool reduced_size = false;
-
- // Send RTCP multiplexed on the RTP transport?
- bool mux = true;
-
- bool operator==(const RtcpParameters& o) const {
- return ssrc == o.ssrc && cname == o.cname &&
- reduced_size == o.reduced_size && mux == o.mux;
- }
- bool operator!=(const RtcpParameters& o) const { return !(*this == o); }
-};
-
-struct RtpTransportParameters final {
- RtcpParameters rtcp;
-
- // Enabled periodic sending of keep-alive packets, that help prevent timeouts
- // on the network level, such as NAT bindings. See RFC6263 section 4.6.
- RtpKeepAliveConfig keepalive;
-
- bool operator==(const RtpTransportParameters& o) const {
- return rtcp == o.rtcp && keepalive == o.keepalive;
- }
- bool operator!=(const RtpTransportParameters& o) const {
- return !(*this == o);
- }
-};
-
-// Base class for different types of RTP transports that can be created by an
-// OrtcFactory. Used by RtpSenders/RtpReceivers.
-//
-// This is not present in the standard ORTC API, but exists here for a few
-// reasons. Firstly, it allows different types of RTP transports to be used:
-// DTLS-SRTP (which is required for the web), but also SDES-SRTP and
-// unencrypted RTP. It also simplifies the handling of RTCP muxing, and
-// provides a better API point for it.
-//
-// Note that Edge's implementation of ORTC provides a similar API point, called
-// RTCSrtpSdesTransport:
-// https://msdn.microsoft.com/en-us/library/mt502527(v=vs.85).aspx
-class RtpTransportInterface {
- public:
- virtual ~RtpTransportInterface() {}
-
- // Returns packet transport that's used to send RTP packets.
- virtual PacketTransportInterface* GetRtpPacketTransport() const = 0;
-
- // Returns separate packet transport that's used to send RTCP packets. If
- // RTCP multiplexing is being used, returns null.
- virtual PacketTransportInterface* GetRtcpPacketTransport() const = 0;
-
- // Set/get RTP/RTCP transport params. Can be used to enable RTCP muxing or
- // reduced-size RTCP if initially not enabled.
- //
- // Changing |mux| from "true" to "false" is not allowed, and changing the
- // CNAME is currently unsupported.
- // RTP keep-alive settings need to be set before before an RtpSender has
- // started sending, altering the payload type or timeout interval after this
- // point is not supported. The parameters must also match across all RTP
- // transports for a given RTP transport controller.
- virtual RTCError SetParameters(const RtpTransportParameters& parameters) = 0;
- // Returns last set or constructed-with parameters. If |cname| was empty in
- // construction, the generated CNAME will be present in the returned
- // parameters (see above).
- virtual RtpTransportParameters GetParameters() const = 0;
-
- protected:
- // Only for internal use. Returns a pointer to an internal interface, for use
- // by the implementation.
- virtual RtpTransportAdapter* GetInternal() = 0;
-
- // Classes that can use this internal interface.
- friend class OrtcFactory;
- friend class OrtcRtpSenderAdapter;
- friend class OrtcRtpReceiverAdapter;
- friend class RtpTransportControllerAdapter;
- friend class RtpTransportAdapter;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_
diff --git a/api/ortc/sessiondescription.cc b/api/ortc/sessiondescription.cc
deleted file mode 100644
index c1d4bbb..0000000
--- a/api/ortc/sessiondescription.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright 2017 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 "webrtc/api/ortc/sessiondescription.h"
-
-namespace webrtc {}
diff --git a/api/ortc/sessiondescription.h b/api/ortc/sessiondescription.h
deleted file mode 100644
index 52f9b0c..0000000
--- a/api/ortc/sessiondescription.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_SESSIONDESCRIPTION_H_
-#define WEBRTC_API_ORTC_SESSIONDESCRIPTION_H_
-
-#include <string>
-#include <utility>
-
-namespace webrtc {
-
-// A structured representation of an SDP session description.
-class SessionDescription {
- public:
- SessionDescription(int64_t session_id, std::string session_version)
- : session_id_(session_id), session_version_(std::move(session_version)) {}
-
- // https://tools.ietf.org/html/rfc4566#section-5.2
- // o=<username> <sess-id> <sess-version> <nettype> <addrtype>
- // <unicast-address>
- // session_id_ is the "sess-id" field.
- // session_version_ is the "sess-version" field.
- int64_t session_id() { return session_id_; }
- void set_session_id(int64_t session_id) { session_id_ = session_id; }
-
- const std::string& session_version() const { return session_version_; }
- void set_session_version(std::string session_version) {
- session_version_ = std::move(session_version);
- }
-
- private:
- int64_t session_id_;
- std::string session_version_;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_SESSIONDESCRIPTION_H_
diff --git a/api/ortc/sessiondescription_unittest.cc b/api/ortc/sessiondescription_unittest.cc
deleted file mode 100644
index 00d9198..0000000
--- a/api/ortc/sessiondescription_unittest.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2017 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 "webrtc/api/ortc/sessiondescription.h"
-#include "webrtc/test/gtest.h"
-
-namespace webrtc {
-
-class SessionDescriptionTest : public testing::Test {};
-
-TEST_F(SessionDescriptionTest, CreateSessionDescription) {
- SessionDescription s(-1, "0");
- EXPECT_EQ(-1, s.session_id());
- EXPECT_EQ("0", s.session_version());
-}
-}
diff --git a/api/ortc/srtptransportinterface.h b/api/ortc/srtptransportinterface.h
deleted file mode 100644
index f64618c..0000000
--- a/api/ortc/srtptransportinterface.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_SRTPTRANSPORTINTERFACE_H_
-#define WEBRTC_API_ORTC_SRTPTRANSPORTINTERFACE_H_
-
-#include "webrtc/api/ortc/rtptransportinterface.h"
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/media/base/cryptoparams.h"
-
-namespace webrtc {
-
-// The subclass of the RtpTransport which uses SRTP. The keying information
-// is explicitly passed in from the application.
-//
-// If using SDP and SDES (RFC4568) for signaling, then after applying the
-// answer, the negotiated keying information from the offer and answer would be
-// set and the SRTP would be active.
-//
-// Note that Edge's implementation of ORTC provides a similar API point, called
-// RTCSrtpSdesTransport:
-// https://msdn.microsoft.com/en-us/library/mt502527(v=vs.85).aspx
-class SrtpTransportInterface : public RtpTransportInterface {
- public:
- virtual ~SrtpTransportInterface() {}
-
- // There are some limitations of the current implementation:
- // 1. Send and receive keys must use the same crypto suite.
- // 2. The keys can't be changed after initially set.
- // 3. The keys must be set before creating a sender/receiver using the SRTP
- // transport.
- // Set the SRTP keying material for sending RTP and RTCP.
- virtual RTCError SetSrtpSendKey(const cricket::CryptoParams& params) = 0;
-
- // Set the SRTP keying material for receiving RTP and RTCP.
- virtual RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) = 0;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_SRTPTRANSPORTINTERFACE_H_
diff --git a/api/ortc/udptransportinterface.h b/api/ortc/udptransportinterface.h
deleted file mode 100644
index cdcd321..0000000
--- a/api/ortc/udptransportinterface.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_ORTC_UDPTRANSPORTINTERFACE_H_
-#define WEBRTC_API_ORTC_UDPTRANSPORTINTERFACE_H_
-
-#include "webrtc/api/ortc/packettransportinterface.h"
-#include "webrtc/api/proxy.h"
-#include "webrtc/rtc_base/socketaddress.h"
-
-namespace webrtc {
-
-// Interface for a raw UDP transport (not using ICE), meaning a combination of
-// a local/remote IP address/port.
-//
-// An instance can be instantiated using OrtcFactory.
-//
-// Each instance reserves a UDP port, which will be freed when the
-// UdpTransportInterface destructor is called.
-//
-// Calling SetRemoteAddress sets the destination of outgoing packets; without a
-// destination, packets can't be sent, but they can be received.
-class UdpTransportInterface : public virtual PacketTransportInterface {
- public:
- // Get the address of the socket allocated for this transport.
- virtual rtc::SocketAddress GetLocalAddress() const = 0;
-
- // Sets the address to which packets will be delivered.
- //
- // Calling with a "nil" (default-constructed) address is legal, and unsets
- // any previously set destination.
- //
- // However, calling with an incomplete address (port or IP not set) will
- // fail.
- virtual bool SetRemoteAddress(const rtc::SocketAddress& dest) = 0;
- // Simple getter. If never set, returns nil address.
- virtual rtc::SocketAddress GetRemoteAddress() const = 0;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_ORTC_UDPTRANSPORTINTERFACE_H_
diff --git a/api/peerconnectionfactoryproxy.h b/api/peerconnectionfactoryproxy.h
deleted file mode 100644
index 52f5109..0000000
--- a/api/peerconnectionfactoryproxy.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2014 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 WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
-#define WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
-
-#include <memory>
-#include <string>
-#include <utility>
-
-#include "webrtc/api/peerconnectioninterface.h"
-#include "webrtc/api/proxy.h"
-#include "webrtc/rtc_base/bind.h"
-
-namespace webrtc {
-
-// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
-// are called on is an implementation detail.
-BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
- PROXY_SIGNALING_THREAD_DESTRUCTOR()
- // Use the overloads of CreateVideoSource that take raw VideoCapturer
- // pointers from PeerConnectionFactoryInterface.
- // TODO(deadbeef): Remove this using statement once those overloads are
- // removed.
- using PeerConnectionFactoryInterface::CreateVideoSource;
- PROXY_METHOD1(void, SetOptions, const Options&)
- PROXY_METHOD5(rtc::scoped_refptr<PeerConnectionInterface>,
- CreatePeerConnection,
- const PeerConnectionInterface::RTCConfiguration&,
- const MediaConstraintsInterface*,
- std::unique_ptr<cricket::PortAllocator>,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
- PeerConnectionObserver*);
- PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
- CreatePeerConnection,
- const PeerConnectionInterface::RTCConfiguration&,
- std::unique_ptr<cricket::PortAllocator>,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
- PeerConnectionObserver*);
- PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>,
- CreateLocalMediaStream, const std::string&)
- PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
- CreateAudioSource, const MediaConstraintsInterface*)
- PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
- CreateAudioSource,
- const cricket::AudioOptions&)
- PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>,
- CreateVideoSource,
- std::unique_ptr<cricket::VideoCapturer>,
- const MediaConstraintsInterface*)
- PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>,
- CreateVideoSource,
- std::unique_ptr<cricket::VideoCapturer>)
- PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>,
- CreateVideoTrack,
- const std::string&,
- VideoTrackSourceInterface*)
- PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
- CreateAudioTrack, const std::string&, AudioSourceInterface*)
- PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
- PROXY_METHOD0(void, StopAecDump)
- // TODO(ivoc): Remove the StartRtcEventLog and StopRtcEventLog functions as
- // soon as they are removed from PeerConnectionFactoryInterface.
- PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile)
- PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
- PROXY_METHOD0(void, StopRtcEventLog)
-END_PROXY_MAP()
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
deleted file mode 100644
index e23b705..0000000
--- a/api/peerconnectioninterface.h
+++ /dev/null
@@ -1,1227 +0,0 @@
-/*
- * Copyright 2012 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.
- */
-
-// This file contains the PeerConnection interface as defined in
-// http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-connections.
-//
-// The PeerConnectionFactory class provides factory methods to create
-// PeerConnection, MediaStream and MediaStreamTrack objects.
-//
-// The following steps are needed to setup a typical call using WebRTC:
-//
-// 1. Create a PeerConnectionFactoryInterface. Check constructors for more
-// information about input parameters.
-//
-// 2. Create a PeerConnection object. Provide a configuration struct which
-// points to STUN and/or TURN servers used to generate ICE candidates, and
-// provide an object that implements the PeerConnectionObserver interface,
-// which is used to receive callbacks from the PeerConnection.
-//
-// 3. Create local MediaStreamTracks using the PeerConnectionFactory and add
-// them to PeerConnection by calling AddTrack (or legacy method, AddStream).
-//
-// 4. Create an offer, call SetLocalDescription with it, serialize it, and send
-// it to the remote peer
-//
-// 5. Once an ICE candidate has been gathered, the PeerConnection will call the
-// observer function OnIceCandidate. The candidates must also be serialized and
-// sent to the remote peer.
-//
-// 6. Once an answer is received from the remote peer, call
-// SetRemoteDescription with the remote answer.
-//
-// 7. Once a remote candidate is received from the remote peer, provide it to
-// the PeerConnection by calling AddIceCandidate.
-//
-// The receiver of a call (assuming the application is "call"-based) can decide
-// to accept or reject the call; this decision will be taken by the application,
-// not the PeerConnection.
-//
-// If the application decides to accept the call, it should:
-//
-// 1. Create PeerConnectionFactoryInterface if it doesn't exist.
-//
-// 2. Create a new PeerConnection.
-//
-// 3. Provide the remote offer to the new PeerConnection object by calling
-// SetRemoteDescription.
-//
-// 4. Generate an answer to the remote offer by calling CreateAnswer and send it
-// back to the remote peer.
-//
-// 5. Provide the local answer to the new PeerConnection by calling
-// SetLocalDescription with the answer.
-//
-// 6. Provide the remote ICE candidates by calling AddIceCandidate.
-//
-// 7. Once a candidate has been gathered, the PeerConnection will call the
-// observer function OnIceCandidate. Send these candidates to the remote peer.
-
-#ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_
-#define WEBRTC_API_PEERCONNECTIONINTERFACE_H_
-
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "webrtc/api/audio_codecs/audio_decoder_factory.h"
-#include "webrtc/api/audio_codecs/audio_encoder_factory.h"
-#include "webrtc/api/datachannelinterface.h"
-#include "webrtc/api/dtmfsenderinterface.h"
-#include "webrtc/api/jsep.h"
-#include "webrtc/api/mediastreaminterface.h"
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/api/rtpreceiverinterface.h"
-#include "webrtc/api/rtpsenderinterface.h"
-#include "webrtc/api/stats/rtcstatscollectorcallback.h"
-#include "webrtc/api/statstypes.h"
-#include "webrtc/api/umametrics.h"
-#include "webrtc/call/callfactoryinterface.h"
-#include "webrtc/logging/rtc_event_log/rtc_event_log_factory_interface.h"
-#include "webrtc/media/base/mediachannel.h"
-#include "webrtc/media/base/videocapturer.h"
-#include "webrtc/p2p/base/portallocator.h"
-#include "webrtc/rtc_base/fileutils.h"
-#include "webrtc/rtc_base/network.h"
-#include "webrtc/rtc_base/rtccertificate.h"
-#include "webrtc/rtc_base/rtccertificategenerator.h"
-#include "webrtc/rtc_base/socketaddress.h"
-#include "webrtc/rtc_base/sslstreamadapter.h"
-
-namespace rtc {
-class SSLIdentity;
-class Thread;
-}
-
-namespace cricket {
-class MediaEngineInterface;
-class WebRtcVideoDecoderFactory;
-class WebRtcVideoEncoderFactory;
-}
-
-namespace webrtc {
-class AudioDeviceModule;
-class AudioMixer;
-class CallFactoryInterface;
-class MediaConstraintsInterface;
-
-// MediaStream container interface.
-class StreamCollectionInterface : public rtc::RefCountInterface {
- public:
- // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find.
- virtual size_t count() = 0;
- virtual MediaStreamInterface* at(size_t index) = 0;
- virtual MediaStreamInterface* find(const std::string& label) = 0;
- virtual MediaStreamTrackInterface* FindAudioTrack(
- const std::string& id) = 0;
- virtual MediaStreamTrackInterface* FindVideoTrack(
- const std::string& id) = 0;
-
- protected:
- // Dtor protected as objects shouldn't be deleted via this interface.
- ~StreamCollectionInterface() {}
-};
-
-class StatsObserver : public rtc::RefCountInterface {
- public:
- virtual void OnComplete(const StatsReports& reports) = 0;
-
- protected:
- virtual ~StatsObserver() {}
-};
-
-class PeerConnectionInterface : public rtc::RefCountInterface {
- public:
- // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions .
- enum SignalingState {
- kStable,
- kHaveLocalOffer,
- kHaveLocalPrAnswer,
- kHaveRemoteOffer,
- kHaveRemotePrAnswer,
- kClosed,
- };
-
- enum IceGatheringState {
- kIceGatheringNew,
- kIceGatheringGathering,
- kIceGatheringComplete
- };
-
- enum IceConnectionState {
- kIceConnectionNew,
- kIceConnectionChecking,
- kIceConnectionConnected,
- kIceConnectionCompleted,
- kIceConnectionFailed,
- kIceConnectionDisconnected,
- kIceConnectionClosed,
- kIceConnectionMax,
- };
-
- // TLS certificate policy.
- enum TlsCertPolicy {
- // For TLS based protocols, ensure the connection is secure by not
- // circumventing certificate validation.
- kTlsCertPolicySecure,
- // For TLS based protocols, disregard security completely by skipping
- // certificate validation. This is insecure and should never be used unless
- // security is irrelevant in that particular context.
- kTlsCertPolicyInsecureNoCheck,
- };
-
- struct IceServer {
- // TODO(jbauch): Remove uri when all code using it has switched to urls.
- // List of URIs associated with this server. Valid formats are described
- // in RFC7064 and RFC7065, and more may be added in the future. The "host"
- // part of the URI may contain either an IP address or a hostname.
- std::string uri;
- std::vector<std::string> urls;
- std::string username;
- std::string password;
- TlsCertPolicy tls_cert_policy = kTlsCertPolicySecure;
- // If the URIs in |urls| only contain IP addresses, this field can be used
- // to indicate the hostname, which may be necessary for TLS (using the SNI
- // extension). If |urls| itself contains the hostname, this isn't
- // necessary.
- std::string hostname;
- // List of protocols to be used in the TLS ALPN extension.
- std::vector<std::string> tls_alpn_protocols;
- // List of elliptic curves to be used in the TLS elliptic curves extension.
- std::vector<std::string> tls_elliptic_curves;
-
- bool operator==(const IceServer& o) const {
- return uri == o.uri && urls == o.urls && username == o.username &&
- password == o.password && tls_cert_policy == o.tls_cert_policy &&
- hostname == o.hostname &&
- tls_alpn_protocols == o.tls_alpn_protocols &&
- tls_elliptic_curves == o.tls_elliptic_curves;
- }
- bool operator!=(const IceServer& o) const { return !(*this == o); }
- };
- typedef std::vector<IceServer> IceServers;
-
- enum IceTransportsType {
- // TODO(pthatcher): Rename these kTransporTypeXXX, but update
- // Chromium at the same time.
- kNone,
- kRelay,
- kNoHost,
- kAll
- };
-
- // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1
- enum BundlePolicy {
- kBundlePolicyBalanced,
- kBundlePolicyMaxBundle,
- kBundlePolicyMaxCompat
- };
-
- // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1
- enum RtcpMuxPolicy {
- kRtcpMuxPolicyNegotiate,
- kRtcpMuxPolicyRequire,
- };
-
- enum TcpCandidatePolicy {
- kTcpCandidatePolicyEnabled,
- kTcpCandidatePolicyDisabled
- };
-
- enum CandidateNetworkPolicy {
- kCandidateNetworkPolicyAll,
- kCandidateNetworkPolicyLowCost
- };
-
- enum ContinualGatheringPolicy {
- GATHER_ONCE,
- GATHER_CONTINUALLY
- };
-
- enum class RTCConfigurationType {
- // A configuration that is safer to use, despite not having the best
- // performance. Currently this is the default configuration.
- kSafe,
- // An aggressive configuration that has better performance, although it
- // may be riskier and may need extra support in the application.
- kAggressive
- };
-
- // TODO(hbos): Change into class with private data and public getters.
- // TODO(nisse): In particular, accessing fields directly from an
- // application is brittle, since the organization mirrors the
- // organization of the implementation, which isn't stable. So we
- // need getters and setters at least for fields which applications
- // are interested in.
- struct RTCConfiguration {
- // This struct is subject to reorganization, both for naming
- // consistency, and to group settings to match where they are used
- // in the implementation. To do that, we need getter and setter
- // methods for all settings which are of interest to applications,
- // Chrome in particular.
-
- RTCConfiguration() = default;
- explicit RTCConfiguration(RTCConfigurationType type) {
- if (type == RTCConfigurationType::kAggressive) {
- // These parameters are also defined in Java and IOS configurations,
- // so their values may be overwritten by the Java or IOS configuration.
- bundle_policy = kBundlePolicyMaxBundle;
- rtcp_mux_policy = kRtcpMuxPolicyRequire;
- ice_connection_receiving_timeout =
- kAggressiveIceConnectionReceivingTimeout;
-
- // These parameters are not defined in Java or IOS configuration,
- // so their values will not be overwritten.
- enable_ice_renomination = true;
- redetermine_role_on_ice_restart = false;
- }
- }
-
- bool operator==(const RTCConfiguration& o) const;
- bool operator!=(const RTCConfiguration& o) const;
-
- bool dscp() { return media_config.enable_dscp; }
- void set_dscp(bool enable) { media_config.enable_dscp = enable; }
-
- // TODO(nisse): The corresponding flag in MediaConfig and
- // elsewhere should be renamed enable_cpu_adaptation.
- bool cpu_adaptation() {
- return media_config.video.enable_cpu_overuse_detection;
- }
- void set_cpu_adaptation(bool enable) {
- media_config.video.enable_cpu_overuse_detection = enable;
- }
-
- bool suspend_below_min_bitrate() {
- return media_config.video.suspend_below_min_bitrate;
- }
- void set_suspend_below_min_bitrate(bool enable) {
- media_config.video.suspend_below_min_bitrate = enable;
- }
-
- // TODO(nisse): The negation in the corresponding MediaConfig
- // attribute is inconsistent, and it should be renamed at some
- // point.
- bool prerenderer_smoothing() {
- return !media_config.video.disable_prerenderer_smoothing;
- }
- void set_prerenderer_smoothing(bool enable) {
- media_config.video.disable_prerenderer_smoothing = !enable;
- }
-
- static const int kUndefined = -1;
- // Default maximum number of packets in the audio jitter buffer.
- static const int kAudioJitterBufferMaxPackets = 50;
- // ICE connection receiving timeout for aggressive configuration.
- static const int kAggressiveIceConnectionReceivingTimeout = 1000;
-
- ////////////////////////////////////////////////////////////////////////
- // The below few fields mirror the standard RTCConfiguration dictionary:
- // https://www.w3.org/TR/webrtc/#rtcconfiguration-dictionary
- ////////////////////////////////////////////////////////////////////////
-
- // TODO(pthatcher): Rename this ice_servers, but update Chromium
- // at the same time.
- IceServers servers;
- // TODO(pthatcher): Rename this ice_transport_type, but update
- // Chromium at the same time.
- IceTransportsType type = kAll;
- BundlePolicy bundle_policy = kBundlePolicyBalanced;
- RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire;
- std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
- int ice_candidate_pool_size = 0;
-
- //////////////////////////////////////////////////////////////////////////
- // The below fields correspond to constraints from the deprecated
- // constraints interface for constructing a PeerConnection.
- //
- // rtc::Optional fields can be "missing", in which case the implementation
- // default will be used.
- //////////////////////////////////////////////////////////////////////////
-
- // If set to true, don't gather IPv6 ICE candidates.
- // TODO(deadbeef): Remove this? IPv6 support has long stopped being
- // experimental
- bool disable_ipv6 = false;
-
- // If set to true, don't gather IPv6 ICE candidates on Wi-Fi.
- // Only intended to be used on specific devices. Certain phones disable IPv6
- // when the screen is turned off and it would be better to just disable the
- // IPv6 ICE candidates on Wi-Fi in those cases.
- bool disable_ipv6_on_wifi = false;
-
- // By default, the PeerConnection will use a limited number of IPv6 network
- // interfaces, in order to avoid too many ICE candidate pairs being created
- // and delaying ICE completion.
- //
- // Can be set to INT_MAX to effectively disable the limit.
- int max_ipv6_networks = cricket::kDefaultMaxIPv6Networks;
-
- // If set to true, use RTP data channels instead of SCTP.
- // TODO(deadbeef): Remove this. We no longer commit to supporting RTP data
- // channels, though some applications are still working on moving off of
- // them.
- bool enable_rtp_data_channel = false;
-
- // Minimum bitrate at which screencast video tracks will be encoded at.
- // This means adding padding bits up to this bitrate, which can help
- // when switching from a static scene to one with motion.
- rtc::Optional<int> screencast_min_bitrate;
-
- // Use new combined audio/video bandwidth estimation?
- rtc::Optional<bool> combined_audio_video_bwe;
-
- // Can be used to disable DTLS-SRTP. This should never be done, but can be
- // useful for testing purposes, for example in setting up a loopback call
- // with a single PeerConnection.
- rtc::Optional<bool> enable_dtls_srtp;
-
- /////////////////////////////////////////////////
- // The below fields are not part of the standard.
- /////////////////////////////////////////////////
-
- // Can be used to disable TCP candidate generation.
- TcpCandidatePolicy tcp_candidate_policy = kTcpCandidatePolicyEnabled;
-
- // Can be used to avoid gathering candidates for a "higher cost" network,
- // if a lower cost one exists. For example, if both Wi-Fi and cellular
- // interfaces are available, this could be used to avoid using the cellular
- // interface.
- CandidateNetworkPolicy candidate_network_policy =
- kCandidateNetworkPolicyAll;
-
- // The maximum number of packets that can be stored in the NetEq audio
- // jitter buffer. Can be reduced to lower tolerated audio latency.
- int audio_jitter_buffer_max_packets = kAudioJitterBufferMaxPackets;
-
- // Whether to use the NetEq "fast mode" which will accelerate audio quicker
- // if it falls behind.
- bool audio_jitter_buffer_fast_accelerate = false;
-
- // Timeout in milliseconds before an ICE candidate pair is considered to be
- // "not receiving", after which a lower priority candidate pair may be
- // selected.
- int ice_connection_receiving_timeout = kUndefined;
-
- // Interval in milliseconds at which an ICE "backup" candidate pair will be
- // pinged. This is a candidate pair which is not actively in use, but may
- // be switched to if the active candidate pair becomes unusable.
- //
- // This is relevant mainly to Wi-Fi/cell handoff; the application may not
- // want this backup cellular candidate pair pinged frequently, since it
- // consumes data/battery.
- int ice_backup_candidate_pair_ping_interval = kUndefined;
-
- // Can be used to enable continual gathering, which means new candidates
- // will be gathered as network interfaces change. Note that if continual
- // gathering is used, the candidate removal API should also be used, to
- // avoid an ever-growing list of candidates.
- ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE;
-
- // If set to true, candidate pairs will be pinged in order of most likely
- // to work (which means using a TURN server, generally), rather than in
- // standard priority order.
- bool prioritize_most_likely_ice_candidate_pairs = false;
-
- struct cricket::MediaConfig media_config;
-
- // This doesn't currently work. For a while we were working on adding QUIC
- // data channel support to PeerConnection, but decided on a different
- // approach, and that code hasn't been updated for a while.
- bool enable_quic = false;
-
- // If set to true, only one preferred TURN allocation will be used per
- // network interface. UDP is preferred over TCP and IPv6 over IPv4. This
- // can be used to cut down on the number of candidate pairings.
- bool prune_turn_ports = false;
-
- // If set to true, this means the ICE transport should presume TURN-to-TURN
- // candidate pairs will succeed, even before a binding response is received.
- // This can be used to optimize the initial connection time, since the DTLS
- // handshake can begin immediately.
- bool presume_writable_when_fully_relayed = false;
-
- // If true, "renomination" will be added to the ice options in the transport
- // description.
- // See: https://tools.ietf.org/html/draft-thatcher-ice-renomination-00
- bool enable_ice_renomination = false;
-
- // If true, the ICE role is re-determined when the PeerConnection sets a
- // local transport description that indicates an ICE restart.
- //
- // This is standard RFC5245 ICE behavior, but causes unnecessary role
- // thrashing, so an application may wish to avoid it. This role
- // re-determining was removed in ICEbis (ICE v2).
- bool redetermine_role_on_ice_restart = true;
-
- // If set, the min interval (max rate) at which we will send ICE checks
- // (STUN pings), in milliseconds.
- rtc::Optional<int> ice_check_min_interval;
-
-
- // ICE Periodic Regathering
- // If set, WebRTC will periodically create and propose candidates without
- // starting a new ICE generation. The regathering happens continuously with
- // interval specified in milliseconds by the uniform distribution [a, b].
- rtc::Optional<rtc::IntervalRange> ice_regather_interval_range;
-
- //
- // Don't forget to update operator== if adding something.
- //
- };
-
- // See: https://www.w3.org/TR/webrtc/#idl-def-rtcofferansweroptions
- struct RTCOfferAnswerOptions {
- static const int kUndefined = -1;
- static const int kMaxOfferToReceiveMedia = 1;
-
- // The default value for constraint offerToReceiveX:true.
- static const int kOfferToReceiveMediaTrue = 1;
-
- // These have been removed from the standard in favor of the "transceiver"
- // API, but given that we don't support that API, we still have them here.
- //
- // offer_to_receive_X set to 1 will cause a media description to be
- // generated in the offer, even if no tracks of that type have been added.
- // Values greater than 1 are treated the same.
- //
- // If set to 0, the generated directional attribute will not include the
- // "recv" direction (meaning it will be "sendonly" or "inactive".
- int offer_to_receive_video = kUndefined;
- int offer_to_receive_audio = kUndefined;
-
- bool voice_activity_detection = true;
- bool ice_restart = false;
-
- // If true, will offer to BUNDLE audio/video/data together. Not to be
- // confused with RTCP mux (multiplexing RTP and RTCP together).
- bool use_rtp_mux = true;
-
- RTCOfferAnswerOptions() = default;
-
- RTCOfferAnswerOptions(int offer_to_receive_video,
- int offer_to_receive_audio,
- bool voice_activity_detection,
- bool ice_restart,
- bool use_rtp_mux)
- : offer_to_receive_video(offer_to_receive_video),
- offer_to_receive_audio(offer_to_receive_audio),
- voice_activity_detection(voice_activity_detection),
- ice_restart(ice_restart),
- use_rtp_mux(use_rtp_mux) {}
- };
-
- // Used by GetStats to decide which stats to include in the stats reports.
- // |kStatsOutputLevelStandard| includes the standard stats for Javascript API;
- // |kStatsOutputLevelDebug| includes both the standard stats and additional
- // stats for debugging purposes.
- enum StatsOutputLevel {
- kStatsOutputLevelStandard,
- kStatsOutputLevelDebug,
- };
-
- // Accessor methods to active local streams.
- virtual rtc::scoped_refptr<StreamCollectionInterface>
- local_streams() = 0;
-
- // Accessor methods to remote streams.
- virtual rtc::scoped_refptr<StreamCollectionInterface>
- remote_streams() = 0;
-
- // Add a new MediaStream to be sent on this PeerConnection.
- // Note that a SessionDescription negotiation is needed before the
- // remote peer can receive the stream.
- //
- // This has been removed from the standard in favor of a track-based API. So,
- // this is equivalent to simply calling AddTrack for each track within the
- // stream, with the one difference that if "stream->AddTrack(...)" is called
- // later, the PeerConnection will automatically pick up the new track. Though
- // this functionality will be deprecated in the future.
- virtual bool AddStream(MediaStreamInterface* stream) = 0;
-
- // Remove a MediaStream from this PeerConnection.
- // Note that a SessionDescription negotiation is needed before the
- // remote peer is notified.
- virtual void RemoveStream(MediaStreamInterface* stream) = 0;
-
- // Add a new MediaStreamTrack to be sent on this PeerConnection, and return
- // the newly created RtpSender.
- //
- // |streams| indicates which stream labels the track should be associated
- // with.
- virtual rtc::scoped_refptr<RtpSenderInterface> AddTrack(
- MediaStreamTrackInterface* track,
- std::vector<MediaStreamInterface*> streams) = 0;
-
- // Remove an RtpSender from this PeerConnection.
- // Returns true on success.
- virtual bool RemoveTrack(RtpSenderInterface* sender) = 0;
-
- // Returns pointer to a DtmfSender on success. Otherwise returns null.
- //
- // This API is no longer part of the standard; instead DtmfSenders are
- // obtained from RtpSenders. Which is what the implementation does; it finds
- // an RtpSender for |track| and just returns its DtmfSender.
- virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
- AudioTrackInterface* track) = 0;
-
- // TODO(deadbeef): Make these pure virtual once all subclasses implement them.
-
- // Creates a sender without a track. Can be used for "early media"/"warmup"
- // use cases, where the application may want to negotiate video attributes
- // before a track is available to send.
- //
- // The standard way to do this would be through "addTransceiver", but we
- // don't support that API yet.
- //
- // |kind| must be "audio" or "video".
- //
- // |stream_id| is used to populate the msid attribute; if empty, one will
- // be generated automatically.
- virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender(
- const std::string& kind,
- const std::string& stream_id) {
- return rtc::scoped_refptr<RtpSenderInterface>();
- }
-
- // Get all RtpSenders, created either through AddStream, AddTrack, or
- // CreateSender. Note that these are "Plan B SDP" RtpSenders, not "Unified
- // Plan SDP" RtpSenders, which means that all senders of a specific media
- // type share the same media description.
- virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
- const {
- return std::vector<rtc::scoped_refptr<RtpSenderInterface>>();
- }
-
- // Get all RtpReceivers, created when a remote description is applied.
- // Note that these are "Plan B SDP" RtpReceivers, not "Unified Plan SDP"
- // RtpReceivers, which means that all receivers of a specific media type
- // share the same media description.
- //
- // It is also possible to have a media description with no associated
- // RtpReceivers, if the directional attribute does not indicate that the
- // remote peer is sending any media.
- virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
- const {
- return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>();
- }
-
- virtual bool GetStats(StatsObserver* observer,
- MediaStreamTrackInterface* track,
- StatsOutputLevel level) = 0;
- // Gets stats using the new stats collection API, see webrtc/api/stats/. These
- // will replace old stats collection API when the new API has matured enough.
- // TODO(hbos): Default implementation that does nothing only exists as to not
- // break third party projects. As soon as they have been updated this should
- // be changed to "= 0;".
- virtual void GetStats(RTCStatsCollectorCallback* callback) {}
-
- // Create a data channel with the provided config, or default config if none
- // is provided. Note that an offer/answer negotiation is still necessary
- // before the data channel can be used.
- //
- // Also, calling CreateDataChannel is the only way to get a data "m=" section
- // in SDP, so it should be done before CreateOffer is called, if the
- // application plans to use data channels.
- virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
- const std::string& label,
- const DataChannelInit* config) = 0;
-
- // Returns the more recently applied description; "pending" if it exists, and
- // otherwise "current". See below.
- virtual const SessionDescriptionInterface* local_description() const = 0;
- virtual const SessionDescriptionInterface* remote_description() const = 0;
-
- // A "current" description the one currently negotiated from a complete
- // offer/answer exchange.
- virtual const SessionDescriptionInterface* current_local_description() const {
- return nullptr;
- }
- virtual const SessionDescriptionInterface* current_remote_description()
- const {
- return nullptr;
- }
-
- // A "pending" description is one that's part of an incomplete offer/answer
- // exchange (thus, either an offer or a pranswer). Once the offer/answer
- // exchange is finished, the "pending" description will become "current".
- virtual const SessionDescriptionInterface* pending_local_description() const {
- return nullptr;
- }
- virtual const SessionDescriptionInterface* pending_remote_description()
- const {
- return nullptr;
- }
-
- // Create a new offer.
- // The CreateSessionDescriptionObserver callback will be called when done.
- virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints) {}
-
- // TODO(jiayl): remove the default impl and the old interface when chromium
- // code is updated.
- virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
- const RTCOfferAnswerOptions& options) {}
-
- // Create an answer to an offer.
- // The CreateSessionDescriptionObserver callback will be called when done.
- virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
- const RTCOfferAnswerOptions& options) {}
- // Deprecated - use version above.
- // TODO(hta): Remove and remove default implementations when all callers
- // are updated.
- virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints) {}
-
- // Sets the local session description.
- // The PeerConnection takes the ownership of |desc| even if it fails.
- // The |observer| callback will be called when done.
- // TODO(deadbeef): Change |desc| to be a unique_ptr, to make it clear
- // that this method always takes ownership of it.
- virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
- SessionDescriptionInterface* desc) = 0;
- // Sets the remote session description.
- // The PeerConnection takes the ownership of |desc| even if it fails.
- // The |observer| callback will be called when done.
- virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
- SessionDescriptionInterface* desc) = 0;
- // Deprecated; Replaced by SetConfiguration.
- // TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration.
- virtual bool UpdateIce(const IceServers& configuration,
- const MediaConstraintsInterface* constraints) {
- return false;
- }
- virtual bool UpdateIce(const IceServers& configuration) { return false; }
-
- // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of
- // PeerConnectionInterface implement it.
- virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() {
- return PeerConnectionInterface::RTCConfiguration();
- }
-
- // Sets the PeerConnection's global configuration to |config|.
- //
- // The members of |config| that may be changed are |type|, |servers|,
- // |ice_candidate_pool_size| and |prune_turn_ports| (though the candidate
- // pool size can't be changed after the first call to SetLocalDescription).
- // Note that this means the BUNDLE and RTCP-multiplexing policies cannot be
- // changed with this method.
- //
- // Any changes to STUN/TURN servers or ICE candidate policy will affect the
- // next gathering phase, and cause the next call to createOffer to generate
- // new ICE credentials, as described in JSEP. This also occurs when
- // |prune_turn_ports| changes, for the same reasoning.
- //
- // If an error occurs, returns false and populates |error| if non-null:
- // - INVALID_MODIFICATION if |config| contains a modified parameter other
- // than one of the parameters listed above.
- // - INVALID_RANGE if |ice_candidate_pool_size| is out of range.
- // - SYNTAX_ERROR if parsing an ICE server URL failed.
- // - INVALID_PARAMETER if a TURN server is missing |username| or |password|.
- // - INTERNAL_ERROR if an unexpected error occurred.
- //
- // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of
- // PeerConnectionInterface implement it.
- virtual bool SetConfiguration(
- const PeerConnectionInterface::RTCConfiguration& config,
- RTCError* error) {
- return false;
- }
- // Version without error output param for backwards compatibility.
- // TODO(deadbeef): Remove once chromium is updated.
- virtual bool SetConfiguration(
- const PeerConnectionInterface::RTCConfiguration& config) {
- return false;
- }
-
- // Provides a remote candidate to the ICE Agent.
- // A copy of the |candidate| will be created and added to the remote
- // description. So the caller of this method still has the ownership of the
- // |candidate|.
- virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0;
-
- // Removes a group of remote candidates from the ICE agent. Needed mainly for
- // continual gathering, to avoid an ever-growing list of candidates as
- // networks come and go.
- virtual bool RemoveIceCandidates(
- const std::vector<cricket::Candidate>& candidates) {
- return false;
- }
-
- // Register a metric observer (used by chromium).
- //
- // There can only be one observer at a time. Before the observer is
- // destroyed, RegisterUMAOberver(nullptr) should be called.
- virtual void RegisterUMAObserver(UMAObserver* observer) = 0;
-
- // 0 <= min <= current <= max should hold for set parameters.
- struct BitrateParameters {
- rtc::Optional<int> min_bitrate_bps;
- rtc::Optional<int> current_bitrate_bps;
- rtc::Optional<int> max_bitrate_bps;
- };
-
- // SetBitrate limits the bandwidth allocated for all RTP streams sent by
- // this PeerConnection. Other limitations might affect these limits and
- // are respected (for example "b=AS" in SDP).
- //
- // Setting |current_bitrate_bps| will reset the current bitrate estimate
- // to the provided value.
- virtual RTCError SetBitrate(const BitrateParameters& bitrate) = 0;
-
- // Returns the current SignalingState.
- virtual SignalingState signaling_state() = 0;
- virtual IceConnectionState ice_connection_state() = 0;
- virtual IceGatheringState ice_gathering_state() = 0;
-
- // Starts RtcEventLog using existing file. Takes ownership of |file| and
- // passes it on to Call, which will take the ownership. If the
- // operation fails the file will be closed. The logging will stop
- // automatically after 10 minutes have passed, or when the StopRtcEventLog
- // function is called.
- // TODO(ivoc): Make this pure virtual when Chrome is updated.
- virtual bool StartRtcEventLog(rtc::PlatformFile file,
- int64_t max_size_bytes) {
- return false;
- }
-
- // Stops logging the RtcEventLog.
- // TODO(ivoc): Make this pure virtual when Chrome is updated.
- virtual void StopRtcEventLog() {}
-
- // Terminates all media, closes the transports, and in general releases any
- // resources used by the PeerConnection. This is an irreversible operation.
- //
- // Note that after this method completes, the PeerConnection will no longer
- // use the PeerConnectionObserver interface passed in on construction, and
- // thus the observer object can be safely destroyed.
- virtual void Close() = 0;
-
- protected:
- // Dtor protected as objects shouldn't be deleted via this interface.
- ~PeerConnectionInterface() {}
-};
-
-// PeerConnection callback interface, used for RTCPeerConnection events.
-// Application should implement these methods.
-class PeerConnectionObserver {
- public:
- enum StateType {
- kSignalingState,
- kIceState,
- };
-
- // Triggered when the SignalingState changed.
- virtual void OnSignalingChange(
- PeerConnectionInterface::SignalingState new_state) = 0;
-
- // TODO(deadbeef): Once all subclasses override the scoped_refptr versions
- // of the below three methods, make them pure virtual and remove the raw
- // pointer version.
-
- // Triggered when media is received on a new stream from remote peer.
- virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) = 0;
-
- // Triggered when a remote peer close a stream.
- virtual void OnRemoveStream(
- rtc::scoped_refptr<MediaStreamInterface> stream) = 0;
-
- // Triggered when a remote peer opens a data channel.
- virtual void OnDataChannel(
- rtc::scoped_refptr<DataChannelInterface> data_channel) = 0;
-
- // Triggered when renegotiation is needed. For example, an ICE restart
- // has begun.
- virtual void OnRenegotiationNeeded() = 0;
-
- // Called any time the IceConnectionState changes.
- //
- // Note that our ICE states lag behind the standard slightly. The most
- // notable differences include the fact that "failed" occurs after 15
- // seconds, not 30, and this actually represents a combination ICE + DTLS
- // state, so it may be "failed" if DTLS fails while ICE succeeds.
- virtual void OnIceConnectionChange(
- PeerConnectionInterface::IceConnectionState new_state) = 0;
-
- // Called any time the IceGatheringState changes.
- virtual void OnIceGatheringChange(
- PeerConnectionInterface::IceGatheringState new_state) = 0;
-
- // A new ICE candidate has been gathered.
- virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0;
-
- // Ice candidates have been removed.
- // TODO(honghaiz): Make this a pure virtual method when all its subclasses
- // implement it.
- virtual void OnIceCandidatesRemoved(
- const std::vector<cricket::Candidate>& candidates) {}
-
- // Called when the ICE connection receiving status changes.
- virtual void OnIceConnectionReceivingChange(bool receiving) {}
-
- // Called when a track is added to streams.
- // TODO(zhihuang) Make this a pure virtual method when all its subclasses
- // implement it.
- virtual void OnAddTrack(
- rtc::scoped_refptr<RtpReceiverInterface> receiver,
- const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {}
-
- protected:
- // Dtor protected as objects shouldn't be deleted via this interface.
- ~PeerConnectionObserver() {}
-};
-
-// PeerConnectionFactoryInterface is the factory interface used for creating
-// PeerConnection, MediaStream and MediaStreamTrack objects.
-//
-// The simplest method for obtaiing one, CreatePeerConnectionFactory will
-// create the required libjingle threads, socket and network manager factory
-// classes for networking if none are provided, though it requires that the
-// application runs a message loop on the thread that called the method (see
-// explanation below)
-//
-// If an application decides to provide its own threads and/or implementation
-// of networking classes, it should use the alternate
-// CreatePeerConnectionFactory method which accepts threads as input, and use
-// the CreatePeerConnection version that takes a PortAllocator as an argument.
-class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
- public:
- class Options {
- public:
- Options() : crypto_options(rtc::CryptoOptions::NoGcm()) {}
-
- // If set to true, created PeerConnections won't enforce any SRTP
- // requirement, allowing unsecured media. Should only be used for
- // testing/debugging.
- bool disable_encryption = false;
-
- // Deprecated. The only effect of setting this to true is that
- // CreateDataChannel will fail, which is not that useful.
- bool disable_sctp_data_channels = false;
-
- // If set to true, any platform-supported network monitoring capability
- // won't be used, and instead networks will only be updated via polling.
- //
- // This only has an effect if a PeerConnection is created with the default
- // PortAllocator implementation.
- bool disable_network_monitor = false;
-
- // Sets the network types to ignore. For instance, calling this with
- // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and
- // loopback interfaces.
- int network_ignore_mask = rtc::kDefaultNetworkIgnoreMask;
-
- // Sets the maximum supported protocol version. The highest version
- // supported by both ends will be used for the connection, i.e. if one
- // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used.
- rtc::SSLProtocolVersion ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
-
- // Sets crypto related options, e.g. enabled cipher suites.
- rtc::CryptoOptions crypto_options;
- };
-
- // Set the options to be used for subsequently created PeerConnections.
- virtual void SetOptions(const Options& options) = 0;
-
- // |allocator| and |cert_generator| may be null, in which case default
- // implementations will be used.
- //
- // |observer| must not be null.
- //
- // Note that this method does not take ownership of |observer|; it's the
- // responsibility of the caller to delete it. It can be safely deleted after
- // Close has been called on the returned PeerConnection, which ensures no
- // more observer callbacks will be invoked.
- virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
- const PeerConnectionInterface::RTCConfiguration& configuration,
- std::unique_ptr<cricket::PortAllocator> allocator,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
- PeerConnectionObserver* observer) = 0;
-
- // Deprecated; should use RTCConfiguration for everything that previously
- // used constraints.
- virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
- const PeerConnectionInterface::RTCConfiguration& configuration,
- const MediaConstraintsInterface* constraints,
- std::unique_ptr<cricket::PortAllocator> allocator,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
- PeerConnectionObserver* observer) = 0;
-
- virtual rtc::scoped_refptr<MediaStreamInterface>
- CreateLocalMediaStream(const std::string& label) = 0;
-
- // Creates an AudioSourceInterface.
- // |options| decides audio processing settings.
- virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
- const cricket::AudioOptions& options) = 0;
- // Deprecated - use version above.
- // Can use CopyConstraintsIntoAudioOptions to bridge the gap.
- virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
- const MediaConstraintsInterface* constraints) = 0;
-
- // Creates a VideoTrackSourceInterface from |capturer|.
- // TODO(deadbeef): We should aim to remove cricket::VideoCapturer from the
- // API. It's mainly used as a wrapper around webrtc's provided
- // platform-specific capturers, but these should be refactored to use
- // VideoTrackSourceInterface directly.
- // TODO(deadbeef): Make pure virtual once downstream mock PC factory classes
- // are updated.
- virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
- std::unique_ptr<cricket::VideoCapturer> capturer) {
- return nullptr;
- }
-
- // A video source creator that allows selection of resolution and frame rate.
- // |constraints| decides video resolution and frame rate but can be null.
- // In the null case, use the version above.
- //
- // |constraints| is only used for the invocation of this method, and can
- // safely be destroyed afterwards.
- virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
- std::unique_ptr<cricket::VideoCapturer> capturer,
- const MediaConstraintsInterface* constraints) {
- return nullptr;
- }
-
- // Deprecated; please use the versions that take unique_ptrs above.
- // TODO(deadbeef): Remove these once safe to do so.
- virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
- cricket::VideoCapturer* capturer) {
- return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer));
- }
- virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
- cricket::VideoCapturer* capturer,
- const MediaConstraintsInterface* constraints) {
- return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer),
- constraints);
- }
-
- // Creates a new local VideoTrack. The same |source| can be used in several
- // tracks.
- virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
- const std::string& label,
- VideoTrackSourceInterface* source) = 0;
-
- // Creates an new AudioTrack. At the moment |source| can be null.
- virtual rtc::scoped_refptr<AudioTrackInterface>
- CreateAudioTrack(const std::string& label,
- AudioSourceInterface* source) = 0;
-
- // Starts AEC dump using existing file. Takes ownership of |file| and passes
- // it on to VoiceEngine (via other objects) immediately, which will take
- // the ownerhip. If the operation fails, the file will be closed.
- // A maximum file size in bytes can be specified. When the file size limit is
- // reached, logging is stopped automatically. If max_size_bytes is set to a
- // value <= 0, no limit will be used, and logging will continue until the
- // StopAecDump function is called.
- virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) = 0;
-
- // Stops logging the AEC dump.
- virtual void StopAecDump() = 0;
-
- // This function is deprecated and will be removed when Chrome is updated to
- // use the equivalent function on PeerConnectionInterface.
- // TODO(ivoc) Remove after Chrome is updated.
- virtual bool StartRtcEventLog(rtc::PlatformFile file,
- int64_t max_size_bytes) = 0;
- // This function is deprecated and will be removed when Chrome is updated to
- // use the equivalent function on PeerConnectionInterface.
- // TODO(ivoc) Remove after Chrome is updated.
- virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0;
-
- // This function is deprecated and will be removed when Chrome is updated to
- // use the equivalent function on PeerConnectionInterface.
- // TODO(ivoc) Remove after Chrome is updated.
- virtual void StopRtcEventLog() = 0;
-
- protected:
- // Dtor and ctor protected as objects shouldn't be created or deleted via
- // this interface.
- PeerConnectionFactoryInterface() {}
- ~PeerConnectionFactoryInterface() {} // NOLINT
-};
-
-// Create a new instance of PeerConnectionFactoryInterface.
-//
-// This method relies on the thread it's called on as the "signaling thread"
-// for the PeerConnectionFactory it creates.
-//
-// As such, if the current thread is not already running an rtc::Thread message
-// loop, an application using this method must eventually either call
-// rtc::Thread::Current()->Run(), or call
-// rtc::Thread::Current()->ProcessMessages() within the application's own
-// message loop.
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory);
-
-// Deprecated variant of the above.
-// TODO(kwiberg): Remove.
-rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreatePeerConnectionFactory();
-
-// Create a new instance of PeerConnectionFactoryInterface.
-//
-// |network_thread|, |worker_thread| and |signaling_thread| are
-// the only mandatory parameters.
-//
-// If non-null, a reference is added to |default_adm|, and ownership of
-// |video_encoder_factory| and |video_decoder_factory| is transferred to the
-// returned factory.
-// TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this
-// ownership transfer and ref counting more obvious.
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
- cricket::WebRtcVideoDecoderFactory* video_decoder_factory);
-
-// Deprecated variant of the above.
-// TODO(kwiberg): Remove.
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- cricket::WebRtcVideoEncoderFactory* encoder_factory,
- cricket::WebRtcVideoDecoderFactory* decoder_factory);
-
-// Create a new instance of PeerConnectionFactoryInterface with optional
-// external audio mixed and audio processing modules.
-//
-// If |audio_mixer| is null, an internal audio mixer will be created and used.
-// If |audio_processing| is null, an internal audio processing module will be
-// created and used.
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
- cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer,
- rtc::scoped_refptr<AudioProcessing> audio_processing);
-
-// Create a new instance of PeerConnectionFactoryInterface with external audio
-// mixer.
-//
-// If |audio_mixer| is null, an internal audio mixer will be created and used.
-rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreatePeerConnectionFactoryWithAudioMixer(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
- cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer);
-
-// Deprecated variant of the above.
-// TODO(kwiberg): Remove.
-rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreatePeerConnectionFactoryWithAudioMixer(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- cricket::WebRtcVideoEncoderFactory* encoder_factory,
- cricket::WebRtcVideoDecoderFactory* decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer);
-
-// Create a new instance of PeerConnectionFactoryInterface.
-// Same thread is used as worker and network thread.
-inline rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreatePeerConnectionFactory(
- rtc::Thread* worker_and_network_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
- cricket::WebRtcVideoDecoderFactory* video_decoder_factory) {
- return CreatePeerConnectionFactory(
- worker_and_network_thread, worker_and_network_thread, signaling_thread,
- default_adm, audio_encoder_factory, audio_decoder_factory,
- video_encoder_factory, video_decoder_factory);
-}
-
-// Deprecated variant of the above.
-// TODO(kwiberg): Remove.
-inline rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreatePeerConnectionFactory(
- rtc::Thread* worker_and_network_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- cricket::WebRtcVideoEncoderFactory* encoder_factory,
- cricket::WebRtcVideoDecoderFactory* decoder_factory) {
- return CreatePeerConnectionFactory(
- worker_and_network_thread, worker_and_network_thread, signaling_thread,
- default_adm, encoder_factory, decoder_factory);
-}
-
-// This is a lower-level version of the CreatePeerConnectionFactory functions
-// above. It's implemented in the "peerconnection" build target, whereas the
-// above methods are only implemented in the broader "libjingle_peerconnection"
-// build target, which pulls in the implementations of every module webrtc may
-// use.
-//
-// If an application knows it will only require certain modules, it can reduce
-// webrtc's impact on its binary size by depending only on the "peerconnection"
-// target and the modules the application requires, using
-// CreateModularPeerConnectionFactory instead of one of the
-// CreatePeerConnectionFactory methods above. For example, if an application
-// only uses WebRTC for audio, it can pass in null pointers for the
-// video-specific interfaces, and omit the corresponding modules from its
-// build.
-//
-// If |network_thread| or |worker_thread| are null, the PeerConnectionFactory
-// will create the necessary thread internally. If |signaling_thread| is null,
-// the PeerConnectionFactory will use the thread on which this method is called
-// as the signaling thread, wrapping it in an rtc::Thread object if needed.
-//
-// If non-null, a reference is added to |default_adm|, and ownership of
-// |video_encoder_factory| and |video_decoder_factory| is transferred to the
-// returned factory.
-//
-// If |audio_mixer| is null, an internal audio mixer will be created and used.
-//
-// TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this
-// ownership transfer and ref counting more obvious.
-//
-// TODO(deadbeef): Encapsulate these modules in a struct, so that when a new
-// module is inevitably exposed, we can just add a field to the struct instead
-// of adding a whole new CreateModularPeerConnectionFactory overload.
-rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreateModularPeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- AudioDeviceModule* default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
- cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer,
- std::unique_ptr<cricket::MediaEngineInterface> media_engine,
- std::unique_ptr<CallFactoryInterface> call_factory,
- std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory);
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_
diff --git a/api/peerconnectionproxy.h b/api/peerconnectionproxy.h
deleted file mode 100644
index c68bee6..0000000
--- a/api/peerconnectionproxy.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2012 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 WEBRTC_API_PEERCONNECTIONPROXY_H_
-#define WEBRTC_API_PEERCONNECTIONPROXY_H_
-
-#include <string>
-#include <vector>
-
-#include "webrtc/api/peerconnectioninterface.h"
-#include "webrtc/api/proxy.h"
-
-namespace webrtc {
-
-// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
-// are called on is an implementation detail.
-BEGIN_SIGNALING_PROXY_MAP(PeerConnection)
- PROXY_SIGNALING_THREAD_DESTRUCTOR()
- PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
- PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
- PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
- PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
- PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
- AddTrack,
- MediaStreamTrackInterface*,
- std::vector<MediaStreamInterface*>)
- PROXY_METHOD1(bool, RemoveTrack, RtpSenderInterface*)
- PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
- CreateDtmfSender,
- AudioTrackInterface*)
- PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
- CreateSender,
- const std::string&,
- const std::string&)
- PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>,
- GetSenders)
- PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>,
- GetReceivers)
- PROXY_METHOD3(bool,
- GetStats,
- StatsObserver*,
- MediaStreamTrackInterface*,
- StatsOutputLevel)
- PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*)
- PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>,
- CreateDataChannel,
- const std::string&,
- const DataChannelInit*)
- PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
- PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
- PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
- pending_local_description)
- PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
- pending_remote_description)
- PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
- current_local_description)
- PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
- current_remote_description)
- PROXY_METHOD2(void,
- CreateOffer,
- CreateSessionDescriptionObserver*,
- const MediaConstraintsInterface*)
- PROXY_METHOD2(void,
- CreateAnswer,
- CreateSessionDescriptionObserver*,
- const MediaConstraintsInterface*)
- PROXY_METHOD2(void,
- CreateOffer,
- CreateSessionDescriptionObserver*,
- const RTCOfferAnswerOptions&)
- PROXY_METHOD2(void,
- CreateAnswer,
- CreateSessionDescriptionObserver*,
- const RTCOfferAnswerOptions&)
- PROXY_METHOD2(void,
- SetLocalDescription,
- SetSessionDescriptionObserver*,
- SessionDescriptionInterface*)
- PROXY_METHOD2(void,
- SetRemoteDescription,
- SetSessionDescriptionObserver*,
- SessionDescriptionInterface*)
- PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration);
- PROXY_METHOD2(bool,
- SetConfiguration,
- const PeerConnectionInterface::RTCConfiguration&,
- RTCError*);
- PROXY_METHOD1(bool,
- SetConfiguration,
- const PeerConnectionInterface::RTCConfiguration&);
- PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
- PROXY_METHOD1(bool,
- RemoveIceCandidates,
- const std::vector<cricket::Candidate>&);
- PROXY_METHOD1(void, RegisterUMAObserver, UMAObserver*)
- PROXY_METHOD1(RTCError, SetBitrate, const BitrateParameters&);
- PROXY_METHOD0(SignalingState, signaling_state)
- PROXY_METHOD0(IceConnectionState, ice_connection_state)
- PROXY_METHOD0(IceGatheringState, ice_gathering_state)
- PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
- PROXY_METHOD0(void, StopRtcEventLog)
- PROXY_METHOD0(void, Close)
-END_PROXY_MAP()
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_PEERCONNECTIONPROXY_H_
diff --git a/api/proxy.h b/api/proxy.h
deleted file mode 100644
index 03b6ff7..0000000
--- a/api/proxy.h
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-// This file contains Macros for creating proxies for webrtc MediaStream and
-// PeerConnection classes.
-// TODO(deadbeef): Move this to pc/; this is part of the implementation.
-
-//
-// Example usage:
-//
-// class TestInterface : public rtc::RefCountInterface {
-// public:
-// std::string FooA() = 0;
-// std::string FooB(bool arg1) const = 0;
-// std::string FooC(bool arg1) = 0;
-// };
-//
-// Note that return types can not be a const reference.
-//
-// class Test : public TestInterface {
-// ... implementation of the interface.
-// };
-//
-// BEGIN_PROXY_MAP(Test)
-// PROXY_SIGNALING_THREAD_DESTRUCTOR()
-// PROXY_METHOD0(std::string, FooA)
-// PROXY_CONSTMETHOD1(std::string, FooB, arg1)
-// PROXY_WORKER_METHOD1(std::string, FooC, arg1)
-// END_PROXY_MAP()
-//
-// Where the destructor and first two methods are invoked on the signaling
-// thread, and the third is invoked on the worker thread.
-//
-// The proxy can be created using
-//
-// TestProxy::Create(Thread* signaling_thread, Thread* worker_thread,
-// TestInterface*).
-//
-// The variant defined with BEGIN_SIGNALING_PROXY_MAP is unaware of
-// the worker thread, and invokes all methods on the signaling thread.
-//
-// The variant defined with BEGIN_OWNED_PROXY_MAP does not use
-// refcounting, and instead just takes ownership of the object being proxied.
-
-#ifndef WEBRTC_API_PROXY_H_
-#define WEBRTC_API_PROXY_H_
-
-#include <memory>
-#include <utility>
-
-#include "webrtc/rtc_base/event.h"
-#include "webrtc/rtc_base/thread.h"
-
-namespace webrtc {
-
-template <typename R>
-class ReturnType {
- public:
- template<typename C, typename M>
- void Invoke(C* c, M m) { r_ = (c->*m)(); }
- template <typename C, typename M, typename T1>
- void Invoke(C* c, M m, T1 a1) {
- r_ = (c->*m)(std::move(a1));
- }
- template <typename C, typename M, typename T1, typename T2>
- void Invoke(C* c, M m, T1 a1, T2 a2) {
- r_ = (c->*m)(std::move(a1), std::move(a2));
- }
- template <typename C, typename M, typename T1, typename T2, typename T3>
- void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3) {
- r_ = (c->*m)(std::move(a1), std::move(a2), std::move(a3));
- }
- template<typename C, typename M, typename T1, typename T2, typename T3,
- typename T4>
- void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3, T4 a4) {
- r_ = (c->*m)(std::move(a1), std::move(a2), std::move(a3), std::move(a4));
- }
- template<typename C, typename M, typename T1, typename T2, typename T3,
- typename T4, typename T5>
- void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
- r_ = (c->*m)(std::move(a1), std::move(a2), std::move(a3), std::move(a4),
- std::move(a5));
- }
-
- R moved_result() { return std::move(r_); }
-
- private:
- R r_;
-};
-
-template <>
-class ReturnType<void> {
- public:
- template<typename C, typename M>
- void Invoke(C* c, M m) { (c->*m)(); }
- template <typename C, typename M, typename T1>
- void Invoke(C* c, M m, T1 a1) {
- (c->*m)(std::move(a1));
- }
- template <typename C, typename M, typename T1, typename T2>
- void Invoke(C* c, M m, T1 a1, T2 a2) {
- (c->*m)(std::move(a1), std::move(a2));
- }
- template <typename C, typename M, typename T1, typename T2, typename T3>
- void Invoke(C* c, M m, T1 a1, T2 a2, T3 a3) {
- (c->*m)(std::move(a1), std::move(a2), std::move(a3));
- }
-
- void moved_result() {}
-};
-
-namespace internal {
-
-class SynchronousMethodCall
- : public rtc::MessageData,
- public rtc::MessageHandler {
- public:
- explicit SynchronousMethodCall(rtc::MessageHandler* proxy)
- : e_(), proxy_(proxy) {}
- ~SynchronousMethodCall() {}
-
- void Invoke(const rtc::Location& posted_from, rtc::Thread* t) {
- if (t->IsCurrent()) {
- proxy_->OnMessage(nullptr);
- } else {
- e_.reset(new rtc::Event(false, false));
- t->Post(posted_from, this, 0);
- e_->Wait(rtc::Event::kForever);
- }
- }
-
- private:
- void OnMessage(rtc::Message*) {
- proxy_->OnMessage(nullptr);
- e_->Set();
- }
- std::unique_ptr<rtc::Event> e_;
- rtc::MessageHandler* proxy_;
-};
-
-} // namespace internal
-
-template <typename C, typename R>
-class MethodCall0 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)();
- MethodCall0(C* c, Method m) : c_(c), m_(m) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
-};
-
-template <typename C, typename R>
-class ConstMethodCall0 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)() const;
- ConstMethodCall0(C* c, Method m) : c_(c), m_(m) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
-};
-
-template <typename C, typename R, typename T1>
-class MethodCall1 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)(T1 a1);
- MethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(std::move(a1)) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, std::move(a1_)); }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
- T1 a1_;
-};
-
-template <typename C, typename R, typename T1>
-class ConstMethodCall1 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)(T1 a1) const;
- ConstMethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(std::move(a1)) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, std::move(a1_)); }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
- T1 a1_;
-};
-
-template <typename C, typename R, typename T1, typename T2>
-class MethodCall2 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)(T1 a1, T2 a2);
- MethodCall2(C* c, Method m, T1 a1, T2 a2)
- : c_(c), m_(m), a1_(std::move(a1)), a2_(std::move(a2)) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) {
- r_.Invoke(c_, m_, std::move(a1_), std::move(a2_));
- }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
- T1 a1_;
- T2 a2_;
-};
-
-template <typename C, typename R, typename T1, typename T2, typename T3>
-class MethodCall3 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)(T1 a1, T2 a2, T3 a3);
- MethodCall3(C* c, Method m, T1 a1, T2 a2, T3 a3)
- : c_(c),
- m_(m),
- a1_(std::move(a1)),
- a2_(std::move(a2)),
- a3_(std::move(a3)) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) {
- r_.Invoke(c_, m_, std::move(a1_), std::move(a2_), std::move(a3_));
- }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
- T1 a1_;
- T2 a2_;
- T3 a3_;
-};
-
-template <typename C, typename R, typename T1, typename T2, typename T3,
- typename T4>
-class MethodCall4 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)(T1 a1, T2 a2, T3 a3, T4 a4);
- MethodCall4(C* c, Method m, T1 a1, T2 a2, T3 a3, T4 a4)
- : c_(c),
- m_(m),
- a1_(std::move(a1)),
- a2_(std::move(a2)),
- a3_(std::move(a3)),
- a4_(std::move(a4)) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) {
- r_.Invoke(c_, m_, std::move(a1_), std::move(a2_), std::move(a3_),
- std::move(a4_));
- }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
- T1 a1_;
- T2 a2_;
- T3 a3_;
- T4 a4_;
-};
-
-template <typename C, typename R, typename T1, typename T2, typename T3,
- typename T4, typename T5>
-class MethodCall5 : public rtc::Message,
- public rtc::MessageHandler {
- public:
- typedef R (C::*Method)(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
- MethodCall5(C* c, Method m, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
- : c_(c),
- m_(m),
- a1_(std::move(a1)),
- a2_(std::move(a2)),
- a3_(std::move(a3)),
- a4_(std::move(a4)),
- a5_(std::move(a5)) {}
-
- R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
- internal::SynchronousMethodCall(this).Invoke(posted_from, t);
- return r_.moved_result();
- }
-
- private:
- void OnMessage(rtc::Message*) {
- r_.Invoke(c_, m_, std::move(a1_), std::move(a2_), std::move(a3_),
- std::move(a4_), std::move(a5_));
- }
-
- C* c_;
- Method m_;
- ReturnType<R> r_;
- T1 a1_;
- T2 a2_;
- T3 a3_;
- T4 a4_;
- T5 a5_;
-};
-
-
-// Helper macros to reduce code duplication.
-#define PROXY_MAP_BOILERPLATE(c) \
- template <class INTERNAL_CLASS> \
- class c##ProxyWithInternal; \
- typedef c##ProxyWithInternal<c##Interface> c##Proxy; \
- template <class INTERNAL_CLASS> \
- class c##ProxyWithInternal : public c##Interface { \
- protected: \
- typedef c##Interface C; \
- \
- public: \
- const INTERNAL_CLASS* internal() const { return c_; } \
- INTERNAL_CLASS* internal() { return c_; }
-
-#define END_PROXY_MAP() \
- };
-
-#define SIGNALING_PROXY_MAP_BOILERPLATE(c) \
- protected: \
- c##ProxyWithInternal(rtc::Thread* signaling_thread, INTERNAL_CLASS* c) \
- : signaling_thread_(signaling_thread), c_(c) {} \
- \
- private: \
- mutable rtc::Thread* signaling_thread_;
-
-#define WORKER_PROXY_MAP_BOILERPLATE(c) \
- protected: \
- c##ProxyWithInternal(rtc::Thread* signaling_thread, \
- rtc::Thread* worker_thread, INTERNAL_CLASS* c) \
- : signaling_thread_(signaling_thread), \
- worker_thread_(worker_thread), \
- c_(c) {} \
- \
- private: \
- mutable rtc::Thread* signaling_thread_; \
- mutable rtc::Thread* worker_thread_;
-
-// Note that the destructor is protected so that the proxy can only be
-// destroyed via RefCountInterface.
-#define REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
- protected: \
- ~c##ProxyWithInternal() { \
- MethodCall0<c##ProxyWithInternal, void> call( \
- this, &c##ProxyWithInternal::DestroyInternal); \
- call.Marshal(RTC_FROM_HERE, destructor_thread()); \
- } \
- \
- private: \
- void DestroyInternal() { c_ = nullptr; } \
- rtc::scoped_refptr<INTERNAL_CLASS> c_;
-
-// Note: This doesn't use a unique_ptr, because it intends to handle a corner
-// case where an object's deletion triggers a callback that calls back into
-// this proxy object. If relying on a unique_ptr to delete the object, its
-// inner pointer would be set to null before this reentrant callback would have
-// a chance to run, resulting in a segfault.
-#define OWNED_PROXY_MAP_BOILERPLATE(c) \
- public: \
- ~c##ProxyWithInternal() { \
- MethodCall0<c##ProxyWithInternal, void> call( \
- this, &c##ProxyWithInternal::DestroyInternal); \
- call.Marshal(RTC_FROM_HERE, destructor_thread()); \
- } \
- \
- private: \
- void DestroyInternal() { delete c_; } \
- INTERNAL_CLASS* c_;
-
-#define BEGIN_SIGNALING_PROXY_MAP(c) \
- PROXY_MAP_BOILERPLATE(c) \
- SIGNALING_PROXY_MAP_BOILERPLATE(c) \
- REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
- public: \
- static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
- rtc::Thread* signaling_thread, INTERNAL_CLASS* c) { \
- return new rtc::RefCountedObject<c##ProxyWithInternal>(signaling_thread, \
- c); \
- }
-
-#define BEGIN_PROXY_MAP(c) \
- PROXY_MAP_BOILERPLATE(c) \
- WORKER_PROXY_MAP_BOILERPLATE(c) \
- REFCOUNTED_PROXY_MAP_BOILERPLATE(c) \
- public: \
- static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
- rtc::Thread* signaling_thread, rtc::Thread* worker_thread, \
- INTERNAL_CLASS* c) { \
- return new rtc::RefCountedObject<c##ProxyWithInternal>(signaling_thread, \
- worker_thread, c); \
- }
-
-#define BEGIN_OWNED_PROXY_MAP(c) \
- PROXY_MAP_BOILERPLATE(c) \
- WORKER_PROXY_MAP_BOILERPLATE(c) \
- OWNED_PROXY_MAP_BOILERPLATE(c) \
- public: \
- static std::unique_ptr<c##Interface> Create( \
- rtc::Thread* signaling_thread, rtc::Thread* worker_thread, \
- std::unique_ptr<INTERNAL_CLASS> c) { \
- return std::unique_ptr<c##Interface>(new c##ProxyWithInternal( \
- signaling_thread, worker_thread, c.release())); \
- }
-
-#define PROXY_SIGNALING_THREAD_DESTRUCTOR() \
- private: \
- rtc::Thread* destructor_thread() const { return signaling_thread_; } \
- \
- public: // NOLINTNEXTLINE
-
-#define PROXY_WORKER_THREAD_DESTRUCTOR() \
- private: \
- rtc::Thread* destructor_thread() const { return worker_thread_; } \
- \
- public: // NOLINTNEXTLINE
-
-#define PROXY_METHOD0(r, method) \
- r method() override { \
- MethodCall0<C, r> call(c_, &C::method); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_CONSTMETHOD0(r, method) \
- r method() const override { \
- ConstMethodCall0<C, r> call(c_, &C::method); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_METHOD1(r, method, t1) \
- r method(t1 a1) override { \
- MethodCall1<C, r, t1> call(c_, &C::method, std::move(a1)); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_CONSTMETHOD1(r, method, t1) \
- r method(t1 a1) const override { \
- ConstMethodCall1<C, r, t1> call(c_, &C::method, std::move(a1)); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_METHOD2(r, method, t1, t2) \
- r method(t1 a1, t2 a2) override { \
- MethodCall2<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
- std::move(a2)); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_METHOD3(r, method, t1, t2, t3) \
- r method(t1 a1, t2 a2, t3 a3) override { \
- MethodCall3<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
- std::move(a2), std::move(a3)); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_METHOD4(r, method, t1, t2, t3, t4) \
- r method(t1 a1, t2 a2, t3 a3, t4 a4) override { \
- MethodCall4<C, r, t1, t2, t3, t4> call(c_, &C::method, std::move(a1), \
- std::move(a2), std::move(a3), \
- std::move(a4)); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-#define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \
- r method(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) override { \
- MethodCall5<C, r, t1, t2, t3, t4, t5> call(c_, &C::method, std::move(a1), \
- std::move(a2), std::move(a3), \
- std::move(a4), std::move(a5)); \
- return call.Marshal(RTC_FROM_HERE, signaling_thread_); \
- }
-
-// Define methods which should be invoked on the worker thread.
-#define PROXY_WORKER_METHOD0(r, method) \
- r method() override { \
- MethodCall0<C, r> call(c_, &C::method); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_CONSTMETHOD0(r, method) \
- r method() const override { \
- ConstMethodCall0<C, r> call(c_, &C::method); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_METHOD1(r, method, t1) \
- r method(t1 a1) override { \
- MethodCall1<C, r, t1> call(c_, &C::method, std::move(a1)); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_CONSTMETHOD1(r, method, t1) \
- r method(t1 a1) const override { \
- ConstMethodCall1<C, r, t1> call(c_, &C::method, std::move(a1)); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_METHOD2(r, method, t1, t2) \
- r method(t1 a1, t2 a2) override { \
- MethodCall2<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
- std::move(a2)); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_CONSTMETHOD2(r, method, t1, t2) \
- r method(t1 a1, t2 a2) const override { \
- ConstMethodCall2<C, r, t1, t2> call(c_, &C::method, std::move(a1), \
- std::move(a2)); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_METHOD3(r, method, t1, t2, t3) \
- r method(t1 a1, t2 a2, t3 a3) override { \
- MethodCall3<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
- std::move(a2), std::move(a3)); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-#define PROXY_WORKER_CONSTMETHOD3(r, method, t1, t2) \
- r method(t1 a1, t2 a2, t3 a3) const override { \
- ConstMethodCall3<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \
- std::move(a2), std::move(a3)); \
- return call.Marshal(RTC_FROM_HERE, worker_thread_); \
- }
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_PROXY_H_
diff --git a/api/rtcerror.cc b/api/rtcerror.cc
deleted file mode 100644
index f956484..0000000
--- a/api/rtcerror.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2017 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 "webrtc/api/rtcerror.h"
-
-#include "webrtc/rtc_base/arraysize.h"
-
-namespace {
-
-static const char* const kRTCErrorTypeNames[] = {
- "NONE",
- "UNSUPPORTED_OPERATION",
- "UNSUPPORTED_PARAMETER",
- "INVALID_PARAMETER",
- "INVALID_RANGE",
- "SYNTAX_ERROR",
- "INVALID_STATE",
- "INVALID_MODIFICATION",
- "NETWORK_ERROR",
- "RESOURCE_EXHAUSTED",
- "INTERNAL_ERROR",
-};
-static_assert(static_cast<int>(webrtc::RTCErrorType::INTERNAL_ERROR) ==
- (arraysize(kRTCErrorTypeNames) - 1),
- "kRTCErrorTypeNames must have as many strings as RTCErrorType "
- "has values.");
-
-} // namespace
-
-namespace webrtc {
-
-RTCError::RTCError(RTCError&& other)
- : type_(other.type_), have_string_message_(other.have_string_message_) {
- if (have_string_message_) {
- new (&string_message_) std::string(std::move(other.string_message_));
- } else {
- static_message_ = other.static_message_;
- }
-}
-
-RTCError& RTCError::operator=(RTCError&& other) {
- type_ = other.type_;
- if (other.have_string_message_) {
- set_message(std::move(other.string_message_));
- } else {
- set_message(other.static_message_);
- }
- return *this;
-}
-
-RTCError::~RTCError() {
- // If we hold a message string that was built, rather than a static string,
- // we need to delete it.
- if (have_string_message_) {
- string_message_.~basic_string();
- }
-}
-
-// static
-RTCError RTCError::OK() {
- return RTCError();
-}
-
-const char* RTCError::message() const {
- if (have_string_message_) {
- return string_message_.c_str();
- } else {
- return static_message_;
- }
-}
-
-void RTCError::set_message(const char* message) {
- if (have_string_message_) {
- string_message_.~basic_string();
- have_string_message_ = false;
- }
- static_message_ = message;
-}
-
-void RTCError::set_message(std::string&& message) {
- if (!have_string_message_) {
- new (&string_message_) std::string(std::move(message));
- have_string_message_ = true;
- } else {
- string_message_ = message;
- }
-}
-
-std::ostream& operator<<(std::ostream& stream, RTCErrorType error) {
- int index = static_cast<int>(error);
- return stream << kRTCErrorTypeNames[index];
-}
-
-} // namespace webrtc
diff --git a/api/rtcerror.h b/api/rtcerror.h
deleted file mode 100644
index 7451fef..0000000
--- a/api/rtcerror.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright 2017 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 WEBRTC_API_RTCERROR_H_
-#define WEBRTC_API_RTCERROR_H_
-
-#include <ostream>
-#include <string>
-#include <utility> // For std::move.
-
-#include "webrtc/rtc_base/checks.h"
-#include "webrtc/rtc_base/logging.h"
-
-namespace webrtc {
-
-// Enumeration to represent distinct classes of errors that an application
-// may wish to act upon differently. These roughly map to DOMExceptions or
-// RTCError "errorDetailEnum" values in the web API, as described in the
-// comments below.
-enum class RTCErrorType {
- // No error.
- NONE,
-
- // An operation is valid, but currently unsupported.
- // Maps to OperationError DOMException.
- UNSUPPORTED_OPERATION,
-
- // A supplied parameter is valid, but currently unsupported.
- // Maps to OperationError DOMException.
- UNSUPPORTED_PARAMETER,
-
- // General error indicating that a supplied parameter is invalid.
- // Maps to InvalidAccessError or TypeError DOMException depending on context.
- INVALID_PARAMETER,
-
- // Slightly more specific than INVALID_PARAMETER; a parameter's value was
- // outside the allowed range.
- // Maps to RangeError DOMException.
- INVALID_RANGE,
-
- // Slightly more specific than INVALID_PARAMETER; an error occurred while
- // parsing string input.
- // Maps to SyntaxError DOMException.
- SYNTAX_ERROR,
-
- // The object does not support this operation in its current state.
- // Maps to InvalidStateError DOMException.
- INVALID_STATE,
-
- // An attempt was made to modify the object in an invalid way.
- // Maps to InvalidModificationError DOMException.
- INVALID_MODIFICATION,
-
- // An error occurred within an underlying network protocol.
- // Maps to NetworkError DOMException.
- NETWORK_ERROR,
-
- // Some resource has been exhausted; file handles, hardware resources, ports,
- // etc.
- // Maps to OperationError DOMException.
- RESOURCE_EXHAUSTED,
-
- // The operation failed due to an internal error.
- // Maps to OperationError DOMException.
- INTERNAL_ERROR,
-};
-
-// Roughly corresponds to RTCError in the web api. Holds an error type, a
-// message, and possibly additional information specific to that error.
-//
-// Doesn't contain anything beyond a type and message now, but will in the
-// future as more errors are implemented.
-class RTCError {
- public:
- // Constructors.
-
- // Creates a "no error" error.
- RTCError() {}
- explicit RTCError(RTCErrorType type) : type_(type) {}
- // For performance, prefer using the constructor that takes a const char* if
- // the message is a static string.
- RTCError(RTCErrorType type, const char* message)
- : type_(type), static_message_(message), have_string_message_(false) {}
- RTCError(RTCErrorType type, std::string&& message)
- : type_(type), string_message_(message), have_string_message_(true) {}
-
- // Delete the copy constructor and assignment operator; there aren't any use
- // cases where you should need to copy an RTCError, as opposed to moving it.
- // Can revisit this decision if use cases arise in the future.
- RTCError(const RTCError& other) = delete;
- RTCError& operator=(const RTCError& other) = delete;
-
- // Move constructor and move-assignment operator.
- RTCError(RTCError&& other);
- RTCError& operator=(RTCError&& other);
-
- ~RTCError();
-
- // Identical to default constructed error.
- //
- // Preferred over the default constructor for code readability.
- static RTCError OK();
-
- // Error type.
- RTCErrorType type() const { return type_; }
- void set_type(RTCErrorType type) { type_ = type; }
-
- // Human-readable message describing the error. Shouldn't be used for
- // anything but logging/diagnostics, since messages are not guaranteed to be
- // stable.
- const char* message() const;
- // For performance, prefer using the method that takes a const char* if the
- // message is a static string.
- void set_message(const char* message);
- void set_message(std::string&& message);
-
- // Convenience method for situations where you only care whether or not an
- // error occurred.
- bool ok() const { return type_ == RTCErrorType::NONE; }
-
- private:
- RTCErrorType type_ = RTCErrorType::NONE;
- // For performance, we use static strings wherever possible. But in some
- // cases the error string may need to be constructed, in which case an
- // std::string is used.
- union {
- const char* static_message_ = "";
- std::string string_message_;
- };
- // Whether or not |static_message_| or |string_message_| is being used in the
- // above union.
- bool have_string_message_ = false;
-};
-
-// Outputs the error as a friendly string. Update this method when adding a new
-// error type.
-//
-// Only intended to be used for logging/disagnostics.
-std::ostream& operator<<(std::ostream& stream, RTCErrorType error);
-
-// Helper macro that can be used by implementations to create an error with a
-// message and log it. |message| should be a string literal or movable
-// std::string.
-#define LOG_AND_RETURN_ERROR_EX(type, message, severity) \
- { \
- RTC_DCHECK(type != RTCErrorType::NONE); \
- LOG(severity) << message << " (" << type << ")"; \
- return webrtc::RTCError(type, message); \
- }
-
-#define LOG_AND_RETURN_ERROR(type, message) \
- LOG_AND_RETURN_ERROR_EX(type, message, LS_ERROR)
-
-// RTCErrorOr<T> is the union of an RTCError object and a T object. RTCErrorOr
-// models the concept of an object that is either a usable value, or an error
-// Status explaining why such a value is not present. To this end RTCErrorOr<T>
-// does not allow its RTCErrorType value to be RTCErrorType::NONE. This is
-// enforced by a debug check in most cases.
-//
-// The primary use-case for RTCErrorOr<T> is as the return value of a function
-// which may fail. For example, CreateRtpSender will fail if the parameters
-// could not be successfully applied at the media engine level, but if
-// successful will return a unique_ptr to an RtpSender.
-//
-// Example client usage for a RTCErrorOr<std::unique_ptr<T>>:
-//
-// RTCErrorOr<std::unique_ptr<Foo>> result = FooFactory::MakeNewFoo(arg);
-// if (result.ok()) {
-// std::unique_ptr<Foo> foo = result.ConsumeValue();
-// foo->DoSomethingCool();
-// } else {
-// LOG(LS_ERROR) << result.error();
-// }
-//
-// Example factory implementation returning RTCErrorOr<std::unique_ptr<T>>:
-//
-// RTCErrorOr<std::unique_ptr<Foo>> FooFactory::MakeNewFoo(int arg) {
-// if (arg <= 0) {
-// return RTCError(RTCErrorType::INVALID_RANGE, "Arg must be positive");
-// } else {
-// return std::unique_ptr<Foo>(new Foo(arg));
-// }
-// }
-//
-template <typename T>
-class RTCErrorOr {
- // Used to convert between RTCErrorOr<Foo>/RtcErrorOr<Bar>, when an implicit
- // conversion from Foo to Bar exists.
- template <typename U>
- friend class RTCErrorOr;
-
- public:
- typedef T element_type;
-
- // Constructs a new RTCErrorOr with RTCErrorType::INTERNAL_ERROR error. This
- // is marked 'explicit' to try to catch cases like 'return {};', where people
- // think RTCErrorOr<std::vector<int>> will be initialized with an empty
- // vector, instead of a RTCErrorType::INTERNAL_ERROR error.
- RTCErrorOr() : error_(RTCErrorType::INTERNAL_ERROR) {}
-
- // Constructs a new RTCErrorOr with the given non-ok error. After calling
- // this constructor, calls to value() will DCHECK-fail.
- //
- // NOTE: Not explicit - we want to use RTCErrorOr<T> as a return
- // value, so it is convenient and sensible to be able to do 'return
- // RTCError(...)' when the return type is RTCErrorOr<T>.
- //
- // REQUIRES: !error.ok(). This requirement is DCHECKed.
- RTCErrorOr(RTCError&& error) : error_(std::move(error)) { // NOLINT
- RTC_DCHECK(!error.ok());
- }
-
- // Constructs a new RTCErrorOr with the given value. After calling this
- // constructor, calls to value() will succeed, and calls to error() will
- // return a default-constructed RTCError.
- //
- // NOTE: Not explicit - we want to use RTCErrorOr<T> as a return type
- // so it is convenient and sensible to be able to do 'return T()'
- // when the return type is RTCErrorOr<T>.
- RTCErrorOr(T&& value) : value_(std::move(value)) {} // NOLINT
-
- // Delete the copy constructor and assignment operator; there aren't any use
- // cases where you should need to copy an RTCErrorOr, as opposed to moving
- // it. Can revisit this decision if use cases arise in the future.
- RTCErrorOr(const RTCErrorOr& other) = delete;
- RTCErrorOr& operator=(const RTCErrorOr& other) = delete;
-
- // Move constructor and move-assignment operator.
- //
- // Visual Studio doesn't support "= default" with move constructors or
- // assignment operators (even though they compile, they segfault), so define
- // them explicitly.
- RTCErrorOr(RTCErrorOr&& other)
- : error_(std::move(other.error_)), value_(std::move(other.value_)) {}
- RTCErrorOr& operator=(RTCErrorOr&& other) {
- error_ = std::move(other.error_);
- value_ = std::move(other.value_);
- return *this;
- }
-
- // Conversion constructor and assignment operator; T must be copy or move
- // constructible from U.
- template <typename U>
- RTCErrorOr(RTCErrorOr<U> other) // NOLINT
- : error_(std::move(other.error_)), value_(std::move(other.value_)) {}
- template <typename U>
- RTCErrorOr& operator=(RTCErrorOr<U> other) {
- error_ = std::move(other.error_);
- value_ = std::move(other.value_);
- return *this;
- }
-
- // Returns a reference to our error. If this contains a T, then returns
- // default-constructed RTCError.
- const RTCError& error() const { return error_; }
-
- // Moves the error. Can be useful if, say "CreateFoo" returns an
- // RTCErrorOr<Foo>, and internally calls "CreateBar" which returns an
- // RTCErrorOr<Bar>, and wants to forward the error up the stack.
- RTCError MoveError() { return std::move(error_); }
-
- // Returns this->error().ok()
- bool ok() const { return error_.ok(); }
-
- // Returns a reference to our current value, or DCHECK-fails if !this->ok().
- //
- // Can be convenient for the implementation; for example, a method may want
- // to access the value in some way before returning it to the next method on
- // the stack.
- const T& value() const {
- RTC_DCHECK(ok());
- return value_;
- }
- T& value() {
- RTC_DCHECK(ok());
- return value_;
- }
-
- // Moves our current value out of this object and returns it, or DCHECK-fails
- // if !this->ok().
- T MoveValue() {
- RTC_DCHECK(ok());
- return std::move(value_);
- }
-
- private:
- RTCError error_;
- T value_;
-};
-
-} // namespace webrtc
-
-#endif // WEBRTC_API_RTCERROR_H_
diff --git a/api/rtcerror_unittest.cc b/api/rtcerror_unittest.cc
deleted file mode 100644
index 486a029..0000000
--- a/api/rtcerror_unittest.cc
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2017 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 <utility>
-
-#include "webrtc/api/rtcerror.h"
-#include "webrtc/test/gtest.h"
-
-namespace {
-
-const int kDefaultMoveOnlyIntValue = 0xbadf00d;
-
-// Class that has no copy constructor, ensuring that RTCErrorOr can
-struct MoveOnlyInt {
- MoveOnlyInt() {}
- explicit MoveOnlyInt(int value) : value(value) {}
- MoveOnlyInt(const MoveOnlyInt& other) = delete;
- MoveOnlyInt& operator=(const MoveOnlyInt& other) = delete;
- MoveOnlyInt(MoveOnlyInt&& other) : value(other.value) {}
- MoveOnlyInt& operator=(MoveOnlyInt&& other) {
- value = other.value;
- return *this;
- }
-
- int value = kDefaultMoveOnlyIntValue;
-};
-
-// Same as above. Used to test conversion from RTCErrorOr<A> to RTCErrorOr<B>
-// when A can be converted to B.
-struct MoveOnlyInt2 {
- MoveOnlyInt2() {}
- explicit MoveOnlyInt2(int value) : value(value) {}
- MoveOnlyInt2(const MoveOnlyInt2& other) = delete;
- MoveOnlyInt2& operator=(const MoveOnlyInt2& other) = delete;
- MoveOnlyInt2(MoveOnlyInt2&& other) : value(other.value) {}
- MoveOnlyInt2& operator=(MoveOnlyInt2&& other) {
- value = other.value;
- return *this;
- }
-
- explicit MoveOnlyInt2(MoveOnlyInt&& other) : value(other.value) {}
- MoveOnlyInt2& operator=(MoveOnlyInt&& other) {
- value = other.value;
- return *this;
- }
-
- int value = kDefaultMoveOnlyIntValue;
-};
-
-} // namespace
-
-namespace webrtc {
-
-// Simple test for ostream operator for RTCErrorType.
-TEST(RTCErrorTypeTest, OstreamOperator) {
- std::ostringstream oss;
- oss << webrtc::RTCErrorType::NONE << ' '
- << webrtc::RTCErrorType::INVALID_PARAMETER << ' '
- << webrtc::RTCErrorType::INTERNAL_ERROR;
- EXPECT_EQ("NONE INVALID_PARAMETER INTERNAL_ERROR", oss.str());
-}
-
-// Test that the default constructor creates a "no error" error.
-TEST(RTCErrorTest, DefaultConstructor) {
- RTCError e;
- EXPECT_EQ(RTCErrorType::NONE, e.type());
- EXPECT_EQ(std::string(), e.message());
- EXPECT_TRUE(e.ok());
-}
-
-TEST(RTCErrorTest, NormalConstructors) {
- RTCError a(RTCErrorType::INVALID_PARAMETER);
- EXPECT_EQ(RTCErrorType::INVALID_PARAMETER, a.type());
- EXPECT_EQ(std::string(), a.message());
-
- // Constructor that takes const char* message.
- RTCError b(RTCErrorType::UNSUPPORTED_PARAMETER, "foobar");
- EXPECT_EQ(RTCErrorType::UNSUPPORTED_PARAMETER, b.type());
- EXPECT_EQ(std::string("foobar"), b.message());
-
- // Constructor that takes std::string message.
- RTCError c(RTCErrorType::INVALID_RANGE, std::string("new"));
- EXPECT_EQ(RTCErrorType::INVALID_RANGE, c.type());
- EXPECT_EQ(std::string("new"), c.message());
-}
-
-TEST(RTCErrorTest, MoveConstructor) {
- // Static string.
- RTCError a(RTCErrorType::INVALID_PARAMETER, "foo");
- RTCError b(std::move(a));
- EXPECT_EQ(RTCErrorType::INVALID_PARAMETER, b.type());
- EXPECT_EQ(std::string("foo"), b.message());
-
- // Non-static string.
- RTCError c(RTCErrorType::UNSUPPORTED_PARAMETER, std::string("bar"));
- RTCError d(std::move(c));
- EXPECT_EQ(RTCErrorType::UNSUPPORTED_PARAMETER, d.type());
- EXPECT_EQ(std::string("bar"), d.message());
-}
-
-TEST(RTCErrorTest, MoveAssignment) {
- // Try all combinations of "is static string"/"is non-static string" moves.
- RTCError e(RTCErrorType::INVALID_PARAMETER, "foo");
-
- e = RTCError(RTCErrorType::UNSUPPORTED_PARAMETER, "bar");
- EXPECT_EQ(RTCErrorType::UNSUPPORTED_PARAMETER, e.type());
- EXPECT_EQ(std::string("bar"), e.message());
-
- e = RTCError(RTCErrorType::SYNTAX_ERROR, std::string("baz"));
- EXPECT_EQ(std::string("baz"), e.message());
-
- e = RTCError(RTCErrorType::SYNTAX_ERROR, std::string("another"));
- EXPECT_EQ(std::string("another"), e.message());
-
- e = RTCError(RTCErrorType::SYNTAX_ERROR, "last");
- EXPECT_EQ(std::string("last"), e.message());
-}
-
-// Test that the error returned by RTCError::OK() is a "no error" error.
-TEST(RTCErrorTest, OKConstant) {
- RTCError ok = RTCError::OK();
- EXPECT_EQ(RTCErrorType::NONE, ok.type());
- EXPECT_EQ(std::string(), ok.message());
- EXPECT_TRUE(ok.ok());
-}
-
-// Test that "error.ok()" behaves as expected.
-TEST(RTCErrorTest, OkMethod) {
- RTCError success;
- RTCError failure(RTCErrorType::INTERNAL_ERROR);
- EXPECT_TRUE(success.ok());
- EXPECT_FALSE(failure.ok());
-}
-
-// Test that a message can be set using either static const strings or
-// std::strings.
-TEST(RTCErrorTest, SetMessage) {
- RTCError e;
- // Try all combinations of "is static string"/"is non-static string" calls.
- e.set_message("foo");
- EXPECT_EQ(std::string("foo"), e.message());
-
- e.set_message("bar");
- EXPECT_EQ(std::string("bar"), e.message());
-
- e.set_message(std::string("string"));
- EXPECT_EQ(std::string("string"), e.message());
-
- e.set_message(std::string("more"));
- EXPECT_EQ(std::string("more"), e.message());
-
- e.set_message("love to test");
- EXPECT_EQ(std::string("love to test"), e.message());
-}
-
-// Test that the default constructor creates an "INTERNAL_ERROR".
-TEST(RTCErrorOrTest, DefaultConstructor) {
- RTCErrorOr<MoveOnlyInt> e;
- EXPECT_EQ(RTCErrorType::INTERNAL_ERROR, e.error().type());
-}
-
-// Test that an RTCErrorOr can be implicitly constructed from a value.
-TEST(RTCErrorOrTest, ImplicitValueConstructor) {
- RTCErrorOr<MoveOnlyInt> e = [] { return MoveOnlyInt(100); }();
- EXPECT_EQ(100, e.value().value);
-}
-
-// Test that an RTCErrorOr can be implicitly constructed from an RTCError.
-TEST(RTCErrorOrTest, ImplicitErrorConstructor) {
- RTCErrorOr<MoveOnlyInt> e = [] {
- return RTCError(RTCErrorType::SYNTAX_ERROR);
- }();
- EXPECT_EQ(RTCErrorType::SYNTAX_ERROR, e.error().type());
-}
-
-TEST(RTCErrorOrTest, MoveConstructor) {
- RTCErrorOr<MoveOnlyInt> a(MoveOnlyInt(5));
- RTCErrorOr<MoveOnlyInt> b(std::move(a));
- EXPECT_EQ(5, b.value().value);
-}
-
-TEST(RTCErrorOrTest, MoveAssignment) {
- RTCErrorOr<MoveOnlyInt> a(MoveOnlyInt(5));
- RTCErrorOr<MoveOnlyInt> b(MoveOnlyInt(10));
- a = std::move(b);
- EXPECT_EQ(10, a.value().value);
-}
-
-TEST(RTCErrorOrTest, ConversionConstructor) {
- RTCErrorOr<MoveOnlyInt> a(MoveOnlyInt(1));
- RTCErrorOr<MoveOnlyInt2> b(std::move(a));
-}
-
-TEST(RTCErrorOrTest, ConversionAssignment) {
- RTCErrorOr<MoveOnlyInt> a(MoveOnlyInt(5));
- RTCErrorOr<MoveOnlyInt2> b(MoveOnlyInt2(10));
- b = std::move(a);
- EXPECT_EQ(5, b.value().value);
-}
-
-TEST(RTCErrorOrTest, OkMethod) {
- RTCErrorOr<int> success(1337);
- RTCErrorOr<int> error = RTCError(RTCErrorType::INTERNAL_ERROR);
- EXPECT_TRUE(success.ok());
- EXPECT_FALSE(error.ok());
-}
-
-TEST(RTCErrorOrTest, MoveError) {
- RTCErrorOr<int> e({RTCErrorType::SYNTAX_ERROR, "message"});
- RTCError err = e.MoveError();
- EXPECT_EQ(RTCErrorType::SYNTAX_ERROR, err.type());
- EXPECT_EQ(std::string("message"), err.message());
-}
-
-TEST(RTCErrorOrTest, MoveValue) {
- RTCErrorOr<MoveOnlyInt> e(MoveOnlyInt(88));
- MoveOnlyInt value = e.MoveValue();
- EXPECT_EQ(88, value.value);
-}
-
-// Death tests.
-// Disabled on Android because death tests misbehave on Android, see
-// base/test/gtest_util.h.
-#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
-
-TEST(RTCErrorOrDeathTest, ConstructWithOkError) {
- EXPECT_DEATH(RTCErrorOr<int> err = RTCError::OK(), "");
-}
-
-TEST(RTCErrorOrDeathTest, DereferenceErrorValue) {
- RTCErrorOr<int> error = RTCError(RTCErrorType::INTERNAL_ERROR);
- EXPECT_DEATH(error.value(), "");
-}
-
-TEST(RTCErrorOrDeathTest, MoveErrorValue) {
- RTCErrorOr<int> error = RTCError(RTCErrorType::INTERNAL_ERROR);
- EXPECT_DEATH(error.MoveValue(), "");
-}
-
-#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
-
-} // namespace webrtc
diff --git a/api/rtpparameters.cc b/api/rtpparameters.cc
deleted file mode 100644
index 29b14fb..0000000
--- a/api/rtpparameters.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2017 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 "webrtc/api/rtpparameters.h"
-
-#include <algorithm>
-#include <sstream>
-#include <string>
-
-#include "webrtc/rtc_base/checks.h"
-
-namespace webrtc {
-
-RtcpFeedback::RtcpFeedback() {}
-RtcpFeedback::RtcpFeedback(RtcpFeedbackType type) : type(type) {}
-RtcpFeedback::RtcpFeedback(RtcpFeedbackType type,
- RtcpFeedbackMessageType message_type)
- : type(type), message_type(message_type) {}
-RtcpFeedback::~RtcpFeedback() {}
-
-RtpCodecCapability::RtpCodecCapability() {}
-RtpCodecCapability::~RtpCodecCapability() {}
-
-RtpHeaderExtensionCapability::RtpHeaderExtensionCapability() {}
-RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
- const std::string& uri)
- : uri(uri) {}
-RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
- const std::string& uri,
- int preferred_id)
- : uri(uri), preferred_id(preferred_id) {}
-RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() {}
-
-RtpExtension::RtpExtension() {}
-RtpExtension::RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
-RtpExtension::RtpExtension(const std::string& uri, int id, bool encrypt)
- : uri(uri), id(id), encrypt(encrypt) {}
-RtpExtension::~RtpExtension() {}
-
-RtpFecParameters::RtpFecParameters() {}
-RtpFecParameters::RtpFecParameters(FecMechanism mechanism)
- : mechanism(mechanism) {}
-RtpFecParameters::RtpFecParameters(FecMechanism mechanism, uint32_t ssrc)
- : ssrc(ssrc), mechanism(mechanism) {}
-RtpFecParameters::~RtpFecParameters() {}
-
-RtpRtxParameters::RtpRtxParameters() {}
-RtpRtxParameters::RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {}
-RtpRtxParameters::~RtpRtxParameters() {}
-
-RtpEncodingParameters::RtpEncodingParameters() {}
-RtpEncodingParameters::~RtpEncodingParameters() {}
-
-RtpCodecParameters::RtpCodecParameters() {}
-RtpCodecParameters::~RtpCodecParameters() {}
-
-RtpCapabilities::RtpCapabilities() {}
-RtpCapabilities::~RtpCapabilities() {}
-
-RtpParameters::RtpParameters() {}
-RtpParameters::~RtpParameters() {}
-
-std::string RtpExtension::ToString() const {
- std::stringstream ss;
- ss << "{uri: " << uri;
- ss << ", id: " << id;
- if (encrypt) {
- ss << ", encrypt";
- }
- ss << '}';
- return ss.str();
-}
-
-const char RtpExtension::kAudioLevelUri[] =
- "urn:ietf:params:rtp-hdrext:ssrc-audio-level";
-const int RtpExtension::kAudioLevelDefaultId = 1;
-
-const char RtpExtension::kTimestampOffsetUri[] =
- "urn:ietf:params:rtp-hdrext:toffset";
-const int RtpExtension::kTimestampOffsetDefaultId = 2;
-
-const char RtpExtension::kAbsSendTimeUri[] =
- "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
-const int RtpExtension::kAbsSendTimeDefaultId = 3;
-
-const char RtpExtension::kVideoRotationUri[] = "urn:3gpp:video-orientation";
-const int RtpExtension::kVideoRotationDefaultId = 4;
-
-const char RtpExtension::kTransportSequenceNumberUri[] =
- "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
-const int RtpExtension::kTransportSequenceNumberDefaultId = 5;
-
-// This extension allows applications to adaptively limit the playout delay
-// on frames as per the current needs. For example, a gaming application
-// has very different needs on end-to-end delay compared to a video-conference
-// application.
-const char RtpExtension::kPlayoutDelayUri[] =
- "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
-const int RtpExtension::kPlayoutDelayDefaultId = 6;
-
-const char RtpExtension::kVideoContentTypeUri[] =
- "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type";
-const int RtpExtension::kVideoContentTypeDefaultId = 7;
-
-const char RtpExtension::kVideoTimingUri[] =
- "http://www.webrtc.org/experiments/rtp-hdrext/video-timing";
-const int RtpExtension::kVideoTimingDefaultId = 8;
-
-const char RtpExtension::kEncryptHeaderExtensionsUri[] =
- "urn:ietf:params:rtp-hdrext:encrypt";
-
-const int RtpExtension::kMinId = 1;
-const int RtpExtension::kMaxId = 14;
-
-bool RtpExtension::IsSupportedForAudio(const std::string& uri) {
- return uri == webrtc::RtpExtension::kAudioLevelUri ||
- uri == webrtc::RtpExtension::kTransportSequenceNumberUri;
-}
-
-bool RtpExtension::IsSupportedForVideo(const std::string& uri) {
- return uri == webrtc::RtpExtension::kTimestampOffsetUri ||
- uri == webrtc::RtpExtension::kAbsSendTimeUri ||
- uri == webrtc::RtpExtension::kVideoRotationUri ||
- uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
- uri == webrtc::RtpExtension::kPlayoutDelayUri ||
- uri == webrtc::RtpExtension::kVideoContentTypeUri ||
- uri == webrtc::RtpExtension::kVideoTimingUri;
-}
-
-bool RtpExtension::IsEncryptionSupported(const std::string& uri) {
- return uri == webrtc::RtpExtension::kAudioLevelUri ||
- uri == webrtc::RtpExtension::kTimestampOffsetUri ||
-#if !defined(ENABLE_EXTERNAL_AUTH)
- // TODO(jbauch): Figure out a way to always allow "kAbsSendTimeUri"
- // here and filter out later if external auth is really used in
- // srtpfilter. External auth is used by Chromium and replaces the
- // extension header value of "kAbsSendTimeUri", so it must not be
- // encrypted (which can't be done by Chromium).
- uri == webrtc::RtpExtension::kAbsSendTimeUri ||
-#endif
- uri == webrtc::RtpExtension::kVideoRotationUri ||
- uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
- uri == webrtc::RtpExtension::kPlayoutDelayUri ||
- uri == webrtc::RtpExtension::kVideoContentTypeUri;
-}
-
-const RtpExtension* RtpExtension::FindHeaderExtensionByUri(
- const std::vector<RtpExtension>& extensions,
- const std::string& uri) {
- for (const auto& extension : extensions) {
- if (extension.uri == uri) {
- return &extension;
- }
- }
- return nullptr;
-}
-
-std::vector<RtpExtension> RtpExtension::FilterDuplicateNonEncrypted(
- const std::vector<RtpExtension>& extensions) {
- std::vector<RtpExtension> filtered;
- for (auto extension = extensions.begin(); extension != extensions.end();
- ++extension) {
- if (extension->encrypt) {
- filtered.push_back(*extension);
- continue;
- }
-
- // Only add non-encrypted extension if no encrypted with the same URI
- // is also present...
- if (std::find_if(extension + 1, extensions.end(),
- [extension](const RtpExtension& check) {
- return extension->uri == check.uri;
- }) != extensions.end()) {
- continue;
- }
-
- // ...and has not been added before.
- if (!FindHeaderExtensionByUri(filtered, extension->uri)) {
- filtered.push_back(*extension);
- }
- }
- return filtered;
-}
-} // namespace webrtc
diff --git a/api/rtpparameters.h b/api/rtpparameters.h
deleted file mode 100644
index 96e2955..0000000
--- a/api/rtpparameters.h
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * Copyright 2015 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 WEBRTC_API_RTPPARAMETERS_H_
-#define WEBRTC_API_RTPPARAMETERS_H_
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "webrtc/api/mediatypes.h"
-#include "webrtc/api/optional.h"
-
-namespace webrtc {
-
-// These structures are intended to mirror those defined by:
-// http://draft.ortc.org/#rtcrtpdictionaries*
-// Contains everything specified as of 2017 Jan 24.
-//
-// They are used when retrieving or modifying the parameters of an
-// RtpSender/RtpReceiver, or retrieving capabilities.
-//
-// Note on conventions: Where ORTC may use "octet", "short" and "unsigned"
-// types, we typically use "int", in keeping with our style guidelines. The
-// parameter's actual valid range will be enforced when the parameters are set,
-// rather than when the parameters struct is built. An exception is made for
-// SSRCs, since they use the full unsigned 32-bit range, and aren't expected to
-// be used for any numeric comparisons/operations.
-//
-// Additionally, where ORTC uses strings, we may use enums for things that have
-// a fixed number of supported values. However, for things that can be extended
-// (such as codecs, by providing an external encoder factory), a string
-// identifier is used.
-
-enum class FecMechanism {
- RED,
- RED_AND_ULPFEC,
- FLEXFEC,
-};
-
-// Used in RtcpFeedback struct.
-enum class RtcpFeedbackType {
- CCM,
- NACK,
- REMB, // "goog-remb"
- TRANSPORT_CC,
-};
-
-// Used in RtcpFeedback struct when type is NACK or CCM.
-enum class RtcpFeedbackMessageType {
- // Equivalent to {type: "nack", parameter: undefined} in ORTC.
- GENERIC_NACK,
- PLI, // Usable with NACK.
- FIR, // Usable with CCM.
-};
-
-enum class DtxStatus {
- DISABLED,
- ENABLED,
-};
-
-enum class DegradationPreference {
- MAINTAIN_FRAMERATE,
- MAINTAIN_RESOLUTION,
- BALANCED,
-};
-
-enum class PriorityType { VERY_LOW, LOW, MEDIUM, HIGH };
-
-struct RtcpFeedback {
- RtcpFeedbackType type = RtcpFeedbackType::CCM;
-
- // Equivalent to ORTC "parameter" field with slight differences:
- // 1. It's an enum instead of a string.
- // 2. Generic NACK feedback is represented by a GENERIC_NACK message type,
- // rather than an unset "parameter" value.
- rtc::Optional<RtcpFeedbackMessageType> message_type;
-
- // Constructors for convenience.
- RtcpFeedback();
- explicit RtcpFeedback(RtcpFeedbackType type);
- RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type);
- ~RtcpFeedback();
-
- bool operator==(const RtcpFeedback& o) const {
- return type == o.type && message_type == o.message_type;
- }
- bool operator!=(const RtcpFeedback& o) const { return !(*this == o); }
-};
-
-// RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to
-// RtpParameters. This represents the static capabilities of an endpoint's
-// implementation of a codec.
-struct RtpCodecCapability {
- RtpCodecCapability();
- ~RtpCodecCapability();
-
- // Build MIME "type/subtype" string from |name| and |kind|.
- std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; }
-
- // Used to identify the codec. Equivalent to MIME subtype.
- std::string name;
-
- // The media type of this codec. Equivalent to MIME top-level type.
- cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
-
- // Clock rate in Hertz. If unset, the codec is applicable to any clock rate.
- rtc::Optional<int> clock_rate;
-
- // Default payload type for this codec. Mainly needed for codecs that use
- // that have statically assigned payload types.
- rtc::Optional<int> preferred_payload_type;
-
- // Maximum packetization time supported by an RtpReceiver for this codec.
- // TODO(deadbeef): Not implemented.
- rtc::Optional<int> max_ptime;
-
- // Preferred packetization time for an RtpReceiver or RtpSender of this
- // codec.
- // TODO(deadbeef): Not implemented.
- rtc::Optional<int> ptime;
-
- // The number of audio channels supported. Unused for video codecs.
- rtc::Optional<int> num_channels;
-
- // Feedback mechanisms supported for this codec.
- std::vector<RtcpFeedback> rtcp_feedback;
-
- // Codec-specific parameters that must be signaled to the remote party.
- //
- // Corresponds to "a=fmtp" parameters in SDP.
- //
- // Contrary to ORTC, these parameters are named using all lowercase strings.
- // This helps make the mapping to SDP simpler, if an application is using
- // SDP. Boolean values are represented by the string "1".
- std::unordered_map<std::string, std::string> parameters;
-
- // Codec-specific parameters that may optionally be signaled to the remote
- // party.
- // TODO(deadbeef): Not implemented.
- std::unordered_map<std::string, std::string> options;
-
- // Maximum number of temporal layer extensions supported by this codec.
- // For example, a value of 1 indicates that 2 total layers are supported.
- // TODO(deadbeef): Not implemented.
- int max_temporal_layer_extensions = 0;
-
- // Maximum number of spatial layer extensions supported by this codec.
- // For example, a value of 1 indicates that 2 total layers are supported.
- // TODO(deadbeef): Not implemented.
- int max_spatial_layer_extensions = 0;
-
- // Whether the implementation can send/receive SVC layers with distinct
- // SSRCs. Always false for audio codecs. True for video codecs that support
- // scalable video coding with MRST.
- // TODO(deadbeef): Not implemented.
- bool svc_multi_stream_support = false;
-
- bool operator==(const RtpCodecCapability& o) const {
- return name == o.name && kind == o.kind && clock_rate == o.clock_rate &&
- preferred_payload_type == o.preferred_payload_type &&
- max_ptime == o.max_ptime && ptime == o.ptime &&
- num_channels == o.num_channels && rtcp_feedback == o.rtcp_feedback &&
- parameters == o.parameters && options == o.options &&
- max_temporal_layer_extensions == o.max_temporal_layer_extensions &&
- max_spatial_layer_extensions == o.max_spatial_layer_extensions &&
- svc_multi_stream_support == o.svc_multi_stream_support;
- }
- bool operator!=(const RtpCodecCapability& o) const { return !(*this == o); }
-};
-
-// Used in RtpCapabilities; represents the capabilities/preferences of an
-// implementation for a header extension.
-//
-// Just called "RtpHeaderExtension" in ORTC, but the "Capability" suffix was
-// added here for consistency and to avoid confusion with
-// RtpHeaderExtensionParameters.
-//
-// Note that ORTC includes a "kind" field, but we omit this because it's
-// redundant; if you call "RtpReceiver::GetCapabilities(MEDIA_TYPE_AUDIO)",
-// you know you're getting audio capabilities.
-struct RtpHeaderExtensionCapability {
- // URI of this extension, as defined in RFC5285.
- std::string uri;
-
- // Preferred value of ID that goes in the packet.
- rtc::Optional<int> preferred_id;
-
- // If true, it's preferred that the value in the header is encrypted.
- // TODO(deadbeef): Not implemented.
- bool preferred_encrypt = false;
-
- // Constructors for convenience.
- RtpHeaderExtensionCapability();
- explicit RtpHeaderExtensionCapability(const std::string& uri);
- RtpHeaderExtensionCapability(const std::string& uri, int preferred_id);
- ~RtpHeaderExtensionCapability();
-
- bool operator==(const RtpHeaderExtensionCapability& o) const {
- return uri == o.uri && preferred_id == o.preferred_id &&
- preferred_encrypt == o.preferred_encrypt;
- }
- bool operator!=(const RtpHeaderExtensionCapability& o) const {
- return !(*this == o);
- }
-};
-
-// RTP header extension, see RFC 5285.
-struct RtpExtension {
- RtpExtension();
- RtpExtension(const std::string& uri, int id);
- RtpExtension(const std::string& uri, int id, bool encrypt);
- ~RtpExtension();
- std::string ToString() const;
- bool operator==(const RtpExtension& rhs) const {
- return uri == rhs.uri && id == rhs.id && encrypt == rhs.encrypt;
- }
- static bool IsSupportedForAudio(const std::string& uri);
- static bool IsSupportedForVideo(const std::string& uri);
- // Return "true" if the given RTP header extension URI may be encrypted.
- static bool IsEncryptionSupported(const std::string& uri);
-
- // Returns the named header extension if found among all extensions,
- // nullptr otherwise.
- static const RtpExtension* FindHeaderExtensionByUri(
- const std::vector<RtpExtension>& extensions,
- const std::string& uri);
-
- // Return a list of RTP header extensions with the non-encrypted extensions
- // removed if both the encrypted and non-encrypted extension is present for
- // the same URI.
- static std::vector<RtpExtension> FilterDuplicateNonEncrypted(
- const std::vector<RtpExtension>& extensions);
-
- // Header extension for audio levels, as defined in:
- // http://tools.ietf.org/html/draft-ietf-avtext-client-to-mixer-audio-level-03
- static const char kAudioLevelUri[];
- static const int kAudioLevelDefaultId;
-
- // Header extension for RTP timestamp offset, see RFC 5450 for details:
- // http://tools.ietf.org/html/rfc5450
- static const char kTimestampOffsetUri[];
- static const int kTimestampOffsetDefaultId;
-
- // Header extension for absolute send time, see url for details:
- // http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
- static const char kAbsSendTimeUri[];
- static const int kAbsSendTimeDefaultId;
-
- // Header extension for coordination of video orientation, see url for
- // details:
- // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf
- static const char kVideoRotationUri[];
- static const int kVideoRotationDefaultId;
-
- // Header extension for video content type. E.g. default or screenshare.
- static const char kVideoContentTypeUri[];
- static const int kVideoContentTypeDefaultId;
-
- // Header extension for video timing.
- static const char kVideoTimingUri[];
- static const int kVideoTimingDefaultId;
-
- // Header extension for transport sequence number, see url for details:
- // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
- static const char kTransportSequenceNumberUri[];
- static const int kTransportSequenceNumberDefaultId;
-
- static const char kPlayoutDelayUri[];
- static const int kPlayoutDelayDefaultId;
-
- // Encryption of Header Extensions, see RFC 6904 for details:
- // https://tools.ietf.org/html/rfc6904
- static const char kEncryptHeaderExtensionsUri[];
-
- // Inclusive min and max IDs for one-byte header extensions, per RFC5285.
- static const int kMinId;
- static const int kMaxId;
-
- std::string uri;
- int id = 0;
- bool encrypt = false;
-};
-
-// TODO(deadbeef): This is missing the "encrypt" flag, which is unimplemented.
-typedef RtpExtension RtpHeaderExtensionParameters;
-
-struct RtpFecParameters {
- // If unset, a value is chosen by the implementation.
- // Works just like RtpEncodingParameters::ssrc.
- rtc::Optional<uint32_t> ssrc;
-
- FecMechanism mechanism = FecMechanism::RED;
-
- // Constructors for convenience.
- RtpFecParameters();
- explicit RtpFecParameters(FecMechanism mechanism);
- RtpFecParameters(FecMechanism mechanism, uint32_t ssrc);
- ~RtpFecParameters();
-
- bool operator==(const RtpFecParameters& o) const {
- return ssrc == o.ssrc && mechanism == o.mechanism;
- }
- bool operator!=(const RtpFecParameters& o) const { return !(*this == o); }
-};
-
-struct RtpRtxParameters {
- // If unset, a value is chosen by the implementation.
- // Works just like RtpEncodingParameters::ssrc.
- rtc::Optional<uint32_t> ssrc;
-
- // Constructors for convenience.
- RtpRtxParameters();
- explicit RtpRtxParameters(uint32_t ssrc);
- ~RtpRtxParameters();
-
- bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; }
- bool operator!=(const RtpRtxParameters& o) const { return !(*this == o); }
-};
-
-struct RtpEncodingParameters {
- RtpEncodingParameters();
- ~RtpEncodingParameters();
-
- // If unset, a value is chosen by the implementation.
- //
- // Note that the chosen value is NOT returned by GetParameters, because it
- // may change due to an SSRC conflict, in which case the conflict is handled
- // internally without any event. Another way of looking at this is that an
- // unset SSRC acts as a "wildcard" SSRC.
- rtc::Optional<uint32_t> ssrc;
-
- // Can be used to reference a codec in the |codecs| member of the
- // RtpParameters that contains this RtpEncodingParameters. If unset, the
- // implementation will choose the first possible codec (if a sender), or
- // prepare to receive any codec (for a receiver).
- // TODO(deadbeef): Not implemented. Implementation of RtpSender will always
- // choose the first codec from the list.
- rtc::Optional<int> codec_payload_type;
-
- // Specifies the FEC mechanism, if set.
- // TODO(deadbeef): Not implemented. Current implementation will use whatever
- // FEC codecs are available, including red+ulpfec.
- rtc::Optional<RtpFecParameters> fec;
-
- // Specifies the RTX parameters, if set.
- // TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
- rtc::Optional<RtpRtxParameters> rtx;
-
- // Only used for audio. If set, determines whether or not discontinuous
- // transmission will be used, if an available codec supports it. If not
- // set, the implementation default setting will be used.
- // TODO(deadbeef): Not implemented. Current implementation will use a CN
- // codec as long as it's present.
- rtc::Optional<DtxStatus> dtx;
-
- // The relative priority of this encoding.
- // TODO(deadbeef): Not implemented.
- rtc::Optional<PriorityType> priority;
-
- // If set, this represents the Transport Independent Application Specific
- // maximum bandwidth defined in RFC3890. If unset, there is no maximum
- // bitrate.
- //
- // Just called "maxBitrate" in ORTC spec.
- //
- // TODO(deadbeef): With ORTC RtpSenders, this currently sets the total
- // bandwidth for the entire bandwidth estimator (audio and video). This is
- // just always how "b=AS" was handled, but it's not correct and should be
- // fixed.
- rtc::Optional<int> max_bitrate_bps;
-
- // TODO(deadbeef): Not implemented.
- rtc::Optional<int> max_framerate;
-
- // For video, scale the resolution down by this factor.
- // TODO(deadbeef): Not implemented.
- double scale_resolution_down_by = 1.0;
-
- // Scale the framerate down by this factor.
- // TODO(deadbeef): Not implemented.
- double scale_framerate_down_by = 1.0;
-
- // For an RtpSender, set to true to cause this encoding to be sent, and false
- // for it not to be sent. For an RtpReceiver, set to true to cause the
- // encoding to be decoded, and false for it to be ignored.
- // TODO(deadbeef): Not implemented for PeerConnection RtpReceivers.
- bool active = true;
-
- // Value to use for RID RTP header extension.
- // Called "encodingId" in ORTC.
- // TODO(deadbeef): Not implemented.
- std::string rid;
-
- // RIDs of encodings on which this layer depends.
- // Called "dependencyEncodingIds" in ORTC spec.
- // TODO(deadbeef): Not implemented.
- std::vector<std::string> dependency_rids;
-
- bool operator==(const RtpEncodingParameters& o) const {
- return ssrc == o.ssrc && codec_payload_type == o.codec_payload_type &&
- fec == o.fec && rtx == o.rtx && dtx == o.dtx &&
- priority == o.priority && max_bitrate_bps == o.max_bitrate_bps &&
- max_framerate == o.max_framerate &&
- scale_resolution_down_by == o.scale_resolution_down_by &&
- scale_framerate_down_by == o.scale_framerate_down_by &&
- active == o.active && rid == o.rid &&
- dependency_rids == o.dependency_rids;
- }
- bool operator!=(const RtpEncodingParameters& o) const {
- return !(*this == o);
- }
-};
-
-struct RtpCodecParameters {
- RtpCodecParameters();
- ~RtpCodecParameters();
-
- // Build MIME "type/subtype" string from |name| and |kind|.
- std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; }
-
- // Used to identify the codec. Equivalent to MIME subtype.
- std::string name;
-
- // The media type of this codec. Equivalent to MIME top-level type.
- cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
-
- // Payload type used to identify this codec in RTP packets.
- // This must always be present, and must be unique across all codecs using
- // the same transport.
- int payload_type = 0;
-
- // If unset, the implementation default is used.
- rtc::Optional<int> clock_rate;
-
- // The number of audio channels used. Unset for video codecs. If unset for
- // audio, the implementation default is used.
- // TODO(deadbeef): The "implementation default" part isn't fully implemented.
- // Only defaults to 1, even though some codecs (such as opus) should really
- // default to 2.
- rtc::Optional<int> num_channels;
-
- // The maximum packetization time to be used by an RtpSender.
- // If |ptime| is also set, this will be ignored.
- // TODO(deadbeef): Not implemented.
- rtc::Optional<int> max_ptime;
-
- // The packetization time to be used by an RtpSender.
- // If unset, will use any time up to max_ptime.
- // TODO(deadbeef): Not implemented.
- rtc::Optional<int> ptime;
-
- // Feedback mechanisms to be used for this codec.
- // TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
- std::vector<RtcpFeedback> rtcp_feedback;
-
- // Codec-specific parameters that must be signaled to the remote party.
- //
- // Corresponds to "a=fmtp" parameters in SDP.
- //
- // Contrary to ORTC, these parameters are named using all lowercase strings.
- // This helps make the mapping to SDP simpler, if an application is using
- // SDP. Boolean values are represented by the string "1".
- //
- // TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
- std::unordered_map<std::string, std::string> parameters;
-