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 
11 #include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
12 
13 #include <memory>
14 #include <vector>
15 
16 #include "absl/strings/match.h"
17 #include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
18 
19 namespace webrtc {
20 
SdpToConfig(const SdpAudioFormat & format)21 absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
22     const SdpAudioFormat& format) {
23   return absl::EqualsIgnoreCase(format.name, "ILBC") &&
24                  format.clockrate_hz == 8000 && format.num_channels == 1
25              ? absl::optional<Config>(Config())
26              : absl::nullopt;
27 }
28 
AppendSupportedDecoders(std::vector<AudioCodecSpec> * specs)29 void AudioDecoderIlbc::AppendSupportedDecoders(
30     std::vector<AudioCodecSpec>* specs) {
31   specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}});
32 }
33 
MakeAudioDecoder(Config config,absl::optional<AudioCodecPairId>)34 std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
35     Config config,
36     absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
37   return std::make_unique<AudioDecoderIlbcImpl>();
38 }
39 
40 }  // namespace webrtc
41