Revert of L16 implementation of the Audio{En,De}coderFactoryTemplate APIs (patchset #5 id:80001 of https://codereview.webrtc.org/2995523002/ )

Reason for revert:
Breaks compilation in google3.

Original issue's description:
> L16 implementation of the Audio{En,De}coderFactoryTemplate APIs
>
> BUG=webrtc:7836, webrtc:7842
>
> Review-Url: https://codereview.webrtc.org/2995523002
> Cr-Commit-Position: refs/heads/master@{#19354}
> Committed: edff94df62

TBR=ossu@webrtc.org,kwiberg@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7836, webrtc:7842

Review-Url: https://codereview.webrtc.org/2996993002
Cr-Commit-Position: refs/heads/master@{#19356}
This commit is contained in:
charujain
2017-08-15 07:50:11 -07:00
committed by Commit Bot
parent 8e8f0e26b9
commit ac31526bb5
11 changed files with 0 additions and 322 deletions

View File

@ -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",
]
}

View File

@ -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::Config> 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>(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

View File

@ -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/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<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_

View File

@ -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::Config> 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>(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

View File

@ -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/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<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_

View File

@ -25,8 +25,6 @@ if (rtc_include_tests) {
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
"../../../test:audio_codec_mocks", "../../../test:audio_codec_mocks",
"../../../test:test_support", "../../../test:test_support",
"../L16:audio_decoder_L16",
"../L16:audio_encoder_L16",
"../g711:audio_decoder_g711", "../g711:audio_decoder_g711",
"../g711:audio_encoder_g711", "../g711:audio_encoder_g711",
"../g722:audio_decoder_g722", "../g722:audio_decoder_g722",

View File

@ -9,7 +9,6 @@
*/ */
#include "webrtc/api/audio_codecs/audio_decoder_factory_template.h" #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/g711/audio_decoder_g711.h"
#include "webrtc/api/audio_codecs/g722/audio_decoder_g722.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/ilbc/audio_decoder_ilbc.h"
@ -166,26 +165,6 @@ TEST(AudioDecoderFactoryTemplateTest, Ilbc) {
EXPECT_EQ(8000, dec->SampleRateHz()); EXPECT_EQ(8000, dec->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) { TEST(AudioDecoderFactoryTemplateTest, Opus) {
auto factory = CreateAudioDecoderFactory<AudioDecoderOpus>(); auto factory = CreateAudioDecoderFactory<AudioDecoderOpus>();
AudioCodecInfo opus_info{48000, 1, 64000, 6000, 510000}; AudioCodecInfo opus_info{48000, 1, 64000, 6000, 510000};

View File

@ -9,7 +9,6 @@
*/ */
#include "webrtc/api/audio_codecs/audio_encoder_factory_template.h" #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/g711/audio_encoder_g711.h"
#include "webrtc/api/audio_codecs/g722/audio_encoder_g722.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/ilbc/audio_encoder_ilbc.h"
@ -171,27 +170,6 @@ TEST(AudioEncoderFactoryTemplateTest, Ilbc) {
EXPECT_EQ(8000, enc->SampleRateHz()); EXPECT_EQ(8000, enc->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) { TEST(AudioEncoderFactoryTemplateTest, Opus) {
auto factory = CreateAudioEncoderFactory<AudioEncoderOpus>(); auto factory = CreateAudioEncoderFactory<AudioEncoderOpus>();
AudioCodecInfo info = {48000, 1, 32000, 6000, 510000}; AudioCodecInfo info = {48000, 1, 32000, 6000, 510000};

View File

@ -792,8 +792,6 @@ rtc_static_library("pcm16b") {
"codecs/pcm16b/audio_decoder_pcm16b.h", "codecs/pcm16b/audio_decoder_pcm16b.h",
"codecs/pcm16b/audio_encoder_pcm16b.cc", "codecs/pcm16b/audio_encoder_pcm16b.cc",
"codecs/pcm16b/audio_encoder_pcm16b.h", "codecs/pcm16b/audio_encoder_pcm16b.h",
"codecs/pcm16b/pcm16b_common.cc",
"codecs/pcm16b/pcm16b_common.h",
] ]
deps = [ deps = [

View File

@ -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<AudioCodecSpec>* 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

View File

@ -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 <vector>
#include "webrtc/api/audio_codecs/audio_decoder_factory.h"
namespace webrtc {
void Pcm16BAppendSupportedCodecSpecs(std::vector<AudioCodecSpec>* specs);
}
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_COMMON_H_