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/isac/audio_decoder_isac_fix.h"
12
13 #include <memory>
14
15 #include "absl/strings/match.h"
16 #include "modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h"
17
18 namespace webrtc {
19
SdpToConfig(const SdpAudioFormat & format)20 absl::optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
21 const SdpAudioFormat& format) {
22 return absl::EqualsIgnoreCase(format.name, "ISAC") &&
23 format.clockrate_hz == 16000 && format.num_channels == 1
24 ? absl::optional<Config>(Config())
25 : absl::nullopt;
26 }
27
AppendSupportedDecoders(std::vector<AudioCodecSpec> * specs)28 void AudioDecoderIsacFix::AppendSupportedDecoders(
29 std::vector<AudioCodecSpec>* specs) {
30 specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}});
31 }
32
MakeAudioDecoder(Config config,absl::optional<AudioCodecPairId>)33 std::unique_ptr<AudioDecoder> AudioDecoderIsacFix::MakeAudioDecoder(
34 Config config,
35 absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
36 AudioDecoderIsacFixImpl::Config c;
37 c.sample_rate_hz = 16000;
38 return std::make_unique<AudioDecoderIsacFixImpl>(c);
39 }
40
41 } // namespace webrtc
42