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 | |
Niels Möller | 2edab4c | 2018-10-22 09:48:08 +0200 | [diff] [blame] | 16 | #include "absl/strings/match.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 21 | absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig( |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 22 | const SdpAudioFormat& format) { |
Niels Möller | 2edab4c | 2018-10-22 09:48:08 +0200 | [diff] [blame] | 23 | return absl::EqualsIgnoreCase(format.name, "ILBC") && |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 24 | format.clockrate_hz == 8000 && format.num_channels == 1 |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 25 | ? absl::optional<Config>(Config()) |
| 26 | : absl::nullopt; |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | void AudioDecoderIlbc::AppendSupportedDecoders( |
| 30 | std::vector<AudioCodecSpec>* specs) { |
| 31 | specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}}); |
| 32 | } |
| 33 | |
| 34 | std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder( |
Karl Wiberg | 17668ec | 2018-03-01 15:13:27 +0100 | [diff] [blame] | 35 | Config config, |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 36 | absl::optional<AudioCodecPairId> /*codec_pair_id*/) { |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame^] | 37 | return std::make_unique<AudioDecoderIlbcImpl>(); |
solenberg | db3c9b0 | 2017-06-28 02:05:04 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | } // namespace webrtc |