blob: dc1775189eb425a2cd64c43ec18d022cb0c19b9a [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
11#include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h"
12
13#include <memory>
14#include <vector>
15
solenbergdb3c9b02017-06-28 02:05:04 -070016#include "webrtc/common_types.h"
17#include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020018#include "webrtc/rtc_base/ptr_util.h"
solenbergdb3c9b02017-06-28 02:05:04 -070019
20namespace webrtc {
21
22rtc::Optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
23 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
26 ? rtc::Optional<Config>(Config())
27 : rtc::Optional<Config>();
28}
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(
36 Config config) {
37 return rtc::MakeUnique<AudioDecoderIlbcImpl>();
38}
39
40} // namespace webrtc