2017-02-10 08:15:44 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
2017-02-10 08:15:44 -08:00
|
|
|
|
2017-08-25 03:10:50 -07:00
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2024-06-17 12:27:24 +00:00
|
|
|
#include "absl/types/optional.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/L16/audio_decoder_L16.h"
|
2024-06-17 12:27:24 +00:00
|
|
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
|
|
|
|
#include "api/audio_codecs/audio_decoder.h"
|
|
|
|
|
#include "api/audio_codecs/audio_decoder_factory.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/audio_decoder_factory_template.h"
|
2024-06-17 12:27:24 +00:00
|
|
|
#include "api/audio_codecs/audio_format.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/g711/audio_decoder_g711.h"
|
2017-11-01 15:08:12 +01:00
|
|
|
#include "api/audio_codecs/g722/audio_decoder_g722.h"
|
2024-06-17 12:27:24 +00:00
|
|
|
#include "api/scoped_refptr.h"
|
2017-08-25 03:10:50 -07:00
|
|
|
#if WEBRTC_USE_BUILTIN_ILBC
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h" // nogncheck
|
2017-08-25 03:10:50 -07:00
|
|
|
#endif
|
|
|
|
|
#if WEBRTC_USE_BUILTIN_OPUS
|
2019-04-08 17:19:41 +02:00
|
|
|
#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck
|
2017-08-25 03:10:50 -07:00
|
|
|
#endif
|
2017-02-10 08:15:44 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2017-08-25 03:10:50 -07:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
// Modify an audio decoder to not advertise support for anything.
|
|
|
|
|
template <typename T>
|
|
|
|
|
struct NotAdvertised {
|
|
|
|
|
using Config = typename T::Config;
|
2018-06-21 13:32:56 +02:00
|
|
|
static absl::optional<Config> SdpToConfig(
|
|
|
|
|
const SdpAudioFormat& audio_format) {
|
2017-08-25 03:10:50 -07:00
|
|
|
return T::SdpToConfig(audio_format);
|
|
|
|
|
}
|
|
|
|
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
|
|
|
|
|
// Don't advertise support for anything.
|
|
|
|
|
}
|
2018-03-01 15:13:27 +01:00
|
|
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
|
|
|
|
const Config& config,
|
2018-06-21 13:32:56 +02:00
|
|
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
|
2018-03-01 15:13:27 +01:00
|
|
|
return T::MakeAudioDecoder(config, codec_pair_id);
|
2017-08-25 03:10:50 -07:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2017-02-10 08:15:44 -08:00
|
|
|
rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() {
|
2017-08-25 03:10:50 -07:00
|
|
|
return CreateAudioDecoderFactory<
|
|
|
|
|
|
|
|
|
|
#if WEBRTC_USE_BUILTIN_OPUS
|
2019-04-08 17:19:41 +02:00
|
|
|
AudioDecoderOpus, NotAdvertised<AudioDecoderMultiChannelOpus>,
|
2017-08-25 03:10:50 -07:00
|
|
|
#endif
|
|
|
|
|
|
2022-11-11 16:52:46 +01:00
|
|
|
AudioDecoderG722,
|
2017-08-25 03:10:50 -07:00
|
|
|
|
|
|
|
|
#if WEBRTC_USE_BUILTIN_ILBC
|
|
|
|
|
AudioDecoderIlbc,
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
AudioDecoderG711, NotAdvertised<AudioDecoderL16>>();
|
2017-02-10 08:15:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|