blob: 1f4c475c406428b771634cdefc3541e6937dfc72 [file] [log] [blame]
solenbergdb3c9b02017-06-28 02:05:04 -07001/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
solenbergdb3c9b02017-06-28 02:05:04 -070012
13#include <memory>
14#include <vector>
15
Karl Wiberg918f50c2018-07-05 11:40:33 +020016#include "absl/memory/memory.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020017#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
solenbergdb3c9b02017-06-28 02:05:04 -070019
20namespace webrtc {
21
Danil Chapovalov0bc58cf2018-06-21 13:32:56 +020022absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
solenbergdb3c9b02017-06-28 02:05:04 -070023 const SdpAudioFormat& format) {
kwiberge5eb7242017-08-25 03:10:50 -070024 return STR_CASE_CMP(format.name.c_str(), "ILBC") == 0 &&
solenbergdb3c9b02017-06-28 02:05:04 -070025 format.clockrate_hz == 8000 && format.num_channels == 1
Danil Chapovalov0bc58cf2018-06-21 13:32:56 +020026 ? absl::optional<Config>(Config())
27 : absl::nullopt;
solenbergdb3c9b02017-06-28 02:05:04 -070028}
29
30void AudioDecoderIlbc::AppendSupportedDecoders(
31 std::vector<AudioCodecSpec>* specs) {
32 specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}});
33}
34
35std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
Karl Wiberg17668ec2018-03-01 15:13:27 +010036 Config config,
Danil Chapovalov0bc58cf2018-06-21 13:32:56 +020037 absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
Karl Wiberg918f50c2018-07-05 11:40:33 +020038 return absl::make_unique<AudioDecoderIlbcImpl>();
solenbergdb3c9b02017-06-28 02:05:04 -070039}
40
41} // namespace webrtc