diff --git a/webrtc/api/audio_codecs/L16/BUILD.gn b/webrtc/api/audio_codecs/L16/BUILD.gn deleted file mode 100644 index db61713c5d..0000000000 --- a/webrtc/api/audio_codecs/L16/BUILD.gn +++ /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. - -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", - "../../..: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", - "../../..:webrtc_common", - "../../../modules/audio_coding:pcm16b", - "../../../rtc_base:rtc_base_approved", - ] -} diff --git a/webrtc/api/audio_codecs/L16/audio_decoder_L16.cc b/webrtc/api/audio_codecs/L16/audio_decoder_L16.cc deleted file mode 100644 index 7a553deb40..0000000000 --- a/webrtc/api/audio_codecs/L16/audio_decoder_L16.cc +++ /dev/null @@ -1,42 +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" - -namespace webrtc { - -rtc::Optional AudioDecoderL16::SdpToConfig( - const SdpAudioFormat& format) { - Config config; - config.sample_rate_hz = format.clockrate_hz; - config.num_channels = format.num_channels; - return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk() - ? rtc::Optional(config) - : rtc::Optional(); -} - -void AudioDecoderL16::AppendSupportedDecoders( - std::vector* specs) { - Pcm16BAppendSupportedCodecSpecs(specs); -} - -std::unique_ptr AudioDecoderL16::MakeAudioDecoder( - const Config& config) { - return config.IsOk() ? rtc::MakeUnique( - config.sample_rate_hz, config.num_channels) - : nullptr; -} - -} // namespace webrtc diff --git a/webrtc/api/audio_codecs/L16/audio_decoder_L16.h b/webrtc/api/audio_codecs/L16/audio_decoder_L16.h deleted file mode 100644 index 478da16abe..0000000000 --- a/webrtc/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 -#include - -#include "webrtc/api/audio_codecs/audio_decoder.h" -#include "webrtc/api/audio_codecs/audio_format.h" -#include "webrtc/rtc_base/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 SdpToConfig(const SdpAudioFormat& audio_format); - static void AppendSupportedDecoders(std::vector* specs); - static std::unique_ptr MakeAudioDecoder(const Config& config); -}; - -} // namespace webrtc - -#endif // WEBRTC_API_AUDIO_CODECS_L16_AUDIO_DECODER_L16_H_ diff --git a/webrtc/api/audio_codecs/L16/audio_encoder_L16.cc b/webrtc/api/audio_codecs/L16/audio_encoder_L16.cc deleted file mode 100644 index bd243897a1..0000000000 --- a/webrtc/api/audio_codecs/L16/audio_encoder_L16.cc +++ /dev/null @@ -1,55 +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" - -namespace webrtc { - -rtc::Optional AudioEncoderL16::SdpToConfig( - const SdpAudioFormat& format) { - Config config; - config.sample_rate_hz = format.clockrate_hz; - config.num_channels = format.num_channels; - return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk() - ? rtc::Optional(config) - : rtc::Optional(); -} - -void AudioEncoderL16::AppendSupportedEncoders( - std::vector* specs) { - Pcm16BAppendSupportedCodecSpecs(specs); -} - -AudioCodecInfo AudioEncoderL16::QueryAudioEncoder( - const AudioEncoderL16::Config& config) { - RTC_DCHECK(config.IsOk()); - return {config.sample_rate_hz, - rtc::dchecked_cast(config.num_channels), - config.sample_rate_hz * config.num_channels * 16}; -} - -std::unique_ptr 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(c); -} - -} // namespace webrtc diff --git a/webrtc/api/audio_codecs/L16/audio_encoder_L16.h b/webrtc/api/audio_codecs/L16/audio_encoder_L16.h deleted file mode 100644 index e2e4019f21..0000000000 --- a/webrtc/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 -#include - -#include "webrtc/api/audio_codecs/audio_encoder.h" -#include "webrtc/api/audio_codecs/audio_format.h" -#include "webrtc/rtc_base/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 SdpToConfig(const SdpAudioFormat& audio_format); - static void AppendSupportedEncoders(std::vector* specs); - static AudioCodecInfo QueryAudioEncoder(const Config& config); - static std::unique_ptr MakeAudioEncoder(const Config& config, - int payload_type); -}; - -} // namespace webrtc - -#endif // WEBRTC_API_AUDIO_CODECS_L16_AUDIO_ENCODER_L16_H_ diff --git a/webrtc/api/audio_codecs/test/BUILD.gn b/webrtc/api/audio_codecs/test/BUILD.gn index 882ac033e7..83ea44e2f5 100644 --- a/webrtc/api/audio_codecs/test/BUILD.gn +++ b/webrtc/api/audio_codecs/test/BUILD.gn @@ -25,8 +25,6 @@ if (rtc_include_tests) { "../../../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", diff --git a/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc b/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc index da261ac5b3..ee754d4a9b 100644 --- a/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc +++ b/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc @@ -9,7 +9,6 @@ */ #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" @@ -166,26 +165,6 @@ TEST(AudioDecoderFactoryTemplateTest, Ilbc) { EXPECT_EQ(8000, dec->SampleRateHz()); } -TEST(AudioDecoderFactoryTemplateTest, L16) { - auto factory = CreateAudioDecoderFactory(); - 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(); AudioCodecInfo opus_info{48000, 1, 64000, 6000, 510000}; diff --git a/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc b/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc index 19c3071bef..58ab28ea41 100644 --- a/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc +++ b/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc @@ -9,7 +9,6 @@ */ #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" @@ -171,27 +170,6 @@ TEST(AudioEncoderFactoryTemplateTest, Ilbc) { EXPECT_EQ(8000, enc->SampleRateHz()); } -TEST(AudioEncoderFactoryTemplateTest, L16) { - auto factory = CreateAudioEncoderFactory(); - 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(), - factory->QueryAudioEncoder({"L16", 8000, 0})); - EXPECT_EQ(rtc::Optional({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(); AudioCodecInfo info = {48000, 1, 32000, 6000, 510000}; diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 3e6a183486..a6da30e0fe 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -792,8 +792,6 @@ rtc_static_library("pcm16b") { "codecs/pcm16b/audio_decoder_pcm16b.h", "codecs/pcm16b/audio_encoder_pcm16b.cc", "codecs/pcm16b/audio_encoder_pcm16b.h", - "codecs/pcm16b/pcm16b_common.cc", - "codecs/pcm16b/pcm16b_common.h", ] deps = [ diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.cc b/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.cc deleted file mode 100644 index a1b156dcc0..0000000000 --- a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.cc +++ /dev/null @@ -1,25 +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/modules/audio_coding/codecs/pcm16b/pcm16b_common.h" - -namespace webrtc { - -void Pcm16BAppendSupportedCodecSpecs(std::vector* specs) { - for (size_t num_channels : {1, 2}) { - for (int sample_rate_hz : {8000, 16000, 32000}) { - specs->push_back( - {{"L16", sample_rate_hz, num_channels}, - {sample_rate_hz, num_channels, sample_rate_hz * num_channels * 16}}); - } - } -} - -} // namespace webrtc diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h b/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h deleted file mode 100644 index 5d764c9609..0000000000 --- a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h +++ /dev/null @@ -1,22 +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_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_COMMON_H_ -#define WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_COMMON_H_ - -#include - -#include "webrtc/api/audio_codecs/audio_decoder_factory.h" - -namespace webrtc { -void Pcm16BAppendSupportedCodecSpecs(std::vector* specs); -} - -#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_COMMON_H_