OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 11 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
12 | 12 |
13 #include <memory> | 13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_inter
nal.h" |
14 #include <vector> | |
15 | |
16 #include "webrtc/api/audio_codecs/L16/audio_decoder_L16.h" | |
17 #include "webrtc/api/audio_codecs/audio_decoder_factory_template.h" | |
18 #include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h" | |
19 #if WEBRTC_USE_BUILTIN_G722 | |
20 #include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h" // nogncheck | |
21 #endif | |
22 #if WEBRTC_USE_BUILTIN_ILBC | |
23 #include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h" // nogncheck | |
24 #endif | |
25 #if WEBRTC_USE_BUILTIN_ISAC_FIX | |
26 #include "webrtc/api/audio_codecs/isac/audio_decoder_isac_fix.h" // nogncheck | |
27 #elif WEBRTC_USE_BUILTIN_ISAC_FLOAT | |
28 #include "webrtc/api/audio_codecs/isac/audio_decoder_isac_float.h" // nogncheck | |
29 #endif | |
30 #if WEBRTC_USE_BUILTIN_OPUS | |
31 #include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck | |
32 #endif | |
33 | 14 |
34 namespace webrtc { | 15 namespace webrtc { |
35 | 16 |
36 namespace { | |
37 | |
38 // Modify an audio decoder to not advertise support for anything. | |
39 template <typename T> | |
40 struct NotAdvertised { | |
41 using Config = typename T::Config; | |
42 static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { | |
43 return T::SdpToConfig(audio_format); | |
44 } | |
45 static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) { | |
46 // Don't advertise support for anything. | |
47 } | |
48 static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const Config& config) { | |
49 return T::MakeAudioDecoder(config); | |
50 } | |
51 }; | |
52 | |
53 } // namespace | |
54 | |
55 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { | 17 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { |
56 return CreateAudioDecoderFactory< | 18 return CreateBuiltinAudioDecoderFactoryInternal(); |
57 | |
58 #if WEBRTC_USE_BUILTIN_OPUS | |
59 AudioDecoderOpus, | |
60 #endif | |
61 | |
62 #if WEBRTC_USE_BUILTIN_ISAC_FIX | |
63 AudioDecoderIsacFix, | |
64 #elif WEBRTC_USE_BUILTIN_ISAC_FLOAT | |
65 AudioDecoderIsacFloat, | |
66 #endif | |
67 | |
68 #if WEBRTC_USE_BUILTIN_G722 | |
69 AudioDecoderG722, | |
70 #endif | |
71 | |
72 #if WEBRTC_USE_BUILTIN_ILBC | |
73 AudioDecoderIlbc, | |
74 #endif | |
75 | |
76 AudioDecoderG711, NotAdvertised<AudioDecoderL16>>(); | |
77 } | 19 } |
78 | 20 |
79 } // namespace webrtc | 21 } // namespace webrtc |
OLD | NEW |