solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "api/audio_codecs/ilbc/audio_decoder_ilbc.h" |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 12 | |
| 13 | #include <memory> |
| 14 | #include <vector> |
| 15 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame] | 16 | #include "common_types.h" // NOLINT(build/include) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" |
| 18 | #include "rtc_base/ptr_util.h" |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | rtc::Optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig( |
| 23 | const SdpAudioFormat& format) { |
kwiberg | e5eb724 | 2017-08-25 03:10:50 -0700 | [diff] [blame] | 24 | return STR_CASE_CMP(format.name.c_str(), "ILBC") == 0 && |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 25 | format.clockrate_hz == 8000 && format.num_channels == 1 |
| 26 | ? rtc::Optional<Config>(Config()) |
Oskar Sundbom | 9065730 | 2017-11-16 10:52:34 +0100 | [diff] [blame] | 27 | : rtc::nullopt; |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | void AudioDecoderIlbc::AppendSupportedDecoders( |
| 31 | std::vector<AudioCodecSpec>* specs) { |
| 32 | specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}}); |
| 33 | } |
| 34 | |
| 35 | std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder( |
Karl Wiberg | 17668ec | 2018-03-01 15:13:27 +0100 | [diff] [blame] | 36 | Config config, |
| 37 | rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) { |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 38 | return rtc::MakeUnique<AudioDecoderIlbcImpl>(); |
| 39 | } |
| 40 | |
| 41 | } // namespace webrtc |