xref: /aosp_15_r20/external/webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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   if (absl::EqualsIgnoreCase(format.name, "ILBC") &&
24       format.clockrate_hz == 8000 && format.num_channels == 1) {
25     return Config();
26   }
27   return absl::nullopt;
28 }
29 
AppendSupportedDecoders(std::vector<AudioCodecSpec> * specs)30 void AudioDecoderIlbc::AppendSupportedDecoders(
31     std::vector<AudioCodecSpec>* specs) {
32   specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}});
33 }
34 
MakeAudioDecoder(Config config,absl::optional<AudioCodecPairId>,const FieldTrialsView * field_trials)35 std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
36     Config config,
37     absl::optional<AudioCodecPairId> /*codec_pair_id*/,
38     const FieldTrialsView* field_trials) {
39   return std::make_unique<AudioDecoderIlbcImpl>();
40 }
41 
42 }  // namespace webrtc
43