Expose ILBC codec in webrtc/api/audio_codecs/

BUG=webrtc:7834, webrtc:7840

Review-Url: https://codereview.webrtc.org/2951873002
Cr-Commit-Position: refs/heads/master@{#18803}
This commit is contained in:
solenberg
2017-06-28 02:05:04 -07:00
committed by Commit Bot
parent cd9dd458d0
commit db3c9b0f72
21 changed files with 390 additions and 110 deletions

View File

@ -17,11 +17,11 @@ namespace webrtc {
TEST(IlbcTest, BadPacket) {
// Get a good packet.
AudioEncoderIlbc::Config config;
AudioEncoderIlbcConfig config;
config.frame_size_ms = 20; // We need 20 ms rather than the default 30 ms;
// otherwise, all possible values of cb_index[2]
// are valid.
AudioEncoderIlbc encoder(config);
AudioEncoderIlbcImpl encoder(config, 102);
std::vector<int16_t> samples(encoder.SampleRateHz() / 100, 4711);
rtc::Buffer packet;
int num_10ms_chunks = 0;
@ -39,7 +39,7 @@ TEST(IlbcTest, BadPacket) {
bad_packet[30] |= 0x80; // Bit 0.
// Decode the bad packet. We expect the decoder to respond by returning -1.
AudioDecoderIlbc decoder;
AudioDecoderIlbcImpl decoder;
std::vector<int16_t> decoded_samples(num_10ms_chunks * samples.size());
AudioDecoder::SpeechType speech_type;
EXPECT_EQ(-1, decoder.Decode(bad_packet.data(), bad_packet.size(),
@ -69,7 +69,7 @@ class SplitIlbcTest : public ::testing::TestWithParam<std::pair<int, int> > {
};
TEST_P(SplitIlbcTest, NumFrames) {
AudioDecoderIlbc decoder;
AudioDecoderIlbcImpl decoder;
const size_t frame_length_samples = frame_length_ms_ * 8;
const auto generate_payload = [] (size_t payload_length_bytes) {
rtc::Buffer payload(payload_length_bytes);
@ -120,7 +120,7 @@ INSTANTIATE_TEST_CASE_P(
// Test too large payload size.
TEST(IlbcTest, SplitTooLargePayload) {
AudioDecoderIlbc decoder;
AudioDecoderIlbcImpl decoder;
constexpr size_t kPayloadLengthBytes = 950;
const auto results =
decoder.ParsePayload(rtc::Buffer(kPayloadLengthBytes), 0);
@ -129,7 +129,7 @@ TEST(IlbcTest, SplitTooLargePayload) {
// Payload not an integer number of frames.
TEST(IlbcTest, SplitUnevenPayload) {
AudioDecoderIlbc decoder;
AudioDecoderIlbcImpl decoder;
constexpr size_t kPayloadLengthBytes = 39; // Not an even number of frames.
const auto results =
decoder.ParsePayload(rtc::Buffer(kPayloadLengthBytes), 0);